forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
310 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
analyzer/java/src/main/java/castro/analyzer/java/IndexScanner.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package castro.analyzer.java; | ||
|
||
import castro.analyzer.MetadataWriter; | ||
import com.sun.source.tree.CompilationUnitTree; | ||
import com.sun.tools.javac.tree.JCTree; | ||
import com.sun.tools.javac.tree.TreeScanner; | ||
|
||
public class IndexScanner extends TreeScanner { | ||
private MetadataWriter writer; | ||
private CompilationUnitTree unit; | ||
|
||
|
||
@Override | ||
public void scan(JCTree tree) { | ||
|
||
} | ||
|
||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module castro.analyzer.java { | ||
requires jdk.compiler; | ||
} | ||
//module castro.analyzer.java { | ||
// requires jdk.compiler; | ||
//} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
plugins { | ||
id 'java' | ||
id 'application' | ||
id "org.springframework.boot" version "2.0.2.RELEASE" | ||
id "io.spring.dependency-management" version "1.0.5.RELEASE" | ||
} | ||
|
||
mainClassName = 'castro.backend.Main' | ||
// https://dzone.com/articles/continuous-auto-restart-with-spring-boot-devtools | ||
configurations { | ||
dev | ||
} | ||
|
||
task backend(dependsOn: run) | ||
bootRun { | ||
// Use Spring Boot DevTool only when we run Gradle bootRun task | ||
classpath = sourceSets.main.runtimeClasspath + configurations.dev | ||
} | ||
|
||
dependencies { | ||
compile project(":model") | ||
|
||
compile "org.springframework.boot:spring-boot-starter-web" | ||
// http://localhost:8080/swagger-ui.html | ||
// compile "com.hubspot.jackson:jackson-datatype-protobuf:0.9.9-jackson2.9-proto3" | ||
// compile "io.springfox:springfox-swagger-ui:2.8.0" | ||
// compile "io.springfox:springfox-swagger2:2.8.0" | ||
// compile "javax.xml.bind:jaxb-api:2.3.0" | ||
|
||
compile "com.google.protobuf:protobuf-java-util:$protocVersion" | ||
compile "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion" | ||
} | ||
|
||
dev("org.springframework.boot:spring-boot-devtools") | ||
|
||
} | ||
|
||
task backend(dependsOn: bootRun) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package castro.backend; | ||
|
||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.http.converter.protobuf.ProtobufJsonFormatHttpMessageConverter; | ||
//import springfox.documentation.builders.ApiInfoBuilder; | ||
//import springfox.documentation.builders.PathSelectors; | ||
//import springfox.documentation.builders.RequestHandlerSelectors; | ||
//import springfox.documentation.service.ApiInfo; | ||
//import springfox.documentation.spi.DocumentationType; | ||
//import springfox.documentation.spring.web.plugins.Docket; | ||
//import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
|
||
import java.util.Arrays; | ||
|
||
@SpringBootApplication | ||
//@EnableSwagger2 | ||
public class Application { | ||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
|
||
// @Bean | ||
// public Docket repositoryApi() { | ||
// return new Docket(DocumentationType.SWAGGER_2) | ||
// .groupName("repository-api") | ||
// .apiInfo(apiInfo()) | ||
// .select() | ||
// .paths(PathSelectors.ant("/api/repository/*")) | ||
// .build(); | ||
// } | ||
// | ||
// @Bean | ||
// public Docket api() { | ||
// return new Docket(DocumentationType.SWAGGER_2) | ||
// .select() | ||
// .apis(RequestHandlerSelectors.basePackage("castro.backend.controllers")) | ||
// .paths(PathSelectors.ant("/api/*")) | ||
// .build() | ||
// .apiInfo(apiInfo()); | ||
// } | ||
// | ||
// private ApiInfo apiInfo() { | ||
// return new ApiInfoBuilder() | ||
// .title("Backend API") | ||
// .description("Hello world") | ||
// .termsOfServiceUrl("http://springfox.io") | ||
//// .license("Apache License Version 2.0") | ||
//// .licenseUrl("https://github.com/springfox/springfox/blob/master/LICENSE") | ||
//// .version("2.0") | ||
// .build(); | ||
// } | ||
|
||
@Bean | ||
ProtobufJsonFormatHttpMessageConverter protobufHttpMessageConverter() { | ||
return new ProtobufJsonFormatHttpMessageConverter(); | ||
} | ||
|
||
@Bean | ||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) { | ||
return args -> { | ||
System.out.println("Let's inspect the beans provided by Spring Boot:"); | ||
String[] beanNames = ctx.getBeanDefinitionNames(); | ||
Arrays.sort(beanNames); | ||
for (String beanName : beanNames) { | ||
System.out.println(beanName); | ||
} | ||
}; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
backend/src/main/java/castro/backend/controllers/AbstractContorller.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package castro.backend.controllers; | ||
|
||
public class AbstractContorller { | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/castro/backend/controllers/RepositoryApi.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package castro.backend.controllers; | ||
|
||
import castro.repository.Repository; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
// The pattern is a workaround to make implementations methods to inherit annotations | ||
// https://stackoverflow.com/questions/8002514/spring-mvc-annotated-controller-interface-with-pathvariable | ||
// https://jira.spring.io/browse/SPR-11055 | ||
|
||
@RequestMapping(value = "/api/repository", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public interface RepositoryApi { | ||
@RequestMapping(value = "/{id}") | ||
default Repository repository(@PathVariable String id) { | ||
return repositoryImpl(id); | ||
} | ||
Repository repositoryImpl(String id); | ||
|
||
@RequestMapping(value = "/{id}", method = RequestMethod.POST) | ||
default void repository(@PathVariable String id, @RequestBody Repository repo) { | ||
repositoryImpl(id, repo); | ||
} | ||
void repositoryImpl(String id, Repository repo); | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/castro/backend/controllers/RepositoryApiController.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package castro.backend.controllers; | ||
|
||
import castro.repository.Repository; | ||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import com.google.protobuf.util.JsonFormat; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class RepositoryApiController implements RepositoryApi { | ||
private Logger logger = LoggerFactory.getLogger(getClass()); | ||
|
||
@Override | ||
public Repository repositoryImpl(String id) { | ||
return Repository.newBuilder().setDomain("github.com").setMainBranch("master").setRepositoryId(id).build(); | ||
} | ||
|
||
@Override | ||
public void repositoryImpl(String id, Repository repo) { | ||
try { | ||
logger.info("update {}", JsonFormat.printer().print(repo)); | ||
} catch (InvalidProtocolBufferException e) { | ||
// e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd $(dirname $0)/.. | ||
|
||
tmuxp load scripts/tmux_session.yaml |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# download: pip install --user tmuxp | ||
# usage: tmuxp load tmux_session.yaml | ||
# see: https://github.com/tmux-python/tmuxp | ||
session_name: castro-dev | ||
windows: | ||
- window_name: elk | ||
layout: even-horizontal | ||
panes: | ||
- shell_command: | ||
- ./gradlew startKibana | ||
- shell_command: | ||
- ./gradlew startDeps | ||
- window_name: backend | ||
layout: even-horizontal | ||
panes: | ||
- shell_command: | ||
- ./gradlew bootRun | ||
- shell_command: | ||
- ./gradlew -t build | ||
- window_name: others | ||
layout: even-horizontal | ||
panes: | ||
- shell_command: | ||
- | ||
- shell_command: | ||
- |
This file contains 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
2 changes: 1 addition & 1 deletion
2
util/src/main/java/castro/hash/FileHash.java → util/src/main/java/castro/util/FileHash.java
This file contains 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
Oops, something went wrong.