This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file name must be .travis.yml | |
language: java | |
jdk: openjdk10 | |
before_install: | |
- wget http://services.gradle.org/distributions/gradle-5.4.1-bin.zip | |
- unzip -qq gradle-5.4.1-bin.zip | |
- export GRADLE_HOME=$PWD/gradle-5.4.1 | |
- export PATH=$GRADLE_HOME/bin:$PATH | |
- gradle -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SchemaParser { | |
private Lexer lexer; | |
private TokenType currentToken; | |
public SchemaParser(Reader r) { | |
lexer = new Lexer(r); | |
} | |
private RawSchema parse() throws SyntaxError { | |
RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Lexer { | |
private StreamTokenizer input; | |
public enum TokenType { | |
INTERFACE("INTERFACE"), | |
ENTITY("ENTITY"), | |
EMBEDABLE("EMBEDABLE"), | |
IMPLEMENTS("IMPLEMENTS"), | |
L_BRACE("{"), | |
R_BRACE("}"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExceptionHandler(EntityRecordException.class) | |
public ResponseEntity<?> handleEntityFoundException(EntityRecordException exception) { | |
HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR; | |
switch (exception.getErrorCode()) { | |
case MULTIPLE_LK_FOUND: | |
httpStatus = HttpStatus.CONFLICT; | |
break; | |
case LK_NOTFOUND: | |
case INSERTED_RECORD_NOT_FOUND: | |
httpStatus = HttpStatus.NOT_FOUND; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class ErrorService implements InitializingBean { | |
private List<String> ERROR_CODES = new ArrayList<>(); | |
@Override | |
public void afterPropertiesSet() throws Exception { | |
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); | |
provider.addIncludeFilter(new AssignableTypeFilter(GeminiException.class)); | |
Set<BeanDefinition> components = provider.findCandidateComponents("it.at7.gemini"); | |
for (BeanDefinition component : components) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityRecordException extends GeminiException { | |
public enum Code { | |
MULTIPLE_LK_FOUND, | |
LK_NOTFOUND, | |
INSERTED_RECORD_NOT_FOUND | |
} | |
private final Entity entity; | |
private final Collection<? extends Record.FieldValue> lk; | |
private final Code errorCode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GeminiException extends Exception { | |
String errorCodeName; | |
protected GeminiException(String errorCodeName) { | |
super(errorCodeName); | |
this.errorCodeName = errorCodeName; | |
} | |
protected GeminiException(String errorCodeName, String message) { | |
super(message); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" _ _ " | |
" _ /|| . . ||\ _ " | |
" ( } \||D ' ' ' C||/ { % " | |
" | /\__,=_[_] ' . . ' [_]_=,__/\ |" | |
" |_\_ |----| |----| _/_|" | |
" | |/ | | | | \| |" | |
" | /_ | | | | _\ |" | |
It is all fun and games until someone gets hacked! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
import org.springframework.scheduling.annotation.Scheduled; | |
import org.springframework.stereotype.Service; | |
import twitter4j.*; | |
import javax.annotation.PostConstruct; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; |
NewerOlder