diff --git a/.classpath b/.classpath index cf2b0ce..f5c5351 100644 --- a/.classpath +++ b/.classpath @@ -2,15 +2,9 @@ - - - - - - - - - - - + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..83ccc54 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/build/ +/bin/ diff --git a/.gradle/2.2.1/taskArtifacts/cache.properties b/.gradle/2.2.1/taskArtifacts/cache.properties new file mode 100644 index 0000000..f110f4b --- /dev/null +++ b/.gradle/2.2.1/taskArtifacts/cache.properties @@ -0,0 +1 @@ +#Tue May 26 17:53:04 CEST 2015 diff --git a/.gradle/2.2.1/taskArtifacts/cache.properties.lock b/.gradle/2.2.1/taskArtifacts/cache.properties.lock new file mode 100644 index 0000000..0fedbf5 Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/cache.properties.lock differ diff --git a/.gradle/2.2.1/taskArtifacts/fileHashes.bin b/.gradle/2.2.1/taskArtifacts/fileHashes.bin new file mode 100644 index 0000000..0620824 Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/fileHashes.bin differ diff --git a/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin b/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin new file mode 100644 index 0000000..b70c9f0 Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin differ diff --git a/.gradle/2.2.1/taskArtifacts/outputFileStates.bin b/.gradle/2.2.1/taskArtifacts/outputFileStates.bin new file mode 100644 index 0000000..099f5e5 Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/outputFileStates.bin differ diff --git a/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin b/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin new file mode 100644 index 0000000..e2ad8cc Binary files /dev/null and b/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin differ diff --git a/.gradle/2.3/taskArtifacts/cache.properties b/.gradle/2.3/taskArtifacts/cache.properties new file mode 100644 index 0000000..1b70971 --- /dev/null +++ b/.gradle/2.3/taskArtifacts/cache.properties @@ -0,0 +1 @@ +#Wed May 27 09:37:38 CEST 2015 diff --git a/.gradle/2.3/taskArtifacts/cache.properties.lock b/.gradle/2.3/taskArtifacts/cache.properties.lock new file mode 100644 index 0000000..8ae5af2 Binary files /dev/null and b/.gradle/2.3/taskArtifacts/cache.properties.lock differ diff --git a/.gradle/2.3/taskArtifacts/fileHashes.bin b/.gradle/2.3/taskArtifacts/fileHashes.bin new file mode 100644 index 0000000..fdd90f6 Binary files /dev/null and b/.gradle/2.3/taskArtifacts/fileHashes.bin differ diff --git a/.gradle/2.3/taskArtifacts/fileSnapshots.bin b/.gradle/2.3/taskArtifacts/fileSnapshots.bin new file mode 100644 index 0000000..4bf7ffa Binary files /dev/null and b/.gradle/2.3/taskArtifacts/fileSnapshots.bin differ diff --git a/.gradle/2.3/taskArtifacts/outputFileStates.bin b/.gradle/2.3/taskArtifacts/outputFileStates.bin new file mode 100644 index 0000000..811e3aa Binary files /dev/null and b/.gradle/2.3/taskArtifacts/outputFileStates.bin differ diff --git a/.gradle/2.3/taskArtifacts/taskArtifacts.bin b/.gradle/2.3/taskArtifacts/taskArtifacts.bin new file mode 100644 index 0000000..9bc00d4 Binary files /dev/null and b/.gradle/2.3/taskArtifacts/taskArtifacts.bin differ diff --git a/.project b/.project index b70587f..1f6c4db 100644 --- a/.project +++ b/.project @@ -1,6 +1,7 @@ - ch.psi.daq.rest + rest + @@ -9,14 +10,9 @@ - - org.eclipse.m2e.core.maven2Builder - - - - org.eclipse.m2e.core.maven2Nature + org.springsource.ide.eclipse.gradle.core.nature org.eclipse.jdt.core.javanature diff --git a/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs b/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs new file mode 100644 index 0000000..342c291 --- /dev/null +++ b/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs @@ -0,0 +1,5 @@ +#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences +#Tue May 26 17:48:59 CEST 2015 +build.family.org.gradle.tooling.model.eclipse.HierarchicalEclipseProject=; +org.springsource.ide.eclipse.gradle.linkedresources= +org.springsource.ide.eclipse.gradle.rootprojectloc= diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..fe60f11 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +# +#Wed May 27 10:41:51 CEST 2015 +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..6885fa5 --- /dev/null +++ b/build.gradle @@ -0,0 +1,49 @@ +apply plugin: 'java' +apply plugin: 'eclipse' + +sourceCompatibility = 1.8 +version = '1.0.0' +group = 'ch.psi.daq' + +repositories { + mavenLocal() + mavenCentral() + maven { url "http://slsyoke4.psi.ch:8081/artifactory/libs-releases" } + maven { url "http://slsyoke4.psi.ch:8081/artifactory/libs-snapshots" } +} + +dependencies { + compile 'ch.psi.daq:cassandra:1.0.0' + compile 'org.springframework.boot:spring-boot-starter-web:1.2.3.RELEASE' + compile 'org.apache.commons:commons-lang3:3.4' + testCompile group: 'junit', name: 'junit', version: '4.+' +} + +apply plugin: 'maven' + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +uploadArchives { + repositories { + mavenDeployer { + repository(url: "http://slsyoke4.psi.ch:8081/artifactory/libs-snapshots-local"){ + authentication(userName: "upload", password: "{DESede}eWKHxAtQ2Dc=") + } + pom.groupId = 'ch.psi.daq' + pom.artifactId = 'rest' + } + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..85ed6d8 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'rest' \ No newline at end of file diff --git a/src/main/java/ch/psi/daq/rest/DaqController.java b/src/main/java/ch/psi/daq/rest/DaqController.java new file mode 100644 index 0000000..326a09c --- /dev/null +++ b/src/main/java/ch/psi/daq/rest/DaqController.java @@ -0,0 +1,13 @@ +package ch.psi.daq.rest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RestController; + +import ch.psi.daq.cassandra.writer.CassandraWriter; + +@RestController +public class DaqController { + + @Autowired + private CassandraWriter writer; +} diff --git a/src/main/java/ch/psi/daq/rest/DaqRestApplication.java b/src/main/java/ch/psi/daq/rest/DaqRestApplication.java new file mode 100644 index 0000000..4d15523 --- /dev/null +++ b/src/main/java/ch/psi/daq/rest/DaqRestApplication.java @@ -0,0 +1,45 @@ +package ch.psi.daq.rest; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.web.SpringBootServletInitializer; +import org.springframework.context.annotation.ComponentScan; + +/** + * Entry point to our rest-frontend of the Swissfel application which most importantly wires all the @RestController annotated classes. + *

+ * + * This acts as a @Configuration class for Spring. As such it has @ComponentScan + * annotation that enables scanning for another Spring components in current + * package and its subpackages. + *

+ * Another annotation is @EnableAutoConfiguration which tells Spring Boot to run + * autoconfiguration. + *

+ * It also extends SpringBootServletInitializer which will configure Spring + * servlet for us, and overrides the configure() method to point to itself, so + * Spring can find the main configuration. + *

+ * Finally, the main() method consists of single static call to + * SpringApplication.run(). + *

+ * Methods annotated with {@link @Bean} are Java beans that are + * container-managed, i.e. managed by Spring. Whenever there are @Autowire, @Inject + * or similar annotations found in the code (which is being scanned through the @ComponentScan + * annotation), the container then knows how to create those beans and inject + * them accordingly. + */ +@SpringBootApplication +@ComponentScan(basePackages = { "ch.psi.daq" }) +public class DaqRestApplication extends SpringBootServletInitializer { + + public static void main(final String[] args) { + SpringApplication.run(DaqRestApplication.class, args); + } + + @Override + protected final SpringApplicationBuilder configure(final SpringApplicationBuilder application) { + return application.sources(DaqRestApplication.class); + } +}