<packaging>jar</packaging>\r
</configuration>\r
</execution>\r
- <execution>\r
- <id>install6</id>\r
- <phase>package</phase>\r
- <goals>\r
- <goal>install-file</goal>\r
- </goals>\r
- </execution>\r
</executions>\r
</plugin>\r
<plugin>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java">\r
+ <attributes>\r
+ <attribute name="optional" value="true"/>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">\r
+ <attributes>\r
+ <attribute name="test" value="true"/>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">\r
+ <attributes>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">\r
+ <attributes>\r
+ <attribute name="test" value="true"/>\r
+ <attribute name="optional" value="true"/>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">\r
+ <attributes>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">\r
+ <attributes>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>bisz-income-info</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.wst.validation.validationbuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.m2e.core.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>\r
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>\r
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>\r
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>\r
+ <classpathentry kind="src" path="target/m2e-wtp/web-resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>\r
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">\r
+ <attributes>\r
+ <attribute name="hide" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>\r
+ <classpathentry kind="output" path=""/>\r
+</classpath>\r
--- /dev/null
+eclipse.preferences.version=1\r
+encoding//src/main/java=UTF-8\r
+encoding//src/main/resources=UTF-8\r
+encoding//src/test/java=UTF-8\r
+encoding//src/test/resources=UTF-8\r
+encoding/<project>=UTF-8\r
--- /dev/null
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning\r
+org.eclipse.jdt.core.compiler.release=disabled\r
+org.eclipse.jdt.core.compiler.source=1.8\r
--- /dev/null
+activeProfiles=\r
+eclipse.preferences.version=1\r
+resolveWorkspaceProjects=true\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">\r
+ <wb-module deploy-name="mediacube-indexer">\r
+ <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>\r
+ <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>\r
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>\r
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>\r
+ <property name="java-output-path" value="/hu.user.mediacube.indexer/target/classes"/>\r
+ <property name="context-root" value="mediacube-indexer"/>\r
+ </wb-module>\r
+</project-modules>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<faceted-project>\r
+ <fixed facet="wst.jsdt.web"/>\r
+ <installed facet="java" version="1.8"/>\r
+ <installed facet="jst.web" version="2.3"/>\r
+ <installed facet="wst.jsdt.web" version="1.0"/>\r
+</faceted-project>\r
--- /dev/null
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
--- /dev/null
+Window
\ No newline at end of file
--- /dev/null
+disabled=06target\r
+eclipse.preferences.version=1\r
--- /dev/null
+#Spring\r
+\r
+https://medium.com/nycdev/java-build-a-tomcat-web-app-with-maven-and-spring-fbc823fa9a37\r
+https://www.baeldung.com/spring-boot-json-properties\r
+https://www.baeldung.com/spring-boot-testing-log-level\r
+https://www.baeldung.com/spring-web-contexts\r
+http://www.mybatis.org/spring/\r
+\r
+# Wildfly\r
+\r
+local user: admin/admin (represent: <secret value="YWRtaW4=" />)
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+ <parent>\r
+ <artifactId>spring-boot-starter-parent</artifactId>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <version>2.1.6.RELEASE</version>\r
+ <relativePath>pom.xml</relativePath>\r
+ </parent>\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>hu.user.mediacube</groupId>\r
+ <artifactId>indexer</artifactId>\r
+ <name>MediaCube Indexer</name>\r
+ <version>0.0.1-SNAPSHOT</version>\r
+ <url>http://maven.apache.org</url>\r
+ <build>\r
+ <finalName>mediacube-indexer</finalName>\r
+ <plugins>\r
+ <plugin>\r
+ <artifactId>maven-jar-plugin</artifactId>\r
+ <version>3.0.2</version>\r
+ <configuration>\r
+ <archive>\r
+ <manifest>\r
+ <addClasspath>true</addClasspath>\r
+ <mainClass>hu.user.mediacube.indexer.IndexerApplication</mainClass>\r
+ </manifest>\r
+ </archive>\r
+ </configuration>\r
+ </plugin>\r
+ <plugin>\r
+ <artifactId>maven-shade-plugin</artifactId>\r
+ <executions>\r
+ <execution>\r
+ <phase>package</phase>\r
+ <goals>\r
+ <goal>shade</goal>\r
+ </goals>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ <plugin>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-maven-plugin</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-web</artifactId>\r
+ <version>5.1.8.RELEASE</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-undertow</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-web</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ <scope>provided</scope>\r
+ <exclusions>\r
+ <exclusion>\r
+ <artifactId>tomcat-embed-websocket</artifactId>\r
+ <groupId>org.apache.tomcat.embed</groupId>\r
+ </exclusion>\r
+ <exclusion>\r
+ <artifactId>spring-boot-starter-tomcat</artifactId>\r
+ <groupId>org.springframework.boot</groupId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>javax.servlet</groupId>\r
+ <artifactId>javax.servlet-api</artifactId>\r
+ <version>4.0.0</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>4.12</version>\r
+ <scope>test</scope>\r
+ <exclusions>\r
+ <exclusion>\r
+ <artifactId>hamcrest-core</artifactId>\r
+ <groupId>org.hamcrest</groupId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-test</artifactId>\r
+ <version>5.1.8.RELEASE</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ </dependencies>\r
+ <properties>\r
+ <java.version>1.8</java.version>\r
+ <maven.compiler.source>1.8</maven.compiler.source>\r
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
+ <maven.compiler.target>1.8</maven.compiler.target>\r
+ </properties>\r
+</project>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">\r
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>\r
+<stringAttribute key="M2_GOALS" value="clean install"/>\r
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>\r
+<booleanAttribute key="M2_OFFLINE" value="false"/>\r
+<stringAttribute key="M2_PROFILES" value=""/>\r
+<listAttribute key="M2_PROPERTIES"/>\r
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>\r
+<booleanAttribute key="M2_SKIP_TESTS" value="false"/>\r
+<intAttribute key="M2_THREADS" value="1"/>\r
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>\r
+<stringAttribute key="M2_USER_SETTINGS" value=""/>\r
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>\r
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk"/>\r
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dspring.main.allow-bean-definition-overriding=true -Dlang=polish"/>\r
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/hu.user.mediacube.indexer}"/>\r
+</launchConfiguration>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">\r
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>\r
+<stringAttribute key="M2_GOALS" value="spring-boot:run"/>\r
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>\r
+<booleanAttribute key="M2_OFFLINE" value="false"/>\r
+<stringAttribute key="M2_PROFILES" value=""/>\r
+<listAttribute key="M2_PROPERTIES"/>\r
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>\r
+<booleanAttribute key="M2_SKIP_TESTS" value="true"/>\r
+<intAttribute key="M2_THREADS" value="1"/>\r
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>\r
+<stringAttribute key="M2_USER_SETTINGS" value=""/>\r
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>\r
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk"/>\r
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dspring.main.allow-bean-definition-overriding=true -Dlang=polish"/>\r
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/hu.user.mediacube.indexer}"/>\r
+</launchConfiguration>\r
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>hu.user.mediacube</groupId>\r
+ <artifactId>indexer</artifactId>\r
+ <packaging>jar</packaging>\r
+ <version>0.0.1-SNAPSHOT</version>\r
+ <name>MediaCube Indexer</name>\r
+ <url>http://maven.apache.org</url>\r
+ <parent>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-parent</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ <relativePath/>\r
+ <!-- lookup parent from repository -->\r
+ </parent> \r
+ <properties>\r
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
+ <java.version>1.8</java.version>\r
+ <maven.compiler.source>1.8</maven.compiler.source>\r
+ <maven.compiler.target>1.8</maven.compiler.target>\r
+ </properties>\r
+ <dependencies>\r
+ <!-- self hosting \r
+ <dependency>\r
+ <groupId>io.undertow</groupId>\r
+ <artifactId>undertow-servlet</artifactId>\r
+ <version>1.4.18.Final</version>\r
+ </dependency>\r
+ -->\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-web</artifactId>\r
+ <version>5.1.8.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-undertow</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-web</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ <exclusions>\r
+ <exclusion>\r
+ <groupId>org.apache.tomcat.embed</groupId>\r
+ <artifactId>tomcat-embed-websocket</artifactId>\r
+ </exclusion>\r
+ <exclusion>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-tomcat</artifactId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>javax.servlet</groupId>\r
+ <artifactId>javax.servlet-api</artifactId>\r
+ <version>4.0.0</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>4.12</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-test</artifactId>\r
+ <version>5.1.8.RELEASE</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ </dependencies>\r
+ <build>\r
+ <finalName>mediacube-indexer</finalName>\r
+ <plugins>\r
+ <!-- self hosting\r
+ -->\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-jar-plugin</artifactId>\r
+ <version>3.0.2</version>\r
+ <configuration>\r
+ <archive>\r
+ <manifest>\r
+ <addClasspath>true</addClasspath>\r
+ <mainClass>hu.user.mediacube.indexer.IndexerApplication</mainClass>\r
+ </manifest>\r
+ </archive>\r
+ </configuration>\r
+ </plugin>\r
+<!-- \r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-shade-plugin</artifactId>\r
+ <executions>\r
+ <execution>\r
+ <phase>package</phase>\r
+ <goals>\r
+ <goal>shade</goal>\r
+ </goals>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ -->\r
+ <plugin>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-maven-plugin</artifactId>\r
+ <version>2.1.6.RELEASE</version>\r
+ </plugin>\r
+ <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration></configuration> \r
+ </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <server>mytomcat7</server> \r
+ <path>/</path> </configuration> </plugin> -->\r
+ </plugins>\r
+ </build>\r
+</project>\r
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import static java.util.concurrent.TimeUnit.SECONDS;\r
+\r
+import java.util.concurrent.Executors;\r
+import java.util.concurrent.ScheduledExecutorService;\r
+import java.util.concurrent.ScheduledFuture;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import javax.annotation.PostConstruct;\r
+import javax.annotation.PreDestroy;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.stereotype.Service;\r
+\r
+@Service\r
+public class BeeperControl {\r
+ private static Logger logger = LoggerFactory.getLogger(BeeperControl.class);\r
+ private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);\r
+ private ScheduledFuture<?> beeperHandle;\r
+\r
+ public void beepForAnHour() {\r
+\r
+ final Runnable beeper = new Runnable() {\r
+ @Override\r
+ public void run() {\r
+ System.out.println("beep");\r
+ }\r
+ };\r
+\r
+ beeperHandle = scheduler.scheduleAtFixedRate(beeper, 0, 5, SECONDS);\r
+\r
+ scheduler.schedule(new Runnable() {\r
+ @Override\r
+ public void run() {\r
+ beeperHandle.cancel(true);\r
+ }\r
+ }, 60 * 60, SECONDS);\r
+ }\r
+\r
+ @PostConstruct\r
+ public void start() {\r
+ logger.info("start");\r
+ beepForAnHour();\r
+ }\r
+\r
+ @PreDestroy\r
+ public void stop() {\r
+ if (beeperHandle != null)\r
+ beeperHandle.cancel(true);\r
+ try {\r
+ scheduler.awaitTermination(2, TimeUnit.SECONDS);\r
+ } catch (InterruptedException e) {\r
+ logger.error("Scheduler termination error", e);\r
+ }\r
+ logger.info("stop");\r
+ }\r
+}\r
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+\r
+//@Service\r
+public class EnglishGreetingService implements GreetingService {\r
+\r
+ @Autowired\r
+ private JsonProperties jsonProperties;\r
+\r
+ @Override\r
+ public String greet(int id) {\r
+ String message = "Hello";\r
+ if (jsonProperties != null)\r
+ message = jsonProperties.getMessage();\r
+ return message + " " + id;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+public interface GreetingService {\r
+\r
+ String greet(int id);\r
+\r
+}\r
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;\r
+import org.springframework.context.annotation.Bean;\r
+import org.springframework.context.annotation.Configuration;\r
+\r
+//https://stormpath.com/blog/spring-boot-dependency-injection\r
+@Configuration\r
+public class GreetingServiceConfig {\r
+\r
+ @Bean\r
+ @ConditionalOnProperty(name = "lang", havingValue = "english", matchIfMissing = true)\r
+ public GreetingService englishGreetingService() {\r
+ return new EnglishGreetingService();\r
+ }\r
+\r
+ @Bean\r
+ @ConditionalOnProperty(name = "lang", havingValue = "polish")\r
+ public GreetingService polishGreetingService() {\r
+ return new PolishGreetingService();\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import javax.annotation.PreDestroy;\r
+import javax.servlet.ServletContext;\r
+import javax.servlet.ServletException;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.boot.SpringApplication;\r
+import org.springframework.boot.autoconfigure.SpringBootApplication;\r
+import org.springframework.boot.builder.SpringApplicationBuilder;\r
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;\r
+import org.springframework.context.ConfigurableApplicationContext;\r
+\r
+@SpringBootApplication\r
+public class IndexerApplication extends SpringBootServletInitializer {\r
+ private static Logger logger = LoggerFactory.getLogger(IndexerApplication.class);\r
+\r
+ // Maven + self hosted Tomcat execution only\r
+ public static void main(String[] args) {\r
+ ConfigurableApplicationContext context = SpringApplication.run(IndexerApplication.class, args);\r
+ logger.info("Starting main with context type {}", context.getClass());\r
+\r
+ }\r
+\r
+ @Override\r
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {\r
+ logger.info("Starting configure");\r
+ return builder.sources(IndexerApplication.class);\r
+ }\r
+\r
+ @PreDestroy\r
+ public void onDestroy() throws Exception {\r
+ logger.info("Stopping");\r
+ }\r
+\r
+ @Override\r
+ public void onStartup(ServletContext servletContext) throws ServletException {\r
+ logger.info("Event hooked");\r
+ super.onStartup(servletContext);\r
+ }\r
+\r
+ // Dump available beans\r
+ // @Bean\r
+ // public CommandLineRunner commandLineRunner(ApplicationContext ctx) {\r
+ // return args -> {\r
+ //\r
+ // logger.info("Let's inspect the beans provided by Spring Boot:");\r
+ //\r
+ // String[] beanNames = ctx.getBeanDefinitionNames();\r
+ // Arrays.sort(beanNames);\r
+ // for (String beanName : beanNames) {\r
+ // logger.info(beanName);\r
+ // }\r
+ //\r
+ // };\r
+ // }\r
+}\r
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import org.springframework.boot.context.properties.ConfigurationProperties;\r
+import org.springframework.context.annotation.PropertySource;\r
+import org.springframework.stereotype.Component;\r
+\r
+@Component\r
+@PropertySource(value = "classpath:configprops.json", factory = JsonPropertySourceFactory.class)\r
+@ConfigurationProperties\r
+public class JsonProperties {\r
+ private String message;\r
+ private String polishMessage;\r
+\r
+ public String getMessage() {\r
+ return message;\r
+ }\r
+\r
+ public void setMessage(String message) {\r
+ this.message = message;\r
+ }\r
+\r
+ public String getPolishMessage() {\r
+ return polishMessage;\r
+ }\r
+\r
+ public void setPolishMessage(String polishMessage) {\r
+ this.polishMessage = polishMessage;\r
+ }\r
+}\r
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import java.io.IOException;\r
+import java.util.Map;\r
+\r
+import org.springframework.core.env.MapPropertySource;\r
+import org.springframework.core.env.PropertySource;\r
+import org.springframework.core.io.support.EncodedResource;\r
+import org.springframework.core.io.support.PropertySourceFactory;\r
+\r
+import com.fasterxml.jackson.databind.ObjectMapper;\r
+\r
+public class JsonPropertySourceFactory implements PropertySourceFactory {\r
+\r
+ @Override\r
+ public PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {\r
+ Map readValue = new ObjectMapper().readValue(resource.getInputStream(), Map.class);\r
+ return new MapPropertySource("json-property", readValue);\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+\r
+//@Service\r
+public class PolishGreetingService implements GreetingService {\r
+\r
+ @Autowired\r
+ private JsonProperties jsonProperties;\r
+\r
+ @Override\r
+ public String greet(int id) {\r
+ String message = "Hello";\r
+ if (jsonProperties != null)\r
+ message = jsonProperties.getPolishMessage();\r
+ return message + " " + id;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+package hu.user.mediacube.indexer;\r
+\r
+import java.time.ZoneId;\r
+import java.time.ZonedDateTime;\r
+import java.util.Date;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.web.bind.annotation.GetMapping;\r
+import org.springframework.web.bind.annotation.PathVariable;\r
+import org.springframework.web.bind.annotation.RequestMapping;\r
+import org.springframework.web.bind.annotation.RestController;\r
+\r
+@RestController\r
+@RequestMapping("rest")\r
+public class RESTController {\r
+ private static Logger logger = LoggerFactory.getLogger(RESTController.class);\r
+\r
+ public class CustomResponse {\r
+ private int age;\r
+ private String name;\r
+ private ZonedDateTime date;\r
+\r
+ public int getAge() {\r
+ return age;\r
+ }\r
+\r
+ public void setAge(int age) {\r
+ this.age = age;\r
+ }\r
+\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ public void setName(String name) {\r
+ this.name = name;\r
+ }\r
+\r
+ public ZonedDateTime getDate() {\r
+ return date;\r
+ }\r
+\r
+ public void setDate(ZonedDateTime date) {\r
+ this.date = date;\r
+ }\r
+\r
+ }\r
+\r
+// @Configuration\r
+// public class JacksonConfiguration {\r
+//\r
+// @Bean\r
+// public ObjectMapper objectMapper() {\r
+// ObjectMapper mapper = new ObjectMapper();\r
+// mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);\r
+// mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);\r
+//\r
+// return mapper;\r
+// }\r
+// }\r
+\r
+ @Autowired\r
+ GreetingService greetingService;\r
+\r
+ @GetMapping(path = "/{id}", produces = "application/json")\r
+ public CustomResponse getBook(@PathVariable int id) {\r
+ logger.info("getBook");\r
+ CustomResponse result = new CustomResponse();\r
+ result.setAge(id);\r
+ result.setName(greetingService.greet(id));\r
+ result.setDate(ZonedDateTime.ofInstant(new Date().toInstant(), ZoneId.systemDefault()));\r
+ return result;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+{\r
+ "message" : "Hy",\r
+ "polishMessage" : "Czesc"\r
+}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML>\r
+<html xmlns:th="http://www.thymeleaf.org">\r
+<head>\r
+ <title>Getting Started: Serving Web Content</title>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
+</head>\r
+<body>\r
+ <p th:text="'Hello ' + ${name} + '!'" />\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE web-app PUBLIC\r
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"\r
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >\r
+\r
+<web-app>\r
+ <display-name>Archetype Created Web Application</display-name>\r
+<!-- \r
+ <servlet>\r
+ <servlet-name>Hello</servlet-name>\r
+ <servlet-class>HelloServlet</servlet-class>\r
+ </servlet>\r
+ <servlet-mapping>\r
+ <servlet-name>Hello</servlet-name>\r
+ <url-pattern>/hello</url-pattern>\r
+ </servlet-mapping>\r
+ -->\r
+</web-app>\r
--- /dev/null
+<html>\r
+<body>\r
+<h2>Hello World!</h2>\r
+</body>\r
+</html>\r
--- /dev/null
+package net.elgekko.bisz.incomeinfo;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.test.context.ContextConfiguration;\r
+import org.springframework.test.context.junit4.SpringRunner;\r
+\r
+import hu.user.mediacube.indexer.IndexerApplication;\r
+import hu.user.mediacube.indexer.JsonProperties;\r
+\r
+@RunWith(SpringRunner.class)\r
+@ContextConfiguration(classes = IndexerApplication.class)\r
+\r
+public class TestJsonProperties {\r
+\r
+ @Autowired\r
+ private JsonProperties jsonProperties;\r
+\r
+ @Test\r
+ public void whenPropertiesLoadedViaJsonPropertySource_thenLoadFlatValues() {\r
+ assertEquals("Hy", jsonProperties.getMessage());\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<configuration>\r
+ <include resource="/org/springframework/boot/logging/logback/base.xml"/>\r
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">\r
+ <encoder>\r
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n\r
+ </pattern>\r
+ </encoder>\r
+ </appender>\r
+ <root level="error">\r
+ <appender-ref ref="STDOUT"/>\r
+ </root>\r
+ <logger name="hu.user.mediacube.indexer" level="debug"/>\r
+</configuration>
\ No newline at end of file
--- /dev/null
+{\r
+ "message" : "Hy",\r
+ "polishMessage" : "Czesc"\r
+}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML>\r
+<html xmlns:th="http://www.thymeleaf.org">\r
+<head>\r
+ <title>Getting Started: Serving Web Content</title>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
+</head>\r
+<body>\r
+ <p th:text="'Hello ' + ${name} + '!'" />\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+#Created by Apache Maven 3.3.9\r
+version=0.0.1-SNAPSHOT\r
+groupId=hu.user.mediacube\r
+artifactId=indexer\r
--- /dev/null
+hu\user\mediacube\indexer\BeeperControl.class
+hu\user\mediacube\indexer\BeeperControl$1.class
+hu\user\mediacube\indexer\GreetingServiceConfig.class
+hu\user\mediacube\indexer\JsonProperties.class
+hu\user\mediacube\indexer\PolishGreetingService.class
+hu\user\mediacube\indexer\EnglishGreetingService.class
+hu\user\mediacube\indexer\JsonPropertySourceFactory.class
+hu\user\mediacube\indexer\IndexerApplication.class
+hu\user\mediacube\indexer\GreetingService.class
+hu\user\mediacube\indexer\RESTController.class
+hu\user\mediacube\indexer\RESTController$CustomResponse.class
+hu\user\mediacube\indexer\BeeperControl$2.class
--- /dev/null
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\BeeperControl.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\JsonPropertySourceFactory.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\GreetingService.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\RESTController.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\IndexerApplication.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\PolishGreetingService.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\EnglishGreetingService.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\GreetingServiceConfig.java
+C:\_workspace\USER\MediaCube\server\hu.user.mediacube.indexer\src\main\java\hu\user\mediacube\indexer\JsonProperties.java