Revision 45603
Added by Michele Artini about 7 years ago
modules/dnet-springboot-apps/trunk/dnet-is-application/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="src" output="target/classes" path="src/main/java"> |
|
4 |
<attributes> |
|
5 |
<attribute name="optional" value="true"/> |
|
6 |
<attribute name="maven.pomderived" value="true"/> |
|
7 |
</attributes> |
|
8 |
</classpathentry> |
|
9 |
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> |
|
10 |
<attributes> |
|
11 |
<attribute name="maven.pomderived" value="true"/> |
|
12 |
</attributes> |
|
13 |
</classpathentry> |
|
14 |
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> |
|
15 |
<attributes> |
|
16 |
<attribute name="optional" value="true"/> |
|
17 |
<attribute name="maven.pomderived" value="true"/> |
|
18 |
</attributes> |
|
19 |
</classpathentry> |
|
20 |
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> |
|
21 |
<attributes> |
|
22 |
<attribute name="maven.pomderived" value="true"/> |
|
23 |
</attributes> |
|
24 |
</classpathentry> |
|
25 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> |
|
26 |
<attributes> |
|
27 |
<attribute name="maven.pomderived" value="true"/> |
|
28 |
</attributes> |
|
29 |
</classpathentry> |
|
30 |
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> |
|
31 |
<attributes> |
|
32 |
<attribute name="maven.pomderived" value="true"/> |
|
33 |
</attributes> |
|
34 |
</classpathentry> |
|
35 |
<classpathentry kind="src" path=".apt_generated"> |
|
36 |
<attributes> |
|
37 |
<attribute name="optional" value="true"/> |
|
38 |
</attributes> |
|
39 |
</classpathentry> |
|
40 |
<classpathentry kind="output" path="target/classes"/> |
|
41 |
</classpath> |
modules/dnet-springboot-apps/trunk/dnet-is-application/.factorypath | ||
---|---|---|
1 |
<factorypath> |
|
2 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-data-mongodb/1.4.2.RELEASE/spring-boot-starter-data-mongodb-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
3 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter/1.4.2.RELEASE/spring-boot-starter-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
4 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot/1.4.2.RELEASE/spring-boot-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
5 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/1.4.2.RELEASE/spring-boot-autoconfigure-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
6 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-logging/1.4.2.RELEASE/spring-boot-starter-logging-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
7 |
<factorypathentry kind="VARJAR" id="M2_REPO/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar" enabled="true" runInBatchMode="false"/> |
|
8 |
<factorypathentry kind="VARJAR" id="M2_REPO/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar" enabled="true" runInBatchMode="false"/> |
|
9 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jul-to-slf4j/1.7.21/jul-to-slf4j-1.7.21.jar" enabled="true" runInBatchMode="false"/> |
|
10 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/log4j-over-slf4j/1.7.21/log4j-over-slf4j-1.7.21.jar" enabled="true" runInBatchMode="false"/> |
|
11 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar" enabled="true" runInBatchMode="false"/> |
|
12 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/mongodb/mongodb-driver/3.2.2/mongodb-driver-3.2.2.jar" enabled="true" runInBatchMode="false"/> |
|
13 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/mongodb/mongodb-driver-core/3.2.2/mongodb-driver-core-3.2.2.jar" enabled="true" runInBatchMode="false"/> |
|
14 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/mongodb/bson/3.2.2/bson-3.2.2.jar" enabled="true" runInBatchMode="false"/> |
|
15 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/data/spring-data-mongodb/1.9.5.RELEASE/spring-data-mongodb-1.9.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
16 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-tx/4.3.4.RELEASE/spring-tx-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
17 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-expression/4.3.4.RELEASE/spring-expression-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
18 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/data/spring-data-commons/1.12.5.RELEASE/spring-data-commons-1.12.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
19 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar" enabled="true" runInBatchMode="false"/> |
|
20 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar" enabled="true" runInBatchMode="false"/> |
|
21 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-web/1.4.2.RELEASE/spring-boot-starter-web-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
22 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-tomcat/1.4.2.RELEASE/spring-boot-starter-tomcat-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
23 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/tomcat/embed/tomcat-embed-core/8.5.6/tomcat-embed-core-8.5.6.jar" enabled="true" runInBatchMode="false"/> |
|
24 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/tomcat/embed/tomcat-embed-el/8.5.6/tomcat-embed-el-8.5.6.jar" enabled="true" runInBatchMode="false"/> |
|
25 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.6/tomcat-embed-websocket-8.5.6.jar" enabled="true" runInBatchMode="false"/> |
|
26 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar" enabled="true" runInBatchMode="false"/> |
|
27 |
<factorypathentry kind="VARJAR" id="M2_REPO/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar" enabled="true" runInBatchMode="false"/> |
|
28 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar" enabled="true" runInBatchMode="false"/> |
|
29 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar" enabled="true" runInBatchMode="false"/> |
|
30 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.8.4/jackson-databind-2.8.4.jar" enabled="true" runInBatchMode="false"/> |
|
31 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.8.4/jackson-annotations-2.8.4.jar" enabled="true" runInBatchMode="false"/> |
|
32 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-web/4.3.4.RELEASE/spring-web-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
33 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-aop/4.3.4.RELEASE/spring-aop-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
34 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-webmvc/4.3.4.RELEASE/spring-webmvc-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
35 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-configuration-processor/1.4.2.RELEASE/spring-boot-configuration-processor-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
36 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/json/json/20140107/json-20140107.jar" enabled="true" runInBatchMode="false"/> |
|
37 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/4.3.4.RELEASE/spring-core-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
38 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-test/1.4.2.RELEASE/spring-boot-starter-test-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
39 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-test/1.4.2.RELEASE/spring-boot-test-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
40 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-test-autoconfigure/1.4.2.RELEASE/spring-boot-test-autoconfigure-1.4.2.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
41 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/jayway/jsonpath/json-path/2.2.0/json-path-2.2.0.jar" enabled="true" runInBatchMode="false"/> |
|
42 |
<factorypathentry kind="VARJAR" id="M2_REPO/net/minidev/json-smart/2.2.1/json-smart-2.2.1.jar" enabled="true" runInBatchMode="false"/> |
|
43 |
<factorypathentry kind="VARJAR" id="M2_REPO/net/minidev/accessors-smart/1.1/accessors-smart-1.1.jar" enabled="true" runInBatchMode="false"/> |
|
44 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar" enabled="true" runInBatchMode="false"/> |
|
45 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/assertj/assertj-core/2.5.0/assertj-core-2.5.0.jar" enabled="true" runInBatchMode="false"/> |
|
46 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar" enabled="true" runInBatchMode="false"/> |
|
47 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/objenesis/objenesis/2.1/objenesis-2.1.jar" enabled="true" runInBatchMode="false"/> |
|
48 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" enabled="true" runInBatchMode="false"/> |
|
49 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar" enabled="true" runInBatchMode="false"/> |
|
50 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/skyscreamer/jsonassert/1.3.0/jsonassert-1.3.0.jar" enabled="true" runInBatchMode="false"/> |
|
51 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-test/4.3.4.RELEASE/spring-test-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
52 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar" enabled="true" runInBatchMode="false"/> |
|
53 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-webmvc/4.2.5.RELEASE/spring-webmvc-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
54 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/4.2.5.RELEASE/spring-core-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
55 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-expression/4.2.5.RELEASE/spring-expression-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
56 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-web/4.2.5.RELEASE/spring-web-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
57 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/quartz-scheduler/quartz/2.2.2/quartz-2.2.2.jar" enabled="true" runInBatchMode="false"/> |
|
58 |
<factorypathentry kind="VARJAR" id="M2_REPO/c3p0/c3p0/0.9.1.1/c3p0-0.9.1.1.jar" enabled="true" runInBatchMode="false"/> |
|
59 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar" enabled="true" runInBatchMode="false"/> |
|
60 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context/4.2.5.RELEASE/spring-context-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
61 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-aop/4.2.5.RELEASE/spring-aop-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
62 |
<factorypathentry kind="VARJAR" id="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" enabled="true" runInBatchMode="false"/> |
|
63 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-beans/4.2.5.RELEASE/spring-beans-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
64 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context-support/4.2.5.RELEASE/spring-context-support-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
65 |
<factorypathentry kind="VARJAR" id="M2_REPO/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1.jar" enabled="true" runInBatchMode="false"/> |
|
66 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/antlr/stringtemplate/3.2/stringtemplate-3.2.jar" enabled="true" runInBatchMode="false"/> |
|
67 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/antlr/antlr/2.7.7/antlr-2.7.7.jar" enabled="true" runInBatchMode="false"/> |
|
68 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-io/commons-io/2.4/commons-io-2.4.jar" enabled="true" runInBatchMode="false"/> |
|
69 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/gson/gson/2.6.2/gson-2.6.2.jar" enabled="true" runInBatchMode="false"/> |
|
70 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar" enabled="true" runInBatchMode="false"/> |
|
71 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar" enabled="true" runInBatchMode="false"/> |
|
72 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" enabled="true" runInBatchMode="false"/> |
|
73 |
<factorypathentry kind="VARJAR" id="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" enabled="true" runInBatchMode="false"/> |
|
74 |
<factorypathentry kind="VARJAR" id="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" enabled="true" runInBatchMode="false"/> |
|
75 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/mockito/mockito-core/1.6/mockito-core-1.6.jar" enabled="true" runInBatchMode="false"/> |
|
76 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar" enabled="true" runInBatchMode="false"/> |
|
77 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar" enabled="true" runInBatchMode="false"/> |
|
78 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/objenesis/objenesis/1.0/objenesis-1.0.jar" enabled="true" runInBatchMode="false"/> |
|
79 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-test/4.2.5.RELEASE/spring-test-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
80 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-codec/commons-codec/1.8/commons-codec-1.8.jar" enabled="true" runInBatchMode="false"/> |
|
81 |
<factorypathentry kind="VARJAR" id="M2_REPO/saxonica/saxon-dom/9.1.0.8/saxon-dom-9.1.0.8.jar" enabled="true" runInBatchMode="false"/> |
|
82 |
<factorypathentry kind="VARJAR" id="M2_REPO/jaxen/jaxen/1.1.6/jaxen-1.1.6.jar" enabled="true" runInBatchMode="false"/> |
|
83 |
<factorypathentry kind="VARJAR" id="M2_REPO/saxonica/saxon/9.1.0.8/saxon-9.1.0.8.jar" enabled="true" runInBatchMode="false"/> |
|
84 |
<factorypathentry kind="VARJAR" id="M2_REPO/junit/junit/4.12/junit-4.12.jar" enabled="true" runInBatchMode="false"/> |
|
85 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19.jar" enabled="true" runInBatchMode="false"/> |
|
86 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/18.0/guava-18.0.jar" enabled="true" runInBatchMode="false"/> |
|
87 |
<factorypathentry kind="VARJAR" id="M2_REPO/net/sf/ehcache/ehcache-core/2.6.2/ehcache-core-2.6.2.jar" enabled="true" runInBatchMode="false"/> |
|
88 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/mycila/xmltool/3.3/xmltool-3.3.jar" enabled="true" runInBatchMode="false"/> |
|
89 |
<factorypathentry kind="VARJAR" id="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar" enabled="true" runInBatchMode="false"/> |
|
90 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context/4.3.4.RELEASE/spring-context-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
91 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-beans/4.3.4.RELEASE/spring-beans-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
92 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context-support/4.3.4.RELEASE/spring-context-support-4.3.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
93 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/gson/gson/2.7/gson-2.7.jar" enabled="true" runInBatchMode="false"/> |
|
94 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar" enabled="true" runInBatchMode="false"/> |
|
95 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpcore/4.4.5/httpcore-4.4.5.jar" enabled="true" runInBatchMode="false"/> |
|
96 |
<factorypathentry kind="VARJAR" id="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar" enabled="true" runInBatchMode="false"/> |
|
97 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-codec/commons-codec/1.10/commons-codec-1.10.jar" enabled="true" runInBatchMode="false"/> |
|
98 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/exist-db/exist-core/3.0.RC1/exist-core-3.0.RC1.jar" enabled="true" runInBatchMode="false"/> |
|
99 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.8.4/jackson-core-2.8.4.jar" enabled="true" runInBatchMode="false"/> |
|
100 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/krukow/clj-ds/0.0.4/clj-ds-0.0.4.jar" enabled="true" runInBatchMode="false"/> |
|
101 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/siemens/ct/exi/exificient/0.9.3/exificient-0.9.3.jar" enabled="true" runInBatchMode="false"/> |
|
102 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/exist-db/thirdparty/net/sf/sunxacml/sunxacml/1.2/sunxacml-1.2.jar" enabled="true" runInBatchMode="false"/> |
|
103 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/thaiopensource/jing/20091111/jing-20091111.jar" enabled="true" runInBatchMode="false"/> |
|
104 |
<factorypathentry kind="VARJAR" id="M2_REPO/isorelax/isorelax/20030108/isorelax-20030108.jar" enabled="true" runInBatchMode="false"/> |
|
105 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/gnu/gnu-crypto/2.0.1/gnu-crypto-2.0.1.jar" enabled="true" runInBatchMode="false"/> |
|
106 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/exist-db/thirdparty/javax/xml/xquery/xqjapi/1.0-fr/xqjapi-1.0-fr.jar" enabled="true" runInBatchMode="false"/> |
|
107 |
<factorypathentry kind="VARJAR" id="M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar" enabled="true" runInBatchMode="false"/> |
|
108 |
<factorypathentry kind="VARJAR" id="M2_REPO/cglib/cglib/2.2.2/cglib-2.2.2.jar" enabled="true" runInBatchMode="false"/> |
|
109 |
<factorypathentry kind="VARJAR" id="M2_REPO/excalibur-cli/excalibur-cli/1.0/excalibur-cli-1.0.jar" enabled="true" runInBatchMode="false"/> |
|
110 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-pool/commons-pool/1.6/commons-pool-1.6.jar" enabled="true" runInBatchMode="false"/> |
|
111 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.6.2/log4j-api-2.6.2.jar" enabled="true" runInBatchMode="false"/> |
|
112 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-core/2.6.2/log4j-core-2.6.2.jar" enabled="true" runInBatchMode="false"/> |
|
113 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-jul/2.3/log4j-jul-2.3.jar" enabled="true" runInBatchMode="false"/> |
|
114 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-slf4j-impl/2.6.2/log4j-slf4j-impl-2.6.2.jar" enabled="true" runInBatchMode="false"/> |
|
115 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/ant/ant/1.9.4/ant-1.9.4.jar" enabled="true" runInBatchMode="false"/> |
|
116 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.jar" enabled="true" runInBatchMode="false"/> |
|
117 |
<factorypathentry kind="VARJAR" id="M2_REPO/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar" enabled="true" runInBatchMode="false"/> |
|
118 |
<factorypathentry kind="VARJAR" id="M2_REPO/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar" enabled="true" runInBatchMode="false"/> |
|
119 |
<factorypathentry kind="VARJAR" id="M2_REPO/xalan/xalan/2.7.2/xalan-2.7.2.jar" enabled="true" runInBatchMode="false"/> |
|
120 |
<factorypathentry kind="VARJAR" id="M2_REPO/xalan/serializer/2.7.2/serializer-2.7.2.jar" enabled="true" runInBatchMode="false"/> |
|
121 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/xmlrpc/xmlrpc-common/3.1.3/xmlrpc-common-3.1.3.jar" enabled="true" runInBatchMode="false"/> |
|
122 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar" enabled="true" runInBatchMode="false"/> |
|
123 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/xmlrpc/xmlrpc-client/3.1.3/xmlrpc-client-3.1.3.jar" enabled="true" runInBatchMode="false"/> |
|
124 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/xmlrpc/xmlrpc-server/3.1.3/xmlrpc-server-3.1.3.jar" enabled="true" runInBatchMode="false"/> |
|
125 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/exist-db/thirdparty/org/expath/pkg-repo/0.6.0-patched/pkg-repo-0.6.0-patched.jar" enabled="true" runInBatchMode="false"/> |
|
126 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fifesoft/rsyntaxtextarea/2.5.6/rsyntaxtextarea-2.5.6.jar" enabled="true" runInBatchMode="false"/> |
|
127 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/exist-db/thirdparty/org/xmldb/xmldb-api/1.0-patched/xmldb-api-1.0-patched.jar" enabled="true" runInBatchMode="false"/> |
|
128 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/exist-db/exist-start/3.0.RC1/exist-start-3.0.RC1.jar" enabled="true" runInBatchMode="false"/> |
|
129 |
<factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/> |
|
130 |
</factorypath> |
modules/dnet-springboot-apps/trunk/dnet-is-application/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>dnet-is-application</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.wst.common.project.facet.core.builder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
<buildCommand> |
|
19 |
<name>org.eclipse.m2e.core.maven2Builder</name> |
|
20 |
<arguments> |
|
21 |
</arguments> |
|
22 |
</buildCommand> |
|
23 |
<buildCommand> |
|
24 |
<name>org.springframework.ide.eclipse.core.springbuilder</name> |
|
25 |
<arguments> |
|
26 |
</arguments> |
|
27 |
</buildCommand> |
|
28 |
</buildSpec> |
|
29 |
<natures> |
|
30 |
<nature>org.springframework.ide.eclipse.core.springnature</nature> |
|
31 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
32 |
<nature>org.eclipse.m2e.core.maven2Nature</nature> |
|
33 |
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> |
|
34 |
</natures> |
|
35 |
</projectDescription> |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/DnetInformationServiceException.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is; |
|
2 |
|
|
3 |
/** |
|
4 |
* Created by sandro on 3/16/16. |
|
5 |
*/ |
|
6 |
public class DnetInformationServiceException extends Exception { |
|
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
11 |
private static final long serialVersionUID = 1L; |
|
12 |
|
|
13 |
public DnetInformationServiceException() { |
|
14 |
super(); |
|
15 |
} |
|
16 |
|
|
17 |
public DnetInformationServiceException(final String message) { |
|
18 |
super(message); |
|
19 |
} |
|
20 |
|
|
21 |
public DnetInformationServiceException(final Throwable e) { |
|
22 |
super(e); |
|
23 |
} |
|
24 |
|
|
25 |
public DnetInformationServiceException(final String message, final Throwable cause) { |
|
26 |
super(message, cause); |
|
27 |
} |
|
28 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/tools/DatabaseUtils.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.tools; |
|
2 |
|
|
3 |
import org.apache.commons.lang3.StringUtils; |
|
4 |
import org.dom4j.Document; |
|
5 |
|
|
6 |
public class DatabaseUtils { |
|
7 |
|
|
8 |
private static final String ROOT_COLLECTION = "/db/DRIVER"; |
|
9 |
|
|
10 |
public static final String SCHEMAS_COLLECTION = ROOT_COLLECTION + "/schemas"; |
|
11 |
|
|
12 |
public static String getCollection(final Document doc) { |
|
13 |
return getCollection(doc.valueOf("/profile/kind").trim(), doc.valueOf("/profile/type").trim()); |
|
14 |
} |
|
15 |
|
|
16 |
public static String getCollection(final String kind, final String type) { |
|
17 |
return ROOT_COLLECTION + "/" + kind + "/" + type; |
|
18 |
} |
|
19 |
|
|
20 |
public static String getFileName(final String resId) { |
|
21 |
return StringUtils.substringAfterLast(resId, "/"); |
|
22 |
} |
|
23 |
|
|
24 |
public String getFileName(final Document doc) { |
|
25 |
return getFileName(doc.valueOf("/profile/id").trim()); |
|
26 |
} |
|
27 |
|
|
28 |
public static String composeResourceId(final String kind, final String type, final String fileName) { |
|
29 |
return kind + "/" + type + "/" + fileName; |
|
30 |
} |
|
31 |
|
|
32 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/tools/ProfileValidator.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.tools; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
|
|
5 |
import javax.xml.XMLConstants; |
|
6 |
import javax.xml.transform.stream.StreamSource; |
|
7 |
import javax.xml.validation.Schema; |
|
8 |
import javax.xml.validation.SchemaFactory; |
|
9 |
import javax.xml.validation.Validator; |
|
10 |
|
|
11 |
import org.apache.commons.lang3.StringUtils; |
|
12 |
import org.apache.commons.logging.Log; |
|
13 |
import org.apache.commons.logging.LogFactory; |
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
import org.springframework.stereotype.Component; |
|
16 |
import org.xml.sax.SAXException; |
|
17 |
|
|
18 |
import eu.dnetlib.enabling.is.DnetInformationServiceException; |
|
19 |
import eu.dnetlib.enabling.is.store.ISStore; |
|
20 |
|
|
21 |
@Component |
|
22 |
public class ProfileValidator { |
|
23 |
|
|
24 |
private static final Log log = LogFactory.getLog(ProfileValidator.class); |
|
25 |
|
|
26 |
@Autowired |
|
27 |
private ISStore isStore; |
|
28 |
|
|
29 |
public boolean isValid(final String type, final String profile) { |
|
30 |
|
|
31 |
final Schema schema = getSchema(type); |
|
32 |
|
|
33 |
if (schema == null) { return false; } |
|
34 |
|
|
35 |
final Validator validator = schema.newValidator(); |
|
36 |
|
|
37 |
try { |
|
38 |
// hack to workaround for #1500 |
|
39 |
validator.validate(new StreamSource(new StringReader(profile))); |
|
40 |
return true; |
|
41 |
} catch (final Throwable e) { |
|
42 |
log.warn("The profile is not valid"); |
|
43 |
return false; |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
private Schema getSchema(final String resourceType) { |
|
48 |
try { |
|
49 |
if (StringUtils.isBlank(resourceType)) { throw new DnetInformationServiceException("Invalid resourceType"); } |
|
50 |
|
|
51 |
final String schemaSource = isStore.getXML(resourceType, DatabaseUtils.SCHEMAS_COLLECTION); |
|
52 |
|
|
53 |
if ((schemaSource == null) || schemaSource.isEmpty()) { |
|
54 |
log.warn("cannot find resource type " + resourceType); |
|
55 |
return null; |
|
56 |
} |
|
57 |
return SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(new StreamSource(new StringReader(schemaSource))); |
|
58 |
} catch (final DnetInformationServiceException e) { |
|
59 |
log.warn("cannot find resource type " + resourceType, e); |
|
60 |
return null; |
|
61 |
} catch (final SAXException e) { |
|
62 |
log.fatal("cannot parse resource type schema " + resourceType, e); |
|
63 |
return null; |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/tools/BulkResourceImporter.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.tools; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
import java.util.Date; |
|
5 |
|
|
6 |
import org.apache.commons.io.FilenameUtils; |
|
7 |
import org.apache.commons.io.IOUtils; |
|
8 |
import org.apache.commons.logging.Log; |
|
9 |
import org.apache.commons.logging.LogFactory; |
|
10 |
import org.dom4j.Document; |
|
11 |
import org.dom4j.io.SAXReader; |
|
12 |
import org.springframework.beans.factory.annotation.Autowired; |
|
13 |
import org.springframework.context.ResourceLoaderAware; |
|
14 |
import org.springframework.core.io.Resource; |
|
15 |
import org.springframework.core.io.ResourceLoader; |
|
16 |
import org.springframework.core.io.support.ResourcePatternResolver; |
|
17 |
import org.springframework.core.io.support.ResourcePatternUtils; |
|
18 |
import org.springframework.stereotype.Component; |
|
19 |
|
|
20 |
import eu.dnetlib.enabling.is.DnetInformationServiceException; |
|
21 |
import eu.dnetlib.enabling.is.DnetInformationServiceProperties; |
|
22 |
import eu.dnetlib.enabling.is.store.ISStore; |
|
23 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
24 |
|
|
25 |
@Component |
|
26 |
public class BulkResourceImporter implements ResourceLoaderAware { |
|
27 |
|
|
28 |
static final Log log = LogFactory.getLog(BulkResourceImporter.class); |
|
29 |
|
|
30 |
private static boolean initialized = false; |
|
31 |
|
|
32 |
@Autowired |
|
33 |
private ProfileValidator profileValidator; |
|
34 |
|
|
35 |
@Autowired |
|
36 |
private ISStore isStore; |
|
37 |
|
|
38 |
@Autowired |
|
39 |
private DnetInformationServiceProperties props; |
|
40 |
|
|
41 |
private ResourceLoader resourceLoader; |
|
42 |
|
|
43 |
public void startImport() throws DnetInformationServiceException { |
|
44 |
if (isInitialized()) { return; } |
|
45 |
|
|
46 |
final ResourcePatternResolver resolver = ResourcePatternUtils.getResourcePatternResolver(getResourceLoader()); |
|
47 |
|
|
48 |
try { |
|
49 |
final long start = System.currentTimeMillis(); |
|
50 |
|
|
51 |
log.info("bulk import of profiles and schemas from " + props.getBootstrapPath()); |
|
52 |
for (final Resource res : resolver.getResources(props.getBootstrapPath() + "/**/*.xsd")) { |
|
53 |
registerSchema(res); |
|
54 |
} |
|
55 |
for (final Resource res : resolver.getResources(props.getBootstrapPath() + "/**/*.xml")) { |
|
56 |
registerProfile(res); |
|
57 |
} |
|
58 |
log.info("bulk registration finished in: " + ((System.currentTimeMillis() - start) / 1000) + "s"); |
|
59 |
} catch (final IOException e) { |
|
60 |
throw new DnetInformationServiceException(e); |
|
61 |
} finally { |
|
62 |
log.info("INITIALIZED"); |
|
63 |
setInitialized(true); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
private void registerSchema(final Resource res) throws DnetInformationServiceException { |
|
68 |
final String resourceType = FilenameUtils.getBaseName(res.getFilename()); |
|
69 |
try { |
|
70 |
isStore.insertXML(resourceType, DatabaseUtils.SCHEMAS_COLLECTION, IOUtils.toString(res.getInputStream())); |
|
71 |
log.info(" new schema imported: " + resourceType); |
|
72 |
} catch (final Throwable e) { |
|
73 |
log.error(" error importing schema " + res.getFilename(), e); |
|
74 |
throw new DnetInformationServiceException(e); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
private void registerProfile(final Resource res) throws DnetInformationServiceException { |
|
79 |
log.debug("registering profile"); |
|
80 |
|
|
81 |
try { |
|
82 |
final Document doc = (new SAXReader()).read(res.getInputStream()); |
|
83 |
|
|
84 |
final String id = doc.valueOf("/profile/id").trim(); |
|
85 |
final String kind = doc.valueOf("/profile/kind").trim(); |
|
86 |
final String type = doc.valueOf("/profile/type").trim(); |
|
87 |
|
|
88 |
final String coll = DatabaseUtils.getCollection(kind, type); |
|
89 |
final String fileName = DatabaseUtils.getFileName(id); |
|
90 |
final String date = new DateUtils(new Date()).getDateAsISO8601String(); |
|
91 |
|
|
92 |
doc.selectSingleNode("/profile/date").setText(date); |
|
93 |
|
|
94 |
final String finalDoc = doc.asXML(); |
|
95 |
|
|
96 |
if (!id.startsWith(kind + "/" + type + "/")) { |
|
97 |
throw new DnetInformationServiceException("Invalid profile ID: " + id); |
|
98 |
} else if (!profileValidator.isValid(type, finalDoc)) { |
|
99 |
throw new DnetInformationServiceException("Invalid profile"); |
|
100 |
} else { |
|
101 |
isStore.insertXML(fileName, coll, finalDoc); |
|
102 |
} |
|
103 |
|
|
104 |
log.info(" new profile imported: " + id); |
|
105 |
} catch (final Throwable e) { |
|
106 |
log.error(" error importing profile " + res.getFilename()); |
|
107 |
throw new DnetInformationServiceException(e); |
|
108 |
} |
|
109 |
} |
|
110 |
|
|
111 |
public boolean isInitialized() { |
|
112 |
return initialized; |
|
113 |
} |
|
114 |
|
|
115 |
public void setInitialized(final boolean initialized) { |
|
116 |
BulkResourceImporter.initialized = initialized; |
|
117 |
} |
|
118 |
|
|
119 |
public ResourceLoader getResourceLoader() { |
|
120 |
return resourceLoader; |
|
121 |
} |
|
122 |
|
|
123 |
@Override |
|
124 |
public void setResourceLoader(final ResourceLoader resourceLoader) { |
|
125 |
this.resourceLoader = resourceLoader; |
|
126 |
} |
|
127 |
|
|
128 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/controller/InformationServiceController.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.controller; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.util.Date; |
|
5 |
import java.util.List; |
|
6 |
import java.util.UUID; |
|
7 |
|
|
8 |
import org.apache.commons.lang3.StringUtils; |
|
9 |
import org.apache.commons.logging.Log; |
|
10 |
import org.apache.commons.logging.LogFactory; |
|
11 |
import org.dom4j.Document; |
|
12 |
import org.dom4j.DocumentException; |
|
13 |
import org.dom4j.io.SAXReader; |
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
import org.springframework.http.MediaType; |
|
16 |
import org.springframework.web.bind.annotation.PathVariable; |
|
17 |
import org.springframework.web.bind.annotation.RequestBody; |
|
18 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
19 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
20 |
import org.springframework.web.bind.annotation.RequestParam; |
|
21 |
import org.springframework.web.bind.annotation.RestController; |
|
22 |
|
|
23 |
import eu.dnetlib.enabling.annotations.DnetService; |
|
24 |
import eu.dnetlib.enabling.annotations.DnetServiceType; |
|
25 |
import eu.dnetlib.enabling.is.DnetInformationServiceException; |
|
26 |
import eu.dnetlib.enabling.is.store.ISStore; |
|
27 |
import eu.dnetlib.enabling.is.tools.DatabaseUtils; |
|
28 |
import eu.dnetlib.enabling.is.tools.ProfileValidator; |
|
29 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
30 |
import eu.dnetlib.services.BaseService; |
|
31 |
|
|
32 |
@RestController |
|
33 |
@RequestMapping("/is") |
|
34 |
@DnetService(DnetServiceType.is) |
|
35 |
public class InformationServiceController extends BaseService { |
|
36 |
|
|
37 |
private static final Log log = LogFactory.getLog(InformationServiceController.class); |
|
38 |
|
|
39 |
@Autowired |
|
40 |
private ISStore isStore; |
|
41 |
|
|
42 |
@Autowired |
|
43 |
private ProfileValidator profileValidator; |
|
44 |
|
|
45 |
@RequestMapping(value = "schema/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE) |
|
46 |
public String getSchema(@PathVariable("name") final String resourceType) throws DnetInformationServiceException { |
|
47 |
if (StringUtils.isBlank(resourceType)) { throw new DnetInformationServiceException("Invalid resourceType"); } |
|
48 |
|
|
49 |
return isStore.getXML(resourceType, DatabaseUtils.SCHEMAS_COLLECTION); |
|
50 |
} |
|
51 |
|
|
52 |
@RequestMapping("schemas") |
|
53 |
public List<String> listSchemas() throws DnetInformationServiceException { |
|
54 |
return isStore.getFileNames(DatabaseUtils.SCHEMAS_COLLECTION); |
|
55 |
} |
|
56 |
|
|
57 |
@RequestMapping(value = "schema/{name}", method = RequestMethod.POST) |
|
58 |
public boolean registerSchema(@PathVariable("name") final String resourceType, @RequestBody final String resourceSchema) |
|
59 |
throws DnetInformationServiceException { |
|
60 |
return isStore.insertXML(resourceType, DatabaseUtils.SCHEMAS_COLLECTION, resourceSchema); |
|
61 |
} |
|
62 |
|
|
63 |
@RequestMapping(value = "schema/{name}", method = RequestMethod.DELETE) |
|
64 |
public boolean deleteSchema(@PathVariable("name") final String resourceType) throws DnetInformationServiceException { |
|
65 |
return isStore.deleteXML(resourceType, DatabaseUtils.SCHEMAS_COLLECTION); |
|
66 |
} |
|
67 |
|
|
68 |
@RequestMapping("profiles/{kind}/{type}") |
|
69 |
public List<String> listProfiles(@PathVariable("kind") final String kind, @PathVariable("type") final String type) throws DnetInformationServiceException { |
|
70 |
return isStore.getFileNames(DatabaseUtils.getCollection(kind, type)); |
|
71 |
} |
|
72 |
|
|
73 |
@RequestMapping(value = "profile", method = RequestMethod.POST) |
|
74 |
public String registerProfile(@RequestBody final String profile) throws DnetInformationServiceException { |
|
75 |
log.debug("registering profile"); |
|
76 |
|
|
77 |
try { |
|
78 |
|
|
79 |
final Document doc = (new SAXReader()).read(new StringReader(profile)); |
|
80 |
|
|
81 |
final String kind = doc.valueOf("/profile/kind").trim(); |
|
82 |
final String type = doc.valueOf("/profile/type").trim(); |
|
83 |
final String fileName = UUID.randomUUID().toString(); |
|
84 |
|
|
85 |
final String newId = DatabaseUtils.composeResourceId(kind, type, fileName); |
|
86 |
final String date = new DateUtils(new Date()).getDateAsISO8601String(); |
|
87 |
|
|
88 |
doc.selectSingleNode("/profile/id").setText(newId); |
|
89 |
doc.selectSingleNode("/profile/date").setText(date); |
|
90 |
|
|
91 |
final String finalDoc = doc.asXML(); |
|
92 |
|
|
93 |
if (profileValidator.isValid(type, finalDoc)) { |
|
94 |
isStore.insertXML(fileName, DatabaseUtils.getCollection(kind, type), finalDoc); |
|
95 |
return newId; |
|
96 |
} else { |
|
97 |
throw new DnetInformationServiceException("Invalid profile"); |
|
98 |
} |
|
99 |
} catch (final DocumentException e) { |
|
100 |
throw new DnetInformationServiceException(e); |
|
101 |
} |
|
102 |
} |
|
103 |
|
|
104 |
@RequestMapping(value = "profile/{kind}/{type}/{fileName}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE) |
|
105 |
public String getProfile(@PathVariable("kind") final String kind, @PathVariable("type") final String type, @PathVariable("fileName") final String fileName) |
|
106 |
throws DnetInformationServiceException { |
|
107 |
|
|
108 |
final String res = isStore.getXML(fileName, DatabaseUtils.getCollection(kind, type)); |
|
109 |
|
|
110 |
if (StringUtils.isBlank(res)) { |
|
111 |
throw new DnetInformationServiceException("document " + DatabaseUtils.composeResourceId(kind, type, fileName) + " not found"); |
|
112 |
} else { |
|
113 |
return res; |
|
114 |
} |
|
115 |
|
|
116 |
} |
|
117 |
|
|
118 |
@RequestMapping(value = "profile/{kind}/{type}/{fileName}", method = RequestMethod.POST) |
|
119 |
public boolean updateProfile(@PathVariable("kind") final String kind, |
|
120 |
@PathVariable("type") final String type, |
|
121 |
@PathVariable("fileName") final String fileName, |
|
122 |
@RequestBody final String profile) throws DnetInformationServiceException { |
|
123 |
try { |
|
124 |
final String resId = DatabaseUtils.composeResourceId(kind, type, fileName); |
|
125 |
|
|
126 |
final String coll = DatabaseUtils.getCollection(kind, type); |
|
127 |
|
|
128 |
final String oldProfileSrc = isStore.getXML(fileName, coll); |
|
129 |
|
|
130 |
if (oldProfileSrc == null) { throw new DnetInformationServiceException("cannot update a non existing profile " + resId); } |
|
131 |
|
|
132 |
final Document doc = (new SAXReader()).read(new StringReader(profile)); |
|
133 |
|
|
134 |
final String date = new DateUtils(new Date()).getDateAsISO8601String(); |
|
135 |
|
|
136 |
doc.selectSingleNode("/profile/id").setText(resId); |
|
137 |
doc.selectSingleNode("/profile/date").setText(date); |
|
138 |
|
|
139 |
final String finalDoc = doc.asXML(); |
|
140 |
|
|
141 |
if (profileValidator.isValid(type, finalDoc)) { |
|
142 |
isStore.insertXML(fileName, coll, finalDoc); |
|
143 |
return true; |
|
144 |
} else { |
|
145 |
throw new DnetInformationServiceException("Invalid profile"); |
|
146 |
} |
|
147 |
} catch (final DocumentException e) { |
|
148 |
throw new DnetInformationServiceException(e); |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
@RequestMapping(value = "profile/{kind}/{type}/{fileName}", method = RequestMethod.DELETE) |
|
153 |
public boolean deleteProfile(@PathVariable("kind") final String kind, |
|
154 |
@PathVariable("type") final String type, |
|
155 |
@PathVariable("fileName") final String fileName) throws DnetInformationServiceException { |
|
156 |
|
|
157 |
final boolean res = isStore.deleteXML(fileName, DatabaseUtils.getCollection(kind, type)); |
|
158 |
|
|
159 |
if (!res) { throw new DnetInformationServiceException("document " + DatabaseUtils.composeResourceId(kind, type, fileName) + " not found"); } |
|
160 |
|
|
161 |
return true; |
|
162 |
} |
|
163 |
|
|
164 |
@RequestMapping("xupdate") |
|
165 |
public boolean executeXUpdate(@RequestParam("q") final String xquery) throws DnetInformationServiceException { |
|
166 |
return isStore.executeXUpdate(xquery); |
|
167 |
} |
|
168 |
|
|
169 |
@RequestMapping("find") |
|
170 |
public List<String> find(@RequestParam("q") final String xquery) throws DnetInformationServiceException { |
|
171 |
return isStore.quickSearchXML(xquery); |
|
172 |
} |
|
173 |
|
|
174 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/DnetInformationServiceApplication.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is; |
|
2 |
|
|
3 |
import org.springframework.boot.SpringApplication; |
|
4 |
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
5 |
import org.springframework.context.annotation.ComponentScan; |
|
6 |
import org.springframework.scheduling.annotation.EnableScheduling; |
|
7 |
|
|
8 |
@SpringBootApplication |
|
9 |
@ComponentScan("eu.dnetlib") |
|
10 |
@EnableScheduling |
|
11 |
public class DnetInformationServiceApplication { |
|
12 |
|
|
13 |
public static void main(final String[] args) { |
|
14 |
SpringApplication.run(DnetInformationServiceApplication.class, args); |
|
15 |
} |
|
16 |
|
|
17 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/DnetInformationServiceConfiguration.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is; |
|
2 |
|
|
3 |
import org.springframework.context.annotation.Configuration; |
|
4 |
|
|
5 |
@Configuration |
|
6 |
public class DnetInformationServiceConfiguration { |
|
7 |
|
|
8 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/store/database/ExistDatabase.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.store.database; // NOPMD |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.FileOutputStream; |
|
5 |
import java.io.FileWriter; |
|
6 |
import java.io.IOException; |
|
7 |
import java.io.InputStream; |
|
8 |
import java.text.SimpleDateFormat; |
|
9 |
import java.util.ArrayList; |
|
10 |
import java.util.Arrays; |
|
11 |
import java.util.Date; |
|
12 |
import java.util.Iterator; |
|
13 |
import java.util.List; |
|
14 |
import java.util.concurrent.locks.Lock; |
|
15 |
import java.util.concurrent.locks.ReentrantReadWriteLock; |
|
16 |
import java.util.zip.ZipEntry; |
|
17 |
import java.util.zip.ZipOutputStream; |
|
18 |
|
|
19 |
import org.apache.commons.io.IOUtils; |
|
20 |
import org.apache.commons.logging.Log; |
|
21 |
import org.apache.commons.logging.LogFactory; |
|
22 |
import org.exist.util.DatabaseConfigurationException; |
|
23 |
import org.exist.xmldb.DatabaseImpl; |
|
24 |
import org.exist.xmldb.DatabaseInstanceManager; |
|
25 |
import org.exist.xmldb.EXistResource; |
|
26 |
import org.exist.xmldb.XmldbURI; |
|
27 |
import org.springframework.beans.factory.annotation.Autowired; |
|
28 |
import org.springframework.context.SmartLifecycle; |
|
29 |
import org.xmldb.api.DatabaseManager; |
|
30 |
import org.xmldb.api.base.Collection; |
|
31 |
import org.xmldb.api.base.Database; |
|
32 |
import org.xmldb.api.base.Resource; |
|
33 |
import org.xmldb.api.base.ResourceIterator; |
|
34 |
import org.xmldb.api.base.ResourceSet; |
|
35 |
import org.xmldb.api.base.XMLDBException; |
|
36 |
import org.xmldb.api.modules.CollectionManagementService; |
|
37 |
import org.xmldb.api.modules.XPathQueryService; |
|
38 |
|
|
39 |
import eu.dnetlib.enabling.is.DnetInformationServiceException; |
|
40 |
import eu.dnetlib.enabling.is.DnetInformationServiceProperties; |
|
41 |
import eu.dnetlib.enabling.is.tools.BulkResourceImporter; |
|
42 |
import eu.dnetlib.exceptions.DnetGenericRuntimeException; |
|
43 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
44 |
|
|
45 |
/** |
|
46 |
* eXist database wrapper. |
|
47 |
* |
|
48 |
* @author marko |
|
49 |
* |
|
50 |
*/ |
|
51 |
public abstract class ExistDatabase implements XMLDatabase, SmartLifecycle { // NOPMD by marko |
|
52 |
|
|
53 |
private static final Log log = LogFactory.getLog(ExistDatabase.class); // NOPMD |
|
54 |
|
|
55 |
private static final String XML_RESOURCE = "XMLResource"; |
|
56 |
private static final String CONFIG_TEMPLATE_FILE = "default-exist-conf.xml"; |
|
57 |
|
|
58 |
private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); |
|
59 |
private final Lock readLock = rwl.readLock(); |
|
60 |
private final Lock writeLock = rwl.writeLock(); |
|
61 |
|
|
62 |
private Database database; |
|
63 |
|
|
64 |
private Collection root; |
|
65 |
|
|
66 |
private DatabaseInstanceManager manager; |
|
67 |
|
|
68 |
private XPathQueryService queryService; |
|
69 |
|
|
70 |
private CollectionManagementService colman; |
|
71 |
|
|
72 |
@Autowired |
|
73 |
private BulkResourceImporter bulkImporter; |
|
74 |
|
|
75 |
@Autowired |
|
76 |
private DnetInformationServiceProperties props; |
|
77 |
|
|
78 |
private transient File dbDirectory; |
|
79 |
|
|
80 |
private File existConfigFile; |
|
81 |
|
|
82 |
private boolean running = false; |
|
83 |
|
|
84 |
@Override |
|
85 |
public void start() { |
|
86 |
log.info("starting database"); |
|
87 |
|
|
88 |
try { |
|
89 |
dbDirectory = getDatabaseDirectory(); |
|
90 |
|
|
91 |
if (dbDirectory.exists()) { |
|
92 |
existConfigFile = new File(dbDirectory, "conf.xml"); |
|
93 |
bulkImporter.setInitialized(true); |
|
94 |
} else { |
|
95 |
createDatabase(); |
|
96 |
} |
|
97 |
|
|
98 |
if (getDatabase() == null) { |
|
99 |
setDatabase(new DatabaseImpl()); |
|
100 |
getDatabase().setProperty("configuration", existConfigFile.getAbsolutePath()); |
|
101 |
getDatabase().setProperty("create-database", "true"); |
|
102 |
} |
|
103 |
|
|
104 |
DatabaseManager.registerDatabase(getDatabase()); |
|
105 |
|
|
106 |
setRoot(DatabaseManager.getCollection("xmldb:exist://" + getRootCollection(), "admin", "")); |
|
107 |
setManager((DatabaseInstanceManager) getRoot().getService("DatabaseInstanceManager", "1.0")); |
|
108 |
setQueryService((XPathQueryService) getRoot().getService("XPathQueryService", "1.0")); |
|
109 |
setColman((CollectionManagementService) getRoot().getService("CollectionManagementService", "1.0")); |
|
110 |
|
|
111 |
if (!bulkImporter.isInitialized()) { |
|
112 |
bulkImporter.startImport(); |
|
113 |
} |
|
114 |
|
|
115 |
} catch (final XMLDBException | DnetInformationServiceException e) { |
|
116 |
throw new DnetGenericRuntimeException("cannot open eXist database", e); |
|
117 |
} |
|
118 |
|
|
119 |
running = true; |
|
120 |
} |
|
121 |
|
|
122 |
@Override |
|
123 |
public void stop() { |
|
124 |
log.info("shutting down xmldb..."); |
|
125 |
running = false; |
|
126 |
try { |
|
127 |
getManager().shutdown(); |
|
128 |
DatabaseManager.deregisterDatabase(database); |
|
129 |
log.info("...xmldb closed"); |
|
130 |
} catch (final XMLDBException e) { |
|
131 |
log.fatal("...cannot close database", e); |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
@Override |
|
136 |
public int getPhase() { |
|
137 |
return Integer.MAX_VALUE; |
|
138 |
} |
|
139 |
|
|
140 |
@Override |
|
141 |
public final boolean isAutoStartup() { |
|
142 |
return true; |
|
143 |
} |
|
144 |
|
|
145 |
@Override |
|
146 |
public final void stop(final Runnable callback) { |
|
147 |
callback.run(); |
|
148 |
} |
|
149 |
|
|
150 |
abstract protected File getDatabaseDirectory(); |
|
151 |
|
|
152 |
protected Collection getCollection(final String collection) throws XMLDBException { |
|
153 |
readLock.lock(); |
|
154 |
try { |
|
155 |
if (!collection.startsWith("/db")) { throw new XMLDBException(0, "collection path should begin with /db"); } |
|
156 |
return database.getCollection("exist://" + collection, "admin", ""); |
|
157 |
} finally { |
|
158 |
readLock.unlock(); |
|
159 |
} |
|
160 |
} |
|
161 |
|
|
162 |
protected void createDatabase() { |
|
163 |
log.debug("creating database in " + dbDirectory.getAbsolutePath()); |
|
164 |
try { |
|
165 |
new File(dbDirectory, "data").mkdirs(); |
|
166 |
|
|
167 |
final InputStream defaultConf = getClass().getResourceAsStream(CONFIG_TEMPLATE_FILE); |
|
168 |
if (defaultConf == null) { throw new IOException("cannot find " + CONFIG_TEMPLATE_FILE); } |
|
169 |
|
|
170 |
existConfigFile = new File(dbDirectory, "conf.xml"); |
|
171 |
final FileOutputStream confOutput = new FileOutputStream(existConfigFile); |
|
172 |
|
|
173 |
try { |
|
174 |
IOUtils.copy(defaultConf, confOutput); |
|
175 |
} finally { |
|
176 |
confOutput.close(); |
|
177 |
} |
|
178 |
} catch (final IOException e) { |
|
179 |
log.fatal("Error creating database dir", e); |
|
180 |
throw new DnetGenericRuntimeException(e); |
|
181 |
} |
|
182 |
log.debug("database created"); |
|
183 |
} |
|
184 |
|
|
185 |
@Override |
|
186 |
public void create(final String name, final String collection, final String content) throws XMLDBException { |
|
187 |
writeLock.lock(); |
|
188 |
try { |
|
189 |
if ("".equals(name)) { throw new XMLDBException(0, "cannot create a xml file with an empty file name"); } |
|
190 |
|
|
191 |
Collection col = getCollection(collection); |
|
192 |
|
|
193 |
if (col == null) { |
|
194 |
// create parent collections |
|
195 |
createCollection(collection, true); |
|
196 |
col = getCollection(collection); |
|
197 |
} |
|
198 |
|
|
199 |
final Resource res = col.createResource(name, XML_RESOURCE); |
|
200 |
res.setContent(content); |
|
201 |
col.storeResource(res); |
|
202 |
|
|
203 |
((EXistResource) res).freeResources(); |
|
204 |
col.close(); |
|
205 |
} finally { |
|
206 |
writeLock.unlock(); |
|
207 |
} |
|
208 |
} |
|
209 |
|
|
210 |
@Override |
|
211 |
public boolean remove(final String name, final String collection) throws XMLDBException { |
|
212 |
writeLock.lock(); |
|
213 |
try { |
|
214 |
final Collection col = getCollection(collection); |
|
215 |
|
|
216 |
final Resource res = col.getResource(name); |
|
217 |
if (res == null) { return false; } |
|
218 |
|
|
219 |
col.removeResource(res); |
|
220 |
col.close(); |
|
221 |
return true; |
|
222 |
} finally { |
|
223 |
writeLock.unlock(); |
|
224 |
} |
|
225 |
} |
|
226 |
|
|
227 |
@Override |
|
228 |
public void update(final String name, final String collection, final String content) throws XMLDBException { |
|
229 |
writeLock.lock(); |
|
230 |
try { |
|
231 |
final Collection col = getCollection(collection); |
|
232 |
|
|
233 |
final Resource res = col.getResource(name); |
|
234 |
if (res == null) { throw new XMLDBException(0, "resource doesn't exist"); } |
|
235 |
res.setContent(content); |
|
236 |
col.storeResource(res); |
|
237 |
((EXistResource) res).freeResources(); |
|
238 |
col.close(); |
|
239 |
} finally { |
|
240 |
writeLock.unlock(); |
|
241 |
} |
|
242 |
|
|
243 |
} |
|
244 |
|
|
245 |
@Override |
|
246 |
public String read(final String name, final String collection) throws XMLDBException { |
|
247 |
readLock.lock(); |
|
248 |
try { |
|
249 |
Resource res = null; |
|
250 |
final Collection coll = getCollection(collection); |
|
251 |
try { |
|
252 |
if (coll == null) { return null; } |
|
253 |
res = coll.getResource(name); |
|
254 |
if (res != null) { return (String) res.getContent(); } |
|
255 |
return null; |
|
256 |
} finally { |
|
257 |
if (res != null) { |
|
258 |
((EXistResource) res).freeResources(); |
|
259 |
} |
|
260 |
coll.close(); |
|
261 |
} |
|
262 |
} finally { |
|
263 |
readLock.unlock(); |
|
264 |
} |
|
265 |
} |
|
266 |
|
|
267 |
@Override |
|
268 |
public Iterator<String> xquery(final String query) throws XMLDBException { |
|
269 |
readLock.lock(); |
|
270 |
try { |
|
271 |
final ResourceSet result = getQueryService().query(query); |
|
272 |
if (result == null) { return null; } |
|
273 |
final ResourceIterator iterator = result.getIterator(); |
|
274 |
return new Iterator<String>() { |
|
275 |
|
|
276 |
@Override |
|
277 |
public boolean hasNext() { |
|
278 |
try { |
|
279 |
return iterator.hasMoreResources(); |
|
280 |
} catch (final XMLDBException e) { |
|
281 |
throw new RuntimeException("Error while getting next element", e); |
|
282 |
} |
|
283 |
} |
|
284 |
|
|
285 |
@Override |
|
286 |
public String next() { |
|
287 |
Resource res = null; |
|
288 |
try { |
|
289 |
res = iterator.nextResource(); |
|
290 |
return (String) res.getContent(); |
|
291 |
} catch (final XMLDBException e) { |
|
292 |
throw new RuntimeException("Error while getting next element", e); |
|
293 |
} finally { |
|
294 |
if (res != null) { |
|
295 |
try { |
|
296 |
((EXistResource) res).freeResources(); |
|
297 |
} catch (final XMLDBException e) { |
|
298 |
log.error("error on free resource"); |
|
299 |
} |
|
300 |
} |
|
301 |
} |
|
302 |
} |
|
303 |
}; |
|
304 |
} finally { |
|
305 |
readLock.unlock(); |
|
306 |
} |
|
307 |
} |
|
308 |
|
|
309 |
@Override |
|
310 |
public void xupdate(final String query) throws XMLDBException { |
|
311 |
writeLock.lock(); |
|
312 |
try { |
|
313 |
getQueryService().query(query); |
|
314 |
} finally { |
|
315 |
writeLock.unlock(); |
|
316 |
} |
|
317 |
|
|
318 |
} |
|
319 |
|
|
320 |
@Override |
|
321 |
public boolean collectionExists(final String collection) throws XMLDBException { |
|
322 |
Collection col = null; |
|
323 |
try { |
|
324 |
col = getCollection(collection); |
|
325 |
return col != null; |
|
326 |
} finally { |
|
327 |
if (col != null) { |
|
328 |
col.close(); |
|
329 |
} |
|
330 |
} |
|
331 |
|
|
332 |
} |
|
333 |
|
|
334 |
@Override |
|
335 |
public void createCollection(final String collection) throws XMLDBException { |
|
336 |
writeLock.lock(); |
|
337 |
try { |
|
338 |
createCollection(collection, false); |
|
339 |
} finally { |
|
340 |
writeLock.unlock(); |
|
341 |
} |
|
342 |
} |
|
343 |
|
|
344 |
private void createCollection(final String collection, final boolean recursive) throws XMLDBException { |
|
345 |
if (recursive) { |
|
346 |
final XmldbURI uri = XmldbURI.create(collection).removeLastSegment(); |
|
347 |
if (!collectionExists(uri.toString())) { |
|
348 |
createCollection(uri.toString(), true); |
|
349 |
} |
|
350 |
} |
|
351 |
getColman().createCollection(collection); |
|
352 |
} |
|
353 |
|
|
354 |
@Override |
|
355 |
public void removeCollection(final String collection) throws XMLDBException { |
|
356 |
writeLock.lock(); |
|
357 |
try { |
|
358 |
getColman().removeCollection(collection); |
|
359 |
} finally { |
|
360 |
writeLock.unlock(); |
|
361 |
} |
|
362 |
} |
|
363 |
|
|
364 |
@Override |
|
365 |
public boolean isRunning() { |
|
366 |
return running; |
|
367 |
} |
|
368 |
|
|
369 |
protected Database getDatabase() { |
|
370 |
return database; |
|
371 |
} |
|
372 |
|
|
373 |
protected void setDatabase(final Database database) { |
|
374 |
this.database = database; |
|
375 |
} |
|
376 |
|
|
377 |
protected Collection getRoot() { |
|
378 |
return root; |
|
379 |
} |
|
380 |
|
|
381 |
protected void setRoot(final Collection root) { |
|
382 |
this.root = root; |
|
383 |
} |
|
384 |
|
|
385 |
protected DatabaseInstanceManager getManager() { |
|
386 |
return manager; |
|
387 |
} |
|
388 |
|
|
389 |
protected void setManager(final DatabaseInstanceManager manager) { |
|
390 |
this.manager = manager; |
|
391 |
} |
|
392 |
|
|
393 |
protected XPathQueryService getQueryService() { |
|
394 |
return queryService; |
|
395 |
} |
|
396 |
|
|
397 |
protected void setQueryService(final XPathQueryService queryService) { |
|
398 |
this.queryService = queryService; |
|
399 |
} |
|
400 |
|
|
401 |
protected CollectionManagementService getColman() { |
|
402 |
return colman; |
|
403 |
} |
|
404 |
|
|
405 |
protected void setColman(final CollectionManagementService colman) { |
|
406 |
this.colman = colman; |
|
407 |
} |
|
408 |
|
|
409 |
@Override |
|
410 |
public String getRootCollection() { |
|
411 |
return "/db"; |
|
412 |
} |
|
413 |
|
|
414 |
@Override |
|
415 |
public List<String> listChildCollections(final String collection) throws XMLDBException { |
|
416 |
readLock.lock(); |
|
417 |
try { |
|
418 |
final Collection col = getCollection(collection); |
|
419 |
if (col == null) { return new ArrayList<>(); } |
|
420 |
return Arrays.asList(col.listChildCollections()); |
|
421 |
} finally { |
|
422 |
readLock.unlock(); |
|
423 |
} |
|
424 |
} |
|
425 |
|
|
426 |
/** |
|
427 |
* {@inheritDoc} |
|
428 |
* |
|
429 |
* @see eu.dnetlib.enabling.is.store.database.XMLDatabase#list(java.lang.String) |
|
430 |
*/ |
|
431 |
@Override |
|
432 |
public List<String> list(final String collection) throws XMLDBException { |
|
433 |
readLock.lock(); |
|
434 |
try { |
|
435 |
final Collection col = getCollection(collection); |
|
436 |
if (col == null) { return new ArrayList<>(); } |
|
437 |
return Arrays.asList(col.listResources()); |
|
438 |
} finally { |
|
439 |
readLock.unlock(); |
|
440 |
} |
|
441 |
} |
|
442 |
|
|
443 |
@Override |
|
444 |
public String backup() throws XMLDBException, DatabaseConfigurationException { |
|
445 |
log.info("Starting backup..."); |
|
446 |
readLock.lock(); |
|
447 |
try { |
|
448 |
final String backupDir = getBackupDir(); |
|
449 |
|
|
450 |
verifyBackupDir(); |
|
451 |
|
|
452 |
final String seq = (new SimpleDateFormat("yyyyMMdd-HHmm")).format(new Date()); |
|
453 |
|
|
454 |
final ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(backupDir + "/data-" + seq + ".zip")); |
|
455 |
|
|
456 |
final FileWriter logFile = new FileWriter(backupDir + "/report-" + seq + ".log"); |
|
457 |
logFile.write("Backup started at: " + DateUtils.now_ISO8601() + "\n\n"); |
|
458 |
|
|
459 |
backup(getRoot().getName(), zip, logFile); |
|
460 |
|
|
461 |
logFile.write("\nBackup finished at: " + DateUtils.now_ISO8601() + "\n"); |
|
462 |
|
|
463 |
logFile.flush(); |
|
464 |
logFile.close(); |
|
465 |
|
|
466 |
zip.flush(); |
|
467 |
zip.close(); |
|
468 |
|
|
469 |
log.info("Backup finished"); |
|
470 |
return backupDir; |
|
471 |
} catch (final Exception e) { |
|
472 |
log.error("Backup failed", e); |
|
473 |
throw new XMLDBException(0, "cannot backup", e); |
|
474 |
} finally { |
|
475 |
readLock.unlock(); |
|
476 |
} |
|
477 |
} |
|
478 |
|
|
479 |
private void verifyBackupDir() { |
|
480 |
final File d = new File(props.getBackupDir()); |
|
481 |
if (!d.exists()) { |
|
482 |
d.mkdirs(); |
|
483 |
} |
|
484 |
} |
|
485 |
|
|
486 |
private void backup(final String coll, final ZipOutputStream zip, final FileWriter logFile) throws XMLDBException, IOException { |
|
487 |
readLock.lock(); |
|
488 |
logFile.write("COLLECTION: " + coll + "\n"); |
|
489 |
log.info("Backup of collection " + coll); |
|
490 |
try { |
|
491 |
for (final String file : list(coll)) { |
|
492 |
zip.putNextEntry(new ZipEntry(coll + "/" + file + ".xml")); |
|
493 |
final Resource resource = getCollection(coll).getResource(file); |
|
494 |
zip.write(resource.getContent().toString().getBytes()); |
|
495 |
zip.closeEntry(); |
|
496 |
} |
|
497 |
|
|
498 |
for (final String c : listChildCollections(coll)) { |
|
499 |
backup(coll + "/" + c, zip, logFile); |
|
500 |
} |
|
501 |
} finally { |
|
502 |
readLock.unlock(); |
|
503 |
} |
|
504 |
|
|
505 |
} |
|
506 |
|
|
507 |
public File getDbDirectory() { |
|
508 |
return dbDirectory; |
|
509 |
} |
|
510 |
|
|
511 |
public void setDbDirectory(final File dbDirectory) { |
|
512 |
this.dbDirectory = dbDirectory; |
|
513 |
} |
|
514 |
|
|
515 |
public File getExistConfigFile() { |
|
516 |
return existConfigFile; |
|
517 |
} |
|
518 |
|
|
519 |
public void setExistConfigFile(final File existConfigFile) { |
|
520 |
this.existConfigFile = existConfigFile; |
|
521 |
} |
|
522 |
|
|
523 |
@Override |
|
524 |
public String getBackupDir() { |
|
525 |
return props.getBackupDir(); |
|
526 |
} |
|
527 |
|
|
528 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/store/database/PersistentExistDatabase.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.store.database; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.springframework.beans.factory.annotation.Autowired; |
|
6 |
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
7 |
import org.springframework.stereotype.Component; |
|
8 |
|
|
9 |
import eu.dnetlib.enabling.is.DnetInformationServiceProperties; |
|
10 |
|
|
11 |
@Component |
|
12 |
@ConditionalOnProperty(name = "is.database.persistent", havingValue = "true") |
|
13 |
public class PersistentExistDatabase extends ExistDatabase { |
|
14 |
|
|
15 |
// private static final Log log = LogFactory.getLog(PersistentExistDatabase.class); // NOPMD |
|
16 |
|
|
17 |
@Autowired |
|
18 |
private DnetInformationServiceProperties props; |
|
19 |
|
|
20 |
@Override |
|
21 |
protected File getDatabaseDirectory() { |
|
22 |
return new File(props.getBaseDir()); |
|
23 |
} |
|
24 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/store/database/TemporaryExistDatabase.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.store.database; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
|
|
6 |
import org.apache.commons.io.FileUtils; |
|
7 |
import org.apache.commons.logging.Log; |
|
8 |
import org.apache.commons.logging.LogFactory; |
|
9 |
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
10 |
import org.springframework.stereotype.Component; |
|
11 |
|
|
12 |
import eu.dnetlib.exceptions.DnetGenericRuntimeException; |
|
13 |
|
|
14 |
@Component |
|
15 |
@ConditionalOnProperty(name = "is.database.persistent", havingValue = "false") |
|
16 |
public class TemporaryExistDatabase extends ExistDatabase { |
|
17 |
|
|
18 |
private static final Log log = LogFactory.getLog(TemporaryExistDatabase.class); |
|
19 |
|
|
20 |
private File tempDir = null; |
|
21 |
|
|
22 |
@Override |
|
23 |
public void stop() { |
|
24 |
super.stop(); |
|
25 |
try { |
|
26 |
FileUtils.deleteDirectory(tempDir); |
|
27 |
} catch (final IOException e) { |
|
28 |
log.fatal("cannot delete temporary exist directory", e); |
|
29 |
} |
|
30 |
} |
|
31 |
|
|
32 |
@Override |
|
33 |
protected File getDatabaseDirectory() { |
|
34 |
try { |
|
35 |
if (tempDir == null) { |
|
36 |
final File tmpName = File.createTempFile("exist", ""); |
|
37 |
tmpName.delete(); |
|
38 |
tempDir = new File(tmpName.getAbsolutePath()); |
|
39 |
} |
|
40 |
return tempDir; |
|
41 |
} catch (final IOException e) { |
|
42 |
log.fatal("cannot create temporary exist directory", e); |
|
43 |
throw new DnetGenericRuntimeException(e); |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/store/database/XMLDatabase.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.store.database; |
|
2 |
|
|
3 |
import java.util.Iterator; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.exist.util.DatabaseConfigurationException; |
|
7 |
import org.xmldb.api.base.XMLDBException; |
|
8 |
|
|
9 |
/** |
|
10 |
* xmldb API is ugly. |
|
11 |
* |
|
12 |
* This is a thin wrapper to the xmldb API with focus on the primary operations used by dnet |
|
13 |
* |
|
14 |
* @author marko |
|
15 |
* |
|
16 |
*/ |
|
17 |
public interface XMLDatabase { // NOPMD |
|
18 |
|
|
19 |
/** |
|
20 |
* creates a new resource or updates the resource if it already exists. |
|
21 |
* |
|
22 |
* @param name |
|
23 |
* file name |
|
24 |
* @param collection |
|
25 |
* collection name |
|
26 |
* @param content |
|
27 |
* serialized xml string |
|
28 |
* @throws XMLDBException |
|
29 |
* happens |
|
30 |
*/ |
|
31 |
void create(String name, String collection, String content) throws XMLDBException; |
|
32 |
|
|
33 |
/** |
|
34 |
* updates and already existing resource. |
|
35 |
* |
|
36 |
* @param name |
|
37 |
* file name |
|
38 |
* @param collection |
|
39 |
* collection name |
|
40 |
* @param content |
|
41 |
* serialized xml string |
|
42 |
* @throws XMLDBException |
|
43 |
* fails if the resource doesn't exist |
|
44 |
*/ |
|
45 |
void update(String name, String collection, String content) throws XMLDBException; |
|
46 |
|
|
47 |
/** |
|
48 |
* removes a resource. |
|
49 |
* |
|
50 |
* @param name |
|
51 |
* file name |
|
52 |
* @param collection |
|
53 |
* collection name |
|
54 |
* @return false if the resource doesn't exist |
|
55 |
* @throws XMLDBException |
|
56 |
* could happen |
|
57 |
*/ |
|
58 |
boolean remove(String name, String collection) throws XMLDBException; |
|
59 |
|
|
60 |
/** |
|
61 |
* read a resource string xml. |
|
62 |
* |
|
63 |
* @param name |
|
64 |
* file name |
|
65 |
* @param collection |
|
66 |
* collection name |
|
67 |
* @return null if the resource doesn't exist, otherwise it returns the xml string serialization |
|
68 |
* @throws XMLDBException |
|
69 |
* happens |
|
70 |
*/ |
|
71 |
String read(String name, String collection) throws XMLDBException; |
|
72 |
|
|
73 |
/** |
|
74 |
* Execute an xquery. |
|
75 |
* |
|
76 |
* @param xquery |
|
77 |
* xquery source |
|
78 |
* @return a xmldb resultset object |
|
79 |
* @throws XMLDBException |
|
80 |
* happens |
|
81 |
*/ |
|
82 |
Iterator<String> xquery(String xquery) throws XMLDBException; |
|
83 |
|
|
84 |
/** |
|
85 |
* creates a new collection, non recursively. |
|
86 |
* |
|
87 |
* @param collection |
|
88 |
* collection name |
|
89 |
* @throws XMLDBException |
|
90 |
* happens |
|
91 |
*/ |
|
92 |
void createCollection(String collection) throws XMLDBException; |
|
93 |
|
|
94 |
/** |
|
95 |
* remove a collection. |
|
96 |
* |
|
97 |
* @param collection |
|
98 |
* collection name |
|
99 |
* @throws XMLDBException |
|
100 |
* happens also when the collection doesn't eXist |
|
101 |
*/ |
|
102 |
void removeCollection(String collection) throws XMLDBException; |
|
103 |
|
|
104 |
void xupdate(String query) throws XMLDBException; |
|
105 |
|
|
106 |
/** |
|
107 |
* check whether a collection exists. |
|
108 |
* |
|
109 |
* @param collection |
|
110 |
* collection name |
|
111 |
* @return true if the collection exists |
|
112 |
* @throws XMLDBException |
|
113 |
* happens |
|
114 |
*/ |
|
115 |
boolean collectionExists(String collection) throws XMLDBException; |
|
116 |
|
|
117 |
/** |
|
118 |
* lists child collections. |
|
119 |
* |
|
120 |
* @param collection |
|
121 |
* parent collections |
|
122 |
* @return list of collection names |
|
123 |
* @throws XMLDBException |
|
124 |
* happens |
|
125 |
*/ |
|
126 |
List<String> listChildCollections(String collection) throws XMLDBException; |
|
127 |
|
|
128 |
/** |
|
129 |
* list the content of a collection. |
|
130 |
* |
|
131 |
* @param collection |
|
132 |
* parent collection |
|
133 |
* @return list of resource names |
|
134 |
* @throws XMLDBException |
|
135 |
* happens |
|
136 |
*/ |
|
137 |
List<String> list(String collection) throws XMLDBException; |
|
138 |
|
|
139 |
/** |
|
140 |
* returns the name of the root collection. |
|
141 |
* |
|
142 |
* @return collection name |
|
143 |
*/ |
|
144 |
String getRootCollection(); |
|
145 |
|
|
146 |
/** |
|
147 |
* make a backup of entire database. |
|
148 |
* |
|
149 |
* @throws XMLDBException |
|
150 |
* could happen |
|
151 |
* @throws DatabaseConfigurationException |
|
152 |
* could happen |
|
153 |
* @return the path in which the Backup has been saved |
|
154 |
*/ |
|
155 |
String backup() throws XMLDBException, DatabaseConfigurationException; |
|
156 |
|
|
157 |
/** |
|
158 |
* Return the dir that contains all backups. |
|
159 |
* |
|
160 |
* @return the path in which the Backup has been saved |
|
161 |
*/ |
|
162 |
String getBackupDir(); |
|
163 |
|
|
164 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/is/store/ISStore.java | ||
---|---|---|
1 |
package eu.dnetlib.enabling.is.store; |
|
2 |
|
|
3 |
import java.util.List; |
Also available in: Unified diff