Revision 41364
Added by Claudio Atzori over 8 years ago
modules/dnet-openaireplus-datasource-manager-service/trunk/src/main/java/eu/dnetlib/enabling/datasources/DatasourceManagerClients.java | ||
---|---|---|
6 | 6 |
import java.util.List; |
7 | 7 |
import java.util.Map; |
8 | 8 |
import java.util.regex.Pattern; |
9 |
|
|
10 | 9 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
11 | 10 |
|
12 |
import org.antlr.stringtemplate.StringTemplate; |
|
13 |
import org.apache.commons.io.IOUtils; |
|
14 |
import org.apache.commons.logging.Log; |
|
15 |
import org.apache.commons.logging.LogFactory; |
|
16 |
import org.dom4j.Document; |
|
17 |
import org.dom4j.io.SAXReader; |
|
18 |
import org.quartz.CronExpression; |
|
19 |
import org.springframework.beans.factory.annotation.Required; |
|
20 |
import org.springframework.core.io.ClassPathResource; |
|
21 |
import org.springframework.core.io.Resource; |
|
22 |
|
|
23 | 11 |
import com.google.common.collect.Lists; |
24 | 12 |
import com.google.common.collect.Maps; |
25 |
|
|
13 |
import eu.dnetlib.enabling.database.rmi.DatabaseException; |
|
26 | 14 |
import eu.dnetlib.enabling.database.rmi.DatabaseService; |
27 | 15 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceDesc; |
28 | 16 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerServiceException; |
... | ... | |
34 | 22 |
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory; |
35 | 23 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
36 | 24 |
import eu.dnetlib.miscutils.functional.xml.ApplyXslt; |
25 |
import org.antlr.stringtemplate.StringTemplate; |
|
26 |
import org.apache.commons.io.IOUtils; |
|
27 |
import org.apache.commons.logging.Log; |
|
28 |
import org.apache.commons.logging.LogFactory; |
|
29 |
import org.dom4j.Document; |
|
30 |
import org.dom4j.io.SAXReader; |
|
31 |
import org.quartz.CronExpression; |
|
32 |
import org.springframework.beans.factory.annotation.Required; |
|
33 |
import org.springframework.core.io.ClassPathResource; |
|
34 |
import org.springframework.core.io.Resource; |
|
37 | 35 |
|
38 | 36 |
public class DatasourceManagerClients { |
39 | 37 |
|
40 |
private String db; |
|
41 |
|
|
42 |
private UniqueServiceLocator serviceLocator; |
|
43 |
|
|
44 |
private ResultSetClientFactory resultSetClientFactory; |
|
45 |
|
|
46 | 38 |
private static final Resource xslt = new ClassPathResource("/eu/dnetlib/enabling/datasources/repo_2_is.xslt"); |
47 |
|
|
48 | 39 |
private static final String REPOSITORY_SERVICE_RESOURCE_TYPE = "RepositoryServiceResourceType"; |
49 |
|
|
50 | 40 |
private static final Log log = LogFactory.getLog(DatasourceManagerClients.class); |
51 |
|
|
52 | 41 |
private static final String TMPLS_BASEDIR = "/eu/dnetlib/enabling/datasources/"; |
42 |
private String db; |
|
43 |
private UniqueServiceLocator serviceLocator; |
|
44 |
private ResultSetClientFactory resultSetClientFactory; |
|
53 | 45 |
|
54 | 46 |
public String findDatasourceId(final String profileId) throws DatasourceManagerServiceException { |
55 | 47 |
try { |
... | ... | |
124 | 116 |
} |
125 | 117 |
} |
126 | 118 |
|
127 |
public Iterable<String> searchSQL(final String sql) { |
|
119 |
public Iterable<String> searchSQL(final String sql) throws DatabaseException {
|
|
128 | 120 |
final W3CEndpointReference epr = serviceLocator.getService(DatabaseService.class).searchSQL(getDb(), sql); |
129 | 121 |
return resultSetClientFactory.getClient(epr); |
130 | 122 |
} |
131 | 123 |
|
132 | 124 |
public boolean updateSQL(final String dsId, final String sql, final boolean delete, final boolean updateprofile) throws DatasourceManagerServiceException { |
133 | 125 |
log.debug("Executing query SQL: " + sql); |
134 |
if (serviceLocator.getService(DatabaseService.class).updateSQL(getDb(), sql) && updateprofile) { |
|
126 |
|
|
127 |
try { |
|
128 |
serviceLocator.getService(DatabaseService.class).updateSQL(getDb(), sql); |
|
129 |
} catch (DatabaseException e) { |
|
130 |
throw new DatasourceManagerServiceException(e); |
|
131 |
} |
|
132 |
|
|
133 |
if (updateprofile) { |
|
135 | 134 |
if (delete) { |
136 | 135 |
return deleteProfile(dsId); |
137 | 136 |
} else { |
modules/dnet-openaireplus-datasource-manager-service/trunk/pom.xml | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 |
<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">
|
|
2 |
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
3 | 3 |
<parent> |
4 | 4 |
<groupId>eu.dnetlib</groupId> |
5 | 5 |
<artifactId>dnet-parent</artifactId> |
... | ... | |
9 | 9 |
<groupId>eu.dnetlib</groupId> |
10 | 10 |
<artifactId>dnet-openaireplus-datasource-manager-service</artifactId> |
11 | 11 |
<packaging>jar</packaging> |
12 |
<version>5.0.6-SNAPSHOT</version>
|
|
12 |
<version>5.1.0-SNAPSHOT</version>
|
|
13 | 13 |
<scm> |
14 | 14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-openaireplus-datasource-manager-service/trunk</developerConnection> |
15 | 15 |
</scm> |
modules/dnet-openaireplus-datasource-manager-service/trunk/dnet-openaireplus-datasource-manager-service.iml | ||
---|---|---|
10 | 10 |
</content> |
11 | 11 |
<orderEntry type="inheritedJdk" /> |
12 | 12 |
<orderEntry type="sourceFolder" forTests="false" /> |
13 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-blackboard-common:2.2.0" level="project" />
|
|
14 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-service-utils:1.0.0" level="project" />
|
|
13 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-blackboard-common:2.2.1-SNAPSHOT" level="project" />
|
|
14 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-service-utils:1.0.1-SNAPSHOT" level="project" />
|
|
15 | 15 |
<orderEntry type="library" name="Maven: apache:oro:2.0.8" level="project" /> |
16 | 16 |
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-jaxws:2.7.8" level="project" /> |
17 | 17 |
<orderEntry type="library" name="Maven: xml-resolver:xml-resolver:1.2" level="project" /> |
... | ... | |
33 | 33 |
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.0.0.RELEASE" level="project" /> |
34 | 34 |
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" /> |
35 | 35 |
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.0.0.RELEASE" level="project" /> |
36 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-notifications-common:2.1.0" level="project" />
|
|
36 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-notifications-common:2.1.1-SNAPSHOT" level="project" />
|
|
37 | 37 |
<orderEntry type="module" module-name="cnr-service-common" /> |
38 | 38 |
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2" level="project" /> |
39 | 39 |
<orderEntry type="library" name="Maven: org.antlr:antlr:2.7.7" level="project" /> |
... | ... | |
50 | 50 |
<orderEntry type="library" name="Maven: org.springframework:spring-test:4.0.0.RELEASE" level="project" /> |
51 | 51 |
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.0.0.RELEASE" level="project" /> |
52 | 52 |
<orderEntry type="library" name="Maven: opensymphony:quartz:1.6.6" level="project" /> |
53 |
<orderEntry type="library" name="Maven: eu.dnetlib:dnet-datasource-manager-rmi:4.0.0" level="project" />
|
|
54 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-rmi-api:2.4.2" level="project" />
|
|
53 |
<orderEntry type="library" name="Maven: eu.dnetlib:dnet-datasource-manager-rmi:4.0.1-SNAPSHOT" level="project" />
|
|
54 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-rmi-api:2.4.3-SNAPSHOT" level="project" />
|
|
55 | 55 |
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-api:2.7.8" level="project" /> |
56 | 56 |
<orderEntry type="library" name="Maven: org.codehaus.woodstox:woodstox-core-asl:4.2.0" level="project" /> |
57 | 57 |
<orderEntry type="library" name="Maven: org.codehaus.woodstox:stax2-api:3.1.1" level="project" /> |
58 | 58 |
<orderEntry type="library" name="Maven: org.apache.ws.xmlschema:xmlschema-core:2.0.3" level="project" /> |
59 | 59 |
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-javamail_1.4_spec:1.7.1" level="project" /> |
60 | 60 |
<orderEntry type="library" name="Maven: wsdl4j:wsdl4j:1.6.3" level="project" /> |
61 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-enabling-database-api:1.0.0" level="project" />
|
|
61 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-enabling-database-api:2.0.0-SNAPSHOT" level="project" />
|
|
62 | 62 |
<orderEntry type="module" module-name="cnr-resultset-client" /> |
63 | 63 |
<orderEntry type="module" module-name="cnr-resultset-service" /> |
64 | 64 |
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" /> |
65 | 65 |
<orderEntry type="library" name="Maven: cglib:cglib-nodep:2.2" level="project" /> |
66 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-spring-utils:1.0.0" level="project" />
|
|
66 |
<orderEntry type="library" name="Maven: eu.dnetlib:cnr-spring-utils:1.0.1-SNAPSHOT" level="project" />
|
|
67 | 67 |
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" /> |
68 | 68 |
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.0.0.RELEASE" level="project" /> |
69 | 69 |
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.0.0.RELEASE" level="project" /> |
Also available in: Unified diff
adapting to newer database service api