Assembled lite version.
Change-Id: I48e60fffd9219a97923e7c388f4f97bcda416d3f
diff --git a/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java b/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
new file mode 100644
index 0000000..338c43f
--- /dev/null
+++ b/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
@@ -0,0 +1,31 @@
+package de.ids_mannheim.korap.server;
+
+import de.ids_mannheim.korap.config.BeansFactory;
+import de.ids_mannheim.korap.web.KustvaktBaseServer;
+
+public class KustvaktLiteServer extends KustvaktBaseServer{
+
+
+ public static void main (String[] args) throws Exception {
+ KustvaktLiteServer server = new KustvaktLiteServer();
+ kargs = server.readAttributes(args);
+
+ if (kargs.getConfig() != null)
+ BeansFactory.loadFileContext(kargs.getConfig());
+ else{
+ kargs.setConfig("light-config.xml");
+ BeansFactory.loadClasspathContext();
+ }
+ kargs.setRootPackages(new String[] { "de.ids_mannheim.korap.web.service.light" });
+ rootPackages = "de.ids_mannheim.korap.web.service.light";
+
+ server.start();
+ }
+
+ @Override
+ protected void setup () {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java b/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
index 3d1e900..476b6bf 100644
--- a/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
+++ b/lite/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
@@ -1,14 +1,33 @@
package de.ids_mannheim.korap.web.service.light;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+
import com.sun.jersey.core.util.MultivaluedMapImpl;
-import de.ids_mannheim.korap.config.BeansFactory;
+
import de.ids_mannheim.korap.config.KustvaktConfiguration;
import de.ids_mannheim.korap.config.QueryBuilderUtil;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.exceptions.StatusCodes;
import de.ids_mannheim.korap.query.serialize.MetaQueryBuilder;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.resource.rewrite.FoundryInject;
import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
import de.ids_mannheim.korap.utils.KoralCollectionQueryBuilder;
import de.ids_mannheim.korap.utils.KustvaktLogger;
@@ -16,45 +35,33 @@
import de.ids_mannheim.korap.web.SearchKrill;
import de.ids_mannheim.korap.web.TRACE;
import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.SecurityContext;
-import javax.ws.rs.core.UriBuilder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
/**
* @author hanl
* @date 29/01/2014
+ *
+ * @author margaretha
+ * @date 21/09/2017
*/
-@Path("v0.1" + "/")
+@Controller
+@Path("/")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public class LightService {
private static Logger jlog = LoggerFactory.getLogger(LightService.class);
+ @Autowired
private SearchKrill searchKrill;
private ClientsHandler graphDBhandler;
+ @Autowired
private RewriteHandler processor;
+ @Autowired
private KustvaktConfiguration config;
public LightService () {
- this.config = BeansFactory.getKustvaktContext().getConfiguration();
- this.searchKrill = new SearchKrill(config.getIndexDir());
UriBuilder builder = UriBuilder.fromUri("http://10.0.10.13").port(9997);
this.graphDBhandler = new ClientsHandler(builder.build());
- this.processor = new RewriteHandler();
- this.processor.add(FoundryInject.class);
-// this.processor.insertBeans(BeansFactory.getKustvaktContext());
}
diff --git a/lite/src/main/resources/kustvakt-lite.conf b/lite/src/main/resources/kustvakt-lite.conf
new file mode 100644
index 0000000..87b1c8e
--- /dev/null
+++ b/lite/src/main/resources/kustvakt-lite.conf
@@ -0,0 +1,17 @@
+# index dir
+krill.indexDir= ../sample-index
+
+krill.index.commit.count = 134217000
+krill.index.commit.log = log/krill.commit.log
+krill.index.commit.auto = 500
+krill.index.relations.max = 100
+
+kustvakt.default.pos = tt
+kustvakt.default.lemma = tt
+kustvakt.default.token = opennlp
+kustvakt.default.dep = mate
+kustvakt.default.const = mate
+
+# server
+server.port=8089
+server.host=localhost
diff --git a/lite/src/main/resources/light-config.xml b/lite/src/main/resources/light-config.xml
index 5ac341a..3ff2ef1 100644
--- a/lite/src/main/resources/light-config.xml
+++ b/lite/src/main/resources/light-config.xml
@@ -1,25 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util-4.0.xsd">
+ http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-4.0.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-4.0.xsd">
- <!--<util:properties id="props" location="classpath:kustvakt.conf"/>-->
+ <context:component-scan base-package="de.ids_mannheim.korap" />
+ <context:annotation-config />
- <bean id="props"
+ <bean id="properties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="ignoreResourceNotFound" value="true"/>
<property name="locations">
<array>
- <value>classpath:kustvakt.conf</value>
- <value>file:./kustvakt.conf</value>
+ <value>classpath:kustvakt-lite.conf</value>
+ <value>file:./kustvakt-lite.conf</value>
</array>
</property>
</bean>
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="properties">
+ <ref bean="properties"/>
+ </property>
+ </bean>
<bean id="kustvakt_auditing"
class="de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing">
@@ -27,10 +37,16 @@
<bean id="kustvakt_config"
class="de.ids_mannheim.korap.config.KustvaktConfiguration">
- <property name="properties" ref="props"/>
+ <constructor-arg index="0" name="properties" ref="properties"/>
</bean>
<bean name="kustvakt_encryption"
class="de.ids_mannheim.korap.interfaces.defaults.DefaultEncryption">
</bean>
+
+ <bean id="search_krill"
+ class="de.ids_mannheim.korap.web.SearchKrill">
+ <constructor-arg value="${krill.indexDir}"/>
+ </bean>
+
</beans>
\ No newline at end of file
diff --git a/lite/src/main/resources/log4j.properties b/lite/src/main/resources/log4j.properties
new file mode 100644
index 0000000..5d769fb
--- /dev/null
+++ b/lite/src/main/resources/log4j.properties
@@ -0,0 +1,35 @@
+
+# Root logger option
+#log4j.threshold=ALL
+log4j.rootLogger=error, stdout, debugLog
+log4j.logger.log=ERROR, errorLog
+
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd, HH:mm:ss} %C{6} - %M%n %-5p: %m%n
+
+log4j.appender.errorLog=org.apache.log4j.RollingFileAppender
+log4j.appender.errorLog.layout=org.apache.log4j.PatternLayout
+log4j.appender.errorLog.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %C{6} - %M %n %-5p: %m%n
+log4j.appender.errorLog.File=./logs/errors.log
+
+log4j.appender.policyLog=org.apache.log4j.RollingFileAppender
+log4j.appender.policyLog.layout=org.apache.log4j.PatternLayout
+log4j.appender.policyLog.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %C{6} - %M %n %-5p: %m%n
+log4j.appender.policyLog.File=./logs/policies.log
+
+log4j.appender.authLog=org.apache.log4j.RollingFileAppender
+log4j.appender.authLog.layout=org.apache.log4j.PatternLayout
+log4j.appender.authLog.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %C{6} - %M %n %-5p: %m%n
+log4j.appender.authLog.File=./logs/auth.log
+
+log4j.appender.debugLog=org.apache.log4j.RollingFileAppender
+log4j.appender.debugLog.layout=org.apache.log4j.PatternLayout
+log4j.appender.debugLog.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %C{6} - %M %n %-5p: %m%n
+log4j.appender.debugLog.File=./logs/logging.log
+
+
+log4j.logger.de.ids_mannheim.korap.security.ac = ERROR, policyLog
+log4j.logger.de.ids_mannheim.korap.security.auth = ERROR, authLog
\ No newline at end of file