Project

General

Profile

« Previous | Next » 

Revision 49077

clening

View differences:

modules/dnet-openaireplus-datasource-manager/trunk/deploy.info
1
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-datasource-manager-service/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-openaireplus-datasource-manager-service"}
1
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-datasource-manager/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-openaireplus-datasource-manager"}
modules/dnet-openaireplus-datasource-manager/trunk/pom.xml
7 7
  	</parent>
8 8
	<modelVersion>4.0.0</modelVersion>
9 9
	<groupId>eu.dnetlib</groupId>
10
	<artifactId>dnet-openaireplus-datasource-manager-service</artifactId>
10
	<artifactId>dnet-openaireplus-datasource-manager</artifactId>
11 11
	<packaging>jar</packaging>
12 12
	<version>5.2.4-SNAPSHOT</version>
13 13
	<scm>
14
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-datasource-manager-service/trunk</developerConnection>
14
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-datasource-manager/trunk</developerConnection>
15 15
	</scm>
16 16
	<dependencies>
17 17
		<dependency>
modules/dnet-openaireplus-datasource-manager/branches/dnet45/pom.xml
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">
3
	<parent>
4
    		<groupId>eu.dnetlib</groupId>
5
	        <artifactId>dnet45-parent</artifactId>
6
                <version>1.0.0-SNAPSHOT</version>
7
  	</parent>
8
	<modelVersion>4.0.0</modelVersion>
9
	<groupId>eu.dnetlib</groupId>
10
	<artifactId>dnet-openaireplus-datasource-manager-service</artifactId>
11
	<packaging>jar</packaging>
12
	<version>5.2.3-SNAPSHOT</version>
13
	<scm>
14
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-openaireplus-datasource-manager-service/trunk</developerConnection>
15
	</scm>
16
	<dependencies>
17
		<dependency>
18
			<groupId>eu.dnetlib</groupId>
19
			<artifactId>cnr-blackboard-common</artifactId>
20
			<version>[2.1.0,3.0.0)</version>
21
		</dependency>
22
		<dependency>
23
			<groupId>eu.dnetlib</groupId>
24
			<artifactId>dnet-datasource-manager-rmi</artifactId>
25
			<version>[4.0.0,5.0.0)</version>
26
		</dependency>
27
		<dependency>
28
			<groupId>eu.dnetlib</groupId>
29
			<artifactId>cnr-enabling-database-service</artifactId>
30
			<version>[3.0.0,4.0.0)</version>
31
		</dependency>
32
		<dependency>
33
			<groupId>eu.dnetlib</groupId>
34
			<artifactId>cnr-resultset-client</artifactId>
35
			<version>[2.0.0,3.0.0)</version>
36
		</dependency>
37
		<dependency>
38
  		    <groupId>junit</groupId>
39
    		    <artifactId>junit</artifactId>
40
      		    <version>${junit.version}</version>
41
	            <scope>test</scope>
42
    		</dependency>
43
	</dependencies>
44
</project>
modules/dnet-openaireplus-datasource-manager/branches/dnet45/dnet-openaireplus-datasource-manager-service.iml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
4
    <output url="file://$MODULE_DIR$/target/classes" />
5
    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
    <content url="file://$MODULE_DIR$">
7
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
      <excludeFolder url="file://$MODULE_DIR$/target" />
10
    </content>
11
    <orderEntry type="inheritedJdk" />
12
    <orderEntry type="sourceFolder" forTests="false" />
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.2-SNAPSHOT" level="project" />
15
    <orderEntry type="library" name="Maven: apache:oro:2.0.8" level="project" />
16
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-jaxws:3.1.5" level="project" />
17
    <orderEntry type="library" name="Maven: xml-resolver:xml-resolver:1.2" level="project" />
18
    <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
19
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-bindings-soap:3.1.5" level="project" />
20
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-wsdl:3.1.5" level="project" />
21
    <orderEntry type="library" name="Maven: wsdl4j:wsdl4j:1.6.3" level="project" />
22
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-databinding-jaxb:3.1.5" level="project" />
23
    <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.11" level="project" />
24
    <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.2.11" level="project" />
25
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-bindings-xml:3.1.5" level="project" />
26
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-simple:3.1.5" level="project" />
27
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-ws-addr:3.1.5" level="project" />
28
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-ws-policy:3.1.5" level="project" />
29
    <orderEntry type="library" name="Maven: org.apache.neethi:neethi:3.0.3" level="project" />
30
    <orderEntry type="library" name="Maven: org.springframework:spring-context:4.2.5.RELEASE" level="project" />
31
    <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.2.5.RELEASE" level="project" />
32
    <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
33
    <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.2.5.RELEASE" level="project" />
34
    <orderEntry type="library" name="Maven: eu.dnetlib:cnr-notifications-common:2.1.1-SNAPSHOT" level="project" />
35
    <orderEntry type="module" module-name="cnr-service-common" />
36
    <orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2" level="project" />
37
    <orderEntry type="library" name="Maven: org.antlr:antlr:2.7.7" level="project" />
38
    <orderEntry type="module" module-name="cnr-misc-utils" />
39
    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
40
    <orderEntry type="library" name="Maven: saxonica:saxon:9.1.0.8" level="project" />
41
    <orderEntry type="library" name="Maven: saxonica:saxon-dom:9.1.0.8" level="project" />
42
    <orderEntry type="library" name="Maven: jgrapht:jgrapht:0.7.2" level="project" />
43
    <orderEntry type="library" name="Maven: org.springframework:spring-test:4.2.5.RELEASE" level="project" />
44
    <orderEntry type="library" name="Maven: org.quartz-scheduler:quartz:2.2.2" level="project" />
45
    <orderEntry type="library" name="Maven: c3p0:c3p0:0.9.1.1" level="project" />
46
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.7" level="project" />
47
    <orderEntry type="library" name="Maven: eu.dnetlib:dnet-datasource-manager-rmi:4.0.1-SNAPSHOT" level="project" />
48
    <orderEntry type="library" name="Maven: eu.dnetlib:cnr-rmi-api:2.6.1-SNAPSHOT" level="project" />
49
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-core:3.1.5" level="project" />
50
    <orderEntry type="library" name="Maven: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
51
    <orderEntry type="library" name="Maven: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
52
    <orderEntry type="library" name="Maven: org.apache.ws.xmlschema:xmlschema-core:2.2.1" level="project" />
53
    <orderEntry type="module" module-name="cnr-enabling-database-service" />
54
    <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.2.5.RELEASE" level="project" />
55
    <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.2.5.RELEASE" level="project" />
56
    <orderEntry type="library" name="Maven: org.springframework:spring-core:4.2.5.RELEASE" level="project" />
57
    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
58
    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.2.5.RELEASE" level="project" />
59
    <orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.2.5.RELEASE" level="project" />
60
    <orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
61
    <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
62
    <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
63
    <orderEntry type="library" name="Maven: org.postgresql:jdbc4driver:8.3" level="project" />
64
    <orderEntry type="library" name="Maven: org.hibernate:hibernate-core:4.3.2.Final" level="project" />
65
    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.1.3.GA" level="project" />
66
    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1" level="project" />
67
    <orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final" level="project" />
68
    <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
69
    <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
70
    <orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:4.0.4.Final" level="project" />
71
    <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
72
    <orderEntry type="library" name="Maven: org.javassist:javassist:3.18.1-GA" level="project" />
73
    <orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
74
    <orderEntry type="library" name="Maven: org.jboss:jandex:1.1.0.Final" level="project" />
75
    <orderEntry type="library" name="Maven: eu.dnetlib:cnr-enabling-database-api:2.1.1-SNAPSHOT" level="project" />
76
    <orderEntry type="module" module-name="cnr-resultset-service" />
77
    <orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
78
    <orderEntry type="module" module-name="cnr-spring-utils" />
79
    <orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
80
    <orderEntry type="library" name="Maven: org.springframework:spring-web:4.2.5.RELEASE" level="project" />
81
    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.2.5.RELEASE" level="project" />
82
    <orderEntry type="library" name="Maven: jparsec:jparsec:2.0" level="project" />
83
    <orderEntry type="library" name="Maven: net.sf.ehcache:ehcache:2.8.0" level="project" />
84
    <orderEntry type="library" name="Maven: runcc:runcc:0.7" level="project" />
85
    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.2" level="project" />
86
    <orderEntry type="library" name="Maven: joda-time:joda-time:2.3" level="project" />
87
    <orderEntry type="library" name="Maven: jaxen:jaxen:1.1.6" level="project" />
88
    <orderEntry type="library" name="Maven: eu.dnetlib:cnr-resultset-client:2.1.2-SNAPSHOT" level="project" />
89
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-transports-http:3.1.5" level="project" />
90
    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.9" level="project" />
91
    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
92
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
93
  </component>
94
</module>
modules/dnet-openaireplus-datasource-manager/branches/dnet45/deploy.info
1
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-datasource-manager-service/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-openaireplus-datasource-manager-service"}
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/repo_interface.st
1
<INTERFACE id="$ifc.id$" label="$ifc.typology$ ($ifc.compliance$)" typology="$ifc.typology$" compliance="$ifc.compliance$" active="$ifc.active$" removable="$ifc.removable$" contentDescription="$ifc.contentDescription$">
2
	<ACCESS_PROTOCOL $ifc.accessParams.keys:{k| $k$="$ifc.accessParams.(k)$"};separator=" "$>$ifc.accessProtocol$</ACCESS_PROTOCOL>
3
	<BASE_URL>$ifc.baseUrl$</BASE_URL>
4
	$ifc.extraFields.keys:{k|<INTERFACE_EXTRA_FIELD name="$k$">$ifc.extraFields.(k)$</INTERFACE_EXTRA_FIELD>}$
5
</INTERFACE>
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/repo_2_is.xslt
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0"
3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
	xmlns:dnet="eu.dnetlib.enabling.datasources.DatasourceFunctions"
5
	exclude-result-prefixes="xsl dnet">
6

  
7
	<xsl:template match="/">
8
	
9
		<RESOURCE_PROFILE>
10
			<HEADER>
11
				<RESOURCE_IDENTIFIER value="" />
12
				<RESOURCE_TYPE value="RepositoryServiceResourceType" />
13
				<RESOURCE_KIND value="RepositoryServiceResources" />
14
				<RESOURCE_URI value="" />
15
				<DATE_OF_CREATION value="" />
16
				<PROTOCOL />
17
			</HEADER>
18
			<BODY>
19
				<CONFIGURATION>
20
		            <DATASOURCE_TYPE>
21
		            	<xsl:value-of select="//FIELD[@name='datasourceclass']" />
22
		            </DATASOURCE_TYPE>
23
            		<DATASOURCE_ORIGINAL_ID provenance="OPENAIRE">
24
            			<xsl:value-of select="//FIELD[@name='id']" />
25
            		</DATASOURCE_ORIGINAL_ID>
26
            		<DATASOURCE_AGGREGATED>false</DATASOURCE_AGGREGATED>
27
            		<ENVIRONMENTS>
28
                		<ENVIRONMENT>OPENAIRE</ENVIRONMENT>
29
            		</ENVIRONMENTS>
30
				
31
					<TYPOLOGY><xsl:value-of select="//FIELD[@name='typology']" /></TYPOLOGY>
32
					<MAX_SIZE_OF_DATASTRUCTURE>0</MAX_SIZE_OF_DATASTRUCTURE>
33
					<AVAILABLE_DISKSPACE>0</AVAILABLE_DISKSPACE>
34
					<MAX_NUMBER_OF_DATASTRUCTURE>0</MAX_NUMBER_OF_DATASTRUCTURE>
35
					<OFFICIAL_NAME>
36
						<xsl:value-of select="//FIELD[@name='officialname']" />
37
					</OFFICIAL_NAME>
38
					<ENGLISH_NAME>
39
						<xsl:choose>
40
							<xsl:when
41
								test="//FIELD[@name='englishname' and (@isNull='true' or string-length(normalize-space(.)) = 0)]">
42
								<xsl:value-of select="//FIELD[@name='officialname']" />
43
							</xsl:when>
44
							<xsl:otherwise>
45
								<xsl:value-of select="//FIELD[@name='englishname']" />
46
							</xsl:otherwise>
47
						</xsl:choose>
48
					</ENGLISH_NAME>
49
					<ICON_URI>
50
						<xsl:value-of select="//FIELD[@name='logourl']" />
51
					</ICON_URI>
52
					<COUNTRY>
53
						<xsl:value-of select="//FIELD[@name='countrycode']" />
54
					</COUNTRY>
55
					<LOCATION>
56
						<LONGITUDE>
57
							<xsl:choose>
58
								<xsl:when test="//FIELD[@name='longitude' and @isNull='true']">
59
									0.0
60
								</xsl:when>
61
								<xsl:otherwise>
62
									<xsl:value-of select="//FIELD[@name='longitude']" />
63
								</xsl:otherwise>
64
							</xsl:choose>
65
						</LONGITUDE>
66
						<LATITUDE>
67
							<xsl:choose>
68
								<xsl:when test="//FIELD[@name='latitude' and @isNull='true']">
69
									0.0
70
								</xsl:when>
71
								<xsl:otherwise>
72
									<xsl:value-of select="//FIELD[@name='latitude']" />
73
								</xsl:otherwise>
74
							</xsl:choose>
75
						</LATITUDE>
76
						<TIMEZONE>0.0</TIMEZONE>
77
					</LOCATION>
78
					<REPOSITORY_WEBPAGE>
79
						<xsl:value-of select="//FIELD[@name='websiteurl']" />
80
					</REPOSITORY_WEBPAGE>
81
					<REPOSITORY_INSTITUTION>
82
						<xsl:value-of select="//FIELD[@name='organization']" />
83
					</REPOSITORY_INSTITUTION>
84
					<ADMIN_INFO>
85
						<xsl:value-of select="//FIELD[@name='contactemail']" />
86
					</ADMIN_INFO>
87
					<INTERFACES>
88
					<xsl:for-each select="//FIELD[@name='accessinfopackage']/ITEM">
89
						<xsl:value-of select="dnet:buildInterface(.)" disable-output-escaping="yes"/>
90
					</xsl:for-each>
91
					</INTERFACES>
92
					<EXTRA_FIELDS>
93
						<FIELD>
94
							<key>OpenAireDataSourceId</key>
95
							<value>
96
								<xsl:value-of select="//FIELD[@name='id']" />
97
							</value>
98
						</FIELD>
99
						<FIELD>
100
							<key>NamespacePrefix</key>
101
							<value>
102
								<xsl:value-of select="//FIELD[@name='namespaceprefix']" />
103
							</value>
104
						</FIELD>
105
						<FIELD>
106
							<key>VERIFIED</key>
107
							<value>NO</value>
108
						</FIELD>
109
						<FIELD>
110
							<key>aggregatorName</key>
111
							<value><xsl:value-of select="//FIELD[@name='aggregator']" /></value>
112
						</FIELD>
113
						<FIELD>
114
							<key>dateOfValidation</key>
115
							<value>
116
								<xsl:value-of select="//FIELD[@name='dateofvalidation']"/>
117
							</value>
118
						</FIELD>
119
						<FIELD>
120
							<key>dateOfCollection</key>
121
							<value>
122
								<xsl:value-of select="//FIELD[@name='dateofcollection']"/>
123
							</value>
124
						</FIELD>
125
						
126
						<FIELD>
127
							<key>mergeHomonyms</key>
128
							<value>
129
								<xsl:value-of select="//FIELD[@name='mergehomonyms']"/>
130
							</value>
131
						</FIELD>
132
						
133
						<xsl:if test="string-length(normalize-space(//FIELD[@name='activationid'])) &gt; 0">
134
							<FIELD>
135
								<key>ACTID</key>
136
								<value>
137
									<xsl:value-of select="//FIELD[@name='activationid']"/>
138
								</value>
139
							</FIELD>
140
						</xsl:if>					
141
					</EXTRA_FIELDS>
142
					<REGISTERED_BY><xsl:value-of select="//FIELD[@name='registeredby']"/></REGISTERED_BY>
143
				</CONFIGURATION>
144
				<STATUS>
145
					<NUMBER_OF_OBJECTS>
146
						<xsl:choose>
147
							<xsl:when test="//FIELD[@name='od_numberofitems' and (@isNull='true' or normalize-space(text()) = '')]">
148
								0
149
							</xsl:when>
150
							<xsl:otherwise>
151
								<xsl:value-of select="//FIELD[@name='od_numberofitems']" />
152
							</xsl:otherwise>
153
						</xsl:choose>
154
					</NUMBER_OF_OBJECTS>
155
					<LAST_UPDATE value="{//FIELD[@name='now']}"/>
156
				</STATUS>
157
				<QOS>
158
					<AVAILABILITY>0</AVAILABILITY>
159
					<CAPACITY/>
160
					<THROUGHPUT>0.0</THROUGHPUT>
161
				</QOS>
162
				<SECURITY_PARAMETERS />
163
				<BLACKBOARD />
164
			</BODY>
165
		</RESOURCE_PROFILE>
166
	</xsl:template>
167
</xsl:stylesheet>
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/findReposMap.sql.st
1
SELECT
2
	d.id           AS id,
3
	d.officialname AS name,
4
	d.latitude     AS lat,
5
	d.longitude    AS lng
6
FROM datasources d 
7
	LEFT OUTER JOIN api a ON (d.id = a.datasource)
8
WHERE a.active = true AND d.latitude IS NOT NULL AND d.longitude IS NOT NULL
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/updateBulkApiCollections.sql.st
1
$params.keys:{k|
2
	UPDATE apicollections SET edited = $params.(k)$ WHERE api=$ifaceId$ AND lower(param)=lower($k$);
3
}$
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/updateLevelOfCompliance.sql.st
1
UPDATE api SET compatibilityclass = $level$ WHERE id = $ifaceId$ AND datasource = $dsId$
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/deleteOldExtraFields.sql.st
1
DELETE FROM apicollections WHERE api = $ifaceId$ AND accessparam = false;
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/searchApiCollectionParam.sql.st
1
SELECT * FROM apicollections WHERE api = $ifaceId$ AND lower(param) = lower($field$)
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/searchRepoInterfaces.sql.st
1
SELECT * FROM (
2
	SELECT
3
		(array_agg(DISTINCT o.country))[1]      AS country,
4
		(array_agg(DISTINCT o.legalname))[1]    AS organization,
5
		d.id                                    AS repoid,
6
		d.officialname                          AS reponame,
7
		d.englishname                           AS othername,
8
		d.namespaceprefix                       AS repoprefix,
9
		d.websiteurl                            AS repourl,
10
		a.id                                    AS id,
11
		a.active                                AS active,
12
		a.protocol                              AS protocol,
13
		a.typology                              AS type,
14
		a.compatibility                         AS compliance,
15
		CASE
16
			WHEN (a.last_aggregation_date IS NOT NULL) THEN to_char(a.last_aggregation_date, 'YYYY-MM-DD')
17
			WHEN (a.last_download_date IS NOT NULL) THEN to_char(a.last_download_date, 'YYYY-MM-DD')
18
			ELSE ''
19
		END AS aggrdate,
20
		CASE
21
			WHEN (a.last_aggregation_total IS NOT NULL) THEN to_char(a.last_aggregation_total, '')
22
			WHEN (a.last_download_total IS NOT NULL) THEN to_char(a.last_download_total, '')
23
			ELSE '0'
24
		END AS aggrtotal
25
	FROM
26
		api a
27
		LEFT OUTER JOIN datasources d               ON (a.datasource = d.id)
28
		LEFT OUTER JOIN datasource_organization dao ON (d.id = dao.datasource)
29
		LEFT OUTER JOIN organizations o             ON (dao.organization = o.id)
30
		GROUP BY
31
			d.id, d.officialname, d.englishname, d.namespaceprefix, d.websiteurl,
32
			a.id, a.active, a.protocol, a.typology, a.compatibility,
33
			a.last_aggregation_date, a.last_download_date,
34
			a.last_aggregation_total, a.last_download_total
35
) AS t WHERE
36
	$if(field)$
37
		$field$ = $delimeter$$value$$delimeter$
38
	$else$
39
		repoid ILIKE '%$value$%' 
40
		OR reponame ILIKE '%$value$%'
41
		OR othername ILIKE '%$value$%'
42
		OR repoprefix ILIKE '%$value$%' 
43
		OR repourl ILIKE '%$value$%' 
44
		OR organization ILIKE '%$value$%' 
45
	$endif$
46

  
47

  
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/updateApiCollectionsRow.sql.st
1
$if(update)$
2
	$if(value)$
3
		$if(preserveOriginal)$
4
			UPDATE apicollections SET (edited, accessparam) = ($value$, $accessParam$) WHERE api=$ifaceId$ AND lower(param)=lower($field$);
5
		$else$
6
			UPDATE apicollections SET (original, edited, accessparam) = ($value$, NULL, $accessParam$) WHERE api=$ifaceId$ AND lower(param)=lower($field$);
7
		$endif$
8
	$else$
9
		UPDATE apicollections SET (edited, accessparam) = (NULL, $accessParam$) WHERE api=$ifaceId$ AND lower(param)=lower($field$);
10
	$endif$
11
$else$
12
	INSERT INTO apicollections(param, original, api, accessparam) VALUES ($field$, $value$, $ifaceId$, $accessParam$); 
13
$endif$
14

  
15
-- FIX
16
UPDATE apicollections SET _dnet_resource_identifier_ = api||'@@'||param WHERE api = $ifaceId$ AND lower(param)=lower($field$);
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/addDatasource.sql.st
1
BEGIN;
2

  
3
INSERT INTO datasources (
4
	_dnet_resource_identifier_,
5
	id,
6
	officialName,
7
	englishName,
8
	websiteUrl,
9
	logoUrl,
10
	contactEmail,
11
	latitude,
12
	longitude,
13
	timezone,
14
	namespacePrefix,
15
	od_NumberOfItems,
16
	od_NumberOfItemsDate,
17
	od_Policies,
18
	od_Languages,
19
	od_ContentTypes,
20
	collectedFrom,
21
	inferred,
22
	deletedByInference,
23
	trust,
24
	inferenceProvenance,
25
	dateOfValidation,
26
	registeredby,
27
	datasourceClass,
28
	provenanceActionClass,
29
	dateOfCollection,
30
	typology,
31
	activationId,
32
	mergehomonyms,
33
	description,
34
	releaseStartDate,
35
	releaseEndDate,
36
	missionStatementUrl,
37
	dataProvider,
38
	serviceProvider,
39
	databaseAccessType,
40
	dataUploadType,
41
	databaseAccessRestriction,
42
	dataUploadRestriction,
43
	versioning,
44
	citationGuidelineUrl,
45
	qualityManagementKind,
46
	pidSystems,
47
	certificates,
48
	aggregator,
49
	issn,
50
	eissn,
51
	lissn
52
) VALUES (
53
	$id$,
54
	$id$,
55
	$officialName$,
56
	$englishName$,
57
	$websiteUrl$,
58
	$logoUrl$,
59
	$contactEmail$,
60
	$latitude$,
61
	$longitude$,
62
	$timezone$,
63
	$namespacePrefix$,
64
	$odNumberOfItems$,
65
	$odNumberOfItemsDate$,
66
	$odPolicies$,
67
	$odLanguages$,
68
	$odContentTypes$,
69
	$collectedFrom$,
70
	$inferred$,
71
	$deletedByInference$,
72
	$trust$,
73
	$inferenceProvenance$,
74
	$dateOfValidation$,
75
	$registeredBy$,
76
	$datasourceClass$,
77
	$provenanceActionClass$,
78
	$dateOfCollection$,
79
	$typology$,
80
	$activationId$,
81
	$mergehomonyms$,
82
	$description$,
83
	$releaseStartDate$,
84
	$releaseEndDate$,
85
	$missionStatementUrl$,
86
	$dataProvider$,
87
	$serviceProvider$,
88
	$databaseAccessType$,
89
	$dataUploadType$,
90
	$databaseAccessRestriction$,
91
	$dataUploadRestriction$,
92
	$versioning$,
93
	$citationGuidelineUrl$,
94
	$qualityManagementKind$,
95
	$pidSystems$,
96
	$certificates$,
97
	$aggregator$,
98
	$issn$,
99
	$eissn$,
100
	$lissn$
101
);
102

  
103
$if(hasOrganization)$
104
	INSERT INTO organizations (
105
		_dnet_resource_identifier_,
106
		id,
107
		legalname,
108
		countryclass
109
	) VALUES (
110
		$id$||'::'||$organization$,
111
		$id$||'::'||$organization$,
112
		$organization$,
113
		$countryCode$
114
	);
115
	
116
	INSERT INTO datasource_organization (
117
		_dnet_resource_identifier_,
118
		datasource,
119
		organization
120
	) VALUES (
121
		$id$||'@@'||$id$||'::'||$organization$,
122
		$id$,
123
		$id$||'::'||$organization$
124
	);
125
$endif$
126

  
127

  
128

  
129
$interfaces:{ifc|
130
	INSERT INTO api (
131
		_dnet_resource_identifier_,
132
		id,
133
		datasource, 
134
		protocolclass, 
135
		contentdescriptionclass,
136
		removable,
137
		typologyclass,
138
		compatibilityclass
139
	) VALUES (
140
		$ifc.id$,
141
		$ifc.id$,
142
		$id$,
143
		$ifc.accessProtocol$,
144
		$ifc.contentDescription$,
145
		true,
146
		$ifc.typology$,
147
		$ifc.compliance$
148
	);
149
	
150
	$ifc.accessParams.keys:{p|
151
		INSERT INTO apicollections (
152
			_dnet_resource_identifier_,
153
			param,
154
			original,
155
			api,
156
			accessparam
157
		) VALUES (
158
			$ifc.id$||'@@'||$p$,
159
			$p$,
160
			$ifc.accessParams.(p)$,
161
			$ifc.id$,
162
			true
163
		);
164
	}$
165
	
166
	$ifc.extraFields.keys:{p|
167
		INSERT INTO apicollections (
168
			_dnet_resource_identifier_,
169
			param,
170
			original,
171
			api,
172
			accessparam
173
		) VALUES (
174
			$ifc.id$||'@@'||$p$,
175
			$p$,
176
			$ifc.extraFields.(p)$,
177
			$ifc.id$,
178
			false
179
		);
180
	}$
181
}$
182

  
183
COMMIT;
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/simpleFindRepos.sql.st
1
SELECT 
2
	d.id                     AS id,
3
	d.officialname           AS name,
4
	array_agg(DISTINCT a.id) AS apis
5
FROM
6
	datasources d
7
	LEFT OUTER JOIN api a ON (d.id = a.datasource)
8
WHERE
9
	datasourceclass = '$type$'
10
GROUP BY 
11
	d.id,
12
	d.officialname
13
ORDER BY
14
	d.officialname
15
	
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/updateActivationStatus.sql.st
1
UPDATE api SET active = $active$ WHERE id = $ifaceId$ AND datasource = $dsId$
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/applicationContext-dnet-openaireplus-datasource-manager-service.properties
1
dnet.openaire.dsm.db.name   =   dnet_dsm
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/overrideCompliance.sql.st
1
$if(insert)$
2
	INSERT INTO apicollections(param, original, api, accessparam) VALUES ($field$, $value$, $ifaceId$, false);
3
	UPDATE apicollections SET _dnet_resource_identifier_ = api||'@@'||param WHERE api = $ifaceId$ AND lower(param)=lower($field$);
4
$endif$
5

  
6
$if(update)$
7
	UPDATE apicollections SET original = $value$ WHERE api = $ifaceId$ AND lower(param)=lower($field$);
8
$endif$
9

  
10
$if(delete)$
11
	DELETE FROM apicollections WHERE api = $ifaceId$ AND lower(param)=lower($field$);
12
$endif$
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/deleteDatasource.sql.st
1
BEGIN;
2
DELETE FROM apicollections USING api WHERE api=api.id AND api.datasource=$dsId$;
3
DELETE FROM api WHERE datasource=$dsId$;
4
DELETE FROM datasources WHERE id=$dsId$;
5
COMMIT;
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/getDatasources.sql.st
1
SELECT 
2
	ds.id,
3
	ds.officialname,
4
	ds.englishname,
5
	ds.websiteurl,
6
	ds.logourl,
7
	ds.contactemail,
8
	ds.latitude,
9
	ds.longitude,
10
	ds.timezone,
11
	ds.namespaceprefix,
12
	ds.od_numberofitems, 
13
	ds.od_numberofitemsdate,
14
	ds.od_policies,
15
	ds.od_languages, 
16
	ds.od_contenttypes, 
17
	ds.collectedfrom,
18
	ds.inferred,
19
	ds.deletedbyinference,
20
	ds.trust,
21
	ds.inferenceprovenance,
22
	ds.dateofvalidation,
23
	ds.registeredby,
24
	ds.optional1,
25
	ds.optional2,
26
	ds.datasourceclass,
27
	ds.provenanceactionclass,
28
	ds.dateofcollection,
29
	ds.typology,
30
	ds.activationid, 
31
	ds.mergehomonyms,
32
	ds.description,
33
	ds.releasestartdate,
34
	ds.releaseenddate,
35
	ds.missionstatementurl,
36
	ds.dataprovider,
37
	ds.serviceprovider,
38
	ds.databaseaccesstype,
39
	ds.datauploadtype,
40
	ds.databaseaccessrestriction,
41
	ds.datauploadrestriction,
42
	ds.versioning,
43
	ds.citationguidelineurl,
44
	ds.qualitymanagementkind, 
45
	ds.pidsystems,
46
	ds.certificates, 
47
	ds.aggregator,
48
	ds.issn,
49
	ds.eissn,
50
	ds.lissn,
51
	(array_agg(o.legalname))[1] as organization,
52
	(array_agg(ccl.code))[1] as countrycode,
53
	(array_agg(ccl.name))[1] as countryname,
54
	array_agg(distinct ag.accessinfopackage) as accessinfopackage,
55
	to_char(now(), 'YYYY-MM-DDThh24:mi:ssZ') AS now
56
	
57
FROM datasources ds
58
	LEFT OUTER JOIN datasource_organization dso ON ds.id = dso.datasource
59
	LEFT OUTER JOIN organizations o ON dso.organization = o.id
60
	LEFT OUTER JOIN class ccl ON ccl.code = o.countryclass
61
	LEFT OUTER JOIN (
62
			SELECT 	api.datasource, api.contentdescriptionclass, api.compatibilityclass,
63
					COALESCE(api.id, '')||'<==1==>'||COALESCE(api.typologyclass, '')||'<==2==>'||COALESCE(api.compatibilityclass, '')||'<==3==>'||COALESCE(api.contentdescriptionclass,'')||'<==4==>'||COALESCE(api.protocolclass,'')||'<==5==>'||COALESCE(api.active,false)||'<==6==>'||COALESCE(api.removable,false)||'<==7==>'||array_to_string(array_agg(distinct COALESCE(ac.accessparam, true)||'###'||COALESCE(ac.param,'')||'###'||COALESCE(ac.value,'')||'###'), '@@@') AS accessinfopackage 
64
			FROM api 
65
			LEFT OUTER JOIN (
66
				SELECT api, param, accessparam, CASE WHEN edited IS NULL THEN original ELSE edited END as value FROM apicollections
67
			) AS ac ON (ac.api = api.id) 
68
			GROUP BY 
69
				api.id,
70
				api.datasource,
71
				api.contentdescriptionclass,
72
				api.typologyclass,
73
				api.compatibilityclass,
74
				api.protocolclass,
75
				api.active,
76
				api.removable
77
		) AS ag on (ag.datasource = ds.id)
78

  
79
$if(condition)$
80
	WHERE $condition$
81
$endif$
82

  
83
GROUP BY 
84
	ds.id,
85
	ds.officialname,
86
	ds.englishname,
87
	ds.websiteurl,
88
	ds.logourl,
89
	ds.contactemail,
90
	ds.latitude,
91
	ds.longitude,
92
	ds.timezone,
93
	ds.namespaceprefix,
94
	ds.od_numberofitems, 
95
	ds.od_numberofitemsdate,
96
	ds.od_policies,
97
	ds.od_languages, 
98
	ds.od_contenttypes, 
99
	ds.collectedfrom,
100
	ds.inferred,
101
	ds.deletedbyinference,
102
	ds.trust,
103
	ds.inferenceprovenance,
104
	ds.dateofvalidation,
105
	ds.registeredby,
106
	ds.optional1,
107
	ds.optional2,
108
	ds.datasourceclass,
109
	ds.provenanceactionclass,
110
	ds.dateofcollection,
111
	ds.typology,
112
	ds.activationid, 
113
	ds.mergehomonyms,
114
	ds.description,
115
	ds.releasestartdate,
116
	ds.releaseenddate,
117
	ds.missionstatementurl,
118
	ds.dataprovider,
119
	ds.serviceprovider,
120
	ds.databaseaccesstype,
121
	ds.datauploadtype,
122
	ds.databaseaccessrestriction,
123
	ds.datauploadrestriction,
124
	ds.versioning,
125
	ds.citationguidelineurl,
126
	ds.qualitymanagementkind, 
127
	ds.pidsystems,
128
	ds.certificates, 
129
	ds.aggregator,
130
	ds.issn,
131
	ds.eissn,
132
	ds.lissn
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/applicationContext-dnet-openaireplus-datasource-manager-service.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
4
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
5
	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
6
	xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template"
7
	xmlns:util="http://www.springframework.org/schema/util"
8
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
9
                                    http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
10
                                    http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
11
                                    http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
12
                            http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
13
                            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
14
                            http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd">
15

  
16
	<bean id="datasourceManagerService" 
17
		class="eu.dnetlib.enabling.datasources.DatasourceManagerServiceImpl"
18
		p:datasourceManagerClients-ref="datasourceManagerClients">
19
		<property name="browsableFields">
20
		<list>
21
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
22
					p:id="country"
23
					p:label="Datasource countries"
24
					p:sql="select c.code as id, c.name as name, count(*) as count from api a left outer join datasources d on (a.datasource = d.id) left outer join datasource_organization dao on (d.id = dao.datasource) left outer join organizations o on (dao.organization = o.id) left outer join class c on (o.countryclass = c.code) group by c.code, c.name order by count desc" />
25
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
26
					p:id="type"
27
					p:label="API typologies"
28
					p:sql="select c.code as id, c.name as name, count(*) as count from api a left outer join class c on (a.typologyclass = c.code) group by c.code, c.name order by count desc" />
29
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
30
					p:id="protocol"
31
					p:label="API protocols"
32
					p:sql="select c.code as id, c.name as name, count(*) as count from api a left outer join class c on (a.protocolclass = c.code) group by c.code, c.name order by count desc" />
33
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
34
					p:id="compliance"
35
					p:label="API compatibility levels"
36
					p:sql="select c.code as id, c.name as name, count(*) from api a left outer join apicollections ac on (a.id = ac.api and ac.param = 'overriding_compliance') left outer join class c on (c.code = case when (ac.edited IS NOT NULL) then ac.edited when (ac.original IS NOT NULL) then ac.original else a.compatibilityclass end) group by c.code, c.name order by count desc" />
37
				<bean class="eu.dnetlib.enabling.datasources.DbBrowsableField"
38
					p:id="active"
39
					p:label="API activation"
40
					p:sql="select active as id, active as name, count(*) as count from api group by active order by count desc" 
41
					p:text="false"/>
42
			</list>
43
		</property>
44
	</bean>
45

  
46
	<bean id="datasourceManagerClients" 
47
		class="eu.dnetlib.enabling.datasources.DatasourceManagerClients" 
48
		p:db="${dnet.openaire.dsm.db.name}"
49
		p:serviceLocator-ref="uniqueServiceLocator"
50
		p:resultSetClientFactory-ref="resultSetClientFactory" />
51

  
52
	<!-- endpoints -->
53
	<jaxws:endpoint id="datasourceManagerServiceEndpoint"
54
		implementor="#datasourceManagerService"
55
		implementorClass="eu.dnetlib.enabling.datasources.rmi.DatasourceManagerService"
56
		address="/datasourceManager" />
57

  
58
	<template:instance name="serviceRegistrationManager"
59
		t:serviceRegistrationManagerClass="eu.dnetlib.enabling.tools.registration.ValidatingServiceRegistrationManagerImpl"
60
		t:name="datasourceManagerServiceRegistrationManager" t:service="datasourceManagerService"
61
		t:endpoint="datasourceManagerServiceEndpoint" t:jobScheduler="jobScheduler" />
62
		
63
</beans>
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/updateContentDescription.sql.st
1
UPDATE api SET contentdescriptionclass = $desc$ WHERE id = $ifaceId$ AND datasource = $dsId$
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/deleteApiCollectionsRow.sql.st
1
DELETE FROM 
2
	apicollections 
3
USING 
4
	api 
5
WHERE 
6
	param=$field$ 
7
	AND api=api.id 
8
	AND api.id=$ifaceId$ 
9
	AND api.datasource=$dsId$
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/deleteInterface.sql.st
1
DO \$\$BEGIN
2
	DELETE FROM apicollections USING api WHERE api=api.id AND api.id=$id$ AND api.datasource=$datasource$ AND api.removable=true AND api.active=false;
3
	DELETE FROM api WHERE id=$id$ AND datasource=$datasource$ AND removable=true AND active=false;
4
	IF NOT FOUND THEN
5
		raise exception 'Api not deleted'; 
6
	END IF;
7
END\$\$;
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/resources/eu/dnetlib/enabling/datasources/insertInterface.sql.st
1
BEGIN;
2

  
3
INSERT INTO 
4
	api(_dnet_resource_identifier_, id, typologyclass, protocolclass, datasource, contentdescriptionclass, compatibilityclass, removable) 
5
VALUES
6
	($id$, $id$, $typology$, $protocol$, $datasource$, $description$, $compliance$, true);
7

  
8

  
9
-- baseUrl
10
$if(baseUrl)$
11
	INSERT INTO apicollections(param, original, api) VALUES	('baseUrl', $baseUrl$, $id$);
12
$endif$
13

  
14
-- ACCESS PARAMS
15
$accessParams.keys:{k|
16
	INSERT INTO apicollections(param, original, api) VALUES ($k$, $accessParams.(k)$, $id$);
17
}$
18

  
19
-- OTHER PARAMS
20
$extraFields.keys:{k|
21
	INSERT INTO apicollections(param, original, api, accessparam) VALUES ($k$, $extraFields.(k)$, $id$, false);
22
}$
23

  
24
-- FIX
25
UPDATE apicollections SET _dnet_resource_identifier_ = api||'@@'||param WHERE api = $id$;
26

  
27
COMMIT;
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/java/eu/dnetlib/enabling/datasources/DatasourceFunctions.java
1
package eu.dnetlib.enabling.datasources;
2

  
3
import java.io.IOException;
4
import java.text.ParseException;
5
import java.text.SimpleDateFormat;
6
import java.util.ArrayList;
7
import java.util.Date;
8
import java.util.List;
9
import java.util.Map;
10

  
11
import org.antlr.stringtemplate.StringTemplate;
12
import org.apache.commons.io.IOUtils;
13
import org.apache.commons.lang.StringEscapeUtils;
14
import org.apache.commons.lang.StringUtils;
15
import org.apache.commons.logging.Log;
16
import org.apache.commons.logging.LogFactory;
17
import org.dom4j.Document;
18
import org.dom4j.Node;
19
import org.springframework.core.io.ClassPathResource;
20
import org.springframework.core.io.Resource;
21

  
22
import com.google.common.base.Splitter;
23
import com.google.common.collect.Lists;
24
import com.google.common.collect.Maps;
25

  
26
import eu.dnetlib.enabling.datasources.rmi.DatasourceConstants;
27
import eu.dnetlib.enabling.datasources.rmi.DatasourceDesc;
28
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerServiceException;
29
import eu.dnetlib.enabling.datasources.rmi.IfaceDesc;
30

  
31
public class DatasourceFunctions {
32

  
33
	private static final Log log = LogFactory.getLog(DatasourceFunctions.class); // NOPMD by marko on 11/24/08 5:02 PM
34

  
35
	private static Resource ifaceTemplate = new ClassPathResource("/eu/dnetlib/enabling/datasources/repo_interface.st");
36

  
37
	public static String buildInterface(final String infopackage) {
38
		final IfaceDesc iface = generateIfaceDesc(infopackage);
39

  
40
		if (iface != null) {
41
			final StringTemplate i = getTemplate(ifaceTemplate);
42
			i.setAttribute("ifc", iface);
43

  
44
			return i.toString();
45
		} else {
46
			return "";
47
		}
48
	}
49

  
50
	public static IfaceDesc generateIfaceDesc(final String infopackage) {
51
		if (infopackage == null || infopackage.trim().isEmpty()) { return null; }
52

  
53
		final IfaceDesc iface = new IfaceDesc();
54
		iface.setId(getValueBetween(infopackage, null, "<==1==>"));
55
		iface.setTypology(getValueBetween(infopackage, "<==1==>", "<==2==>"));
56
		iface.setCompliance(getValueBetween(infopackage, "<==2==>", "<==3==>"));
57
		iface.setContentDescription(getValueBetween(infopackage, "<==3==>", "<==4==>"));
58
		iface.setAccessProtocol(getValueBetween(infopackage, "<==4==>", "<==5==>"));
59
		iface.setActive(Boolean.parseBoolean(getValueBetween(infopackage, "<==5==>", "<==6==>")));
60
		iface.setRemovable(Boolean.parseBoolean(getValueBetween(infopackage, "<==6==>", "<==7==>")));
61

  
62
		final Map<String, String> accessParams = Maps.newHashMap();
63
		final Map<String, String> extraParams = Maps.newHashMap();
64

  
65
		for (String param : parseParams(getValueBetween(infopackage, "<==7==>", null))) {
66

  
67
			final String[] arr = param.split("###");
68

  
69
			if (arr.length == 3) {
70
				final boolean accessParam = Boolean.parseBoolean(arr[0].trim());
71
				final String paramName = arr[1].trim();
72
				final String paramValue = arr.length > 2 ? arr[2].trim() : "";
73

  
74
				if (accessParam) {
75
					if (paramName.equals(DatasourceParams.baseUrl.toString())) {
76
						iface.setBaseUrl(paramValue);
77
					} else {
78
						accessParams.put(paramName, paramValue);
79
					}
80
				} else {
81
					extraParams.put(paramName, paramValue);
82
				}
83
			} else {
84
				log.debug("Invalid Datasource Parameter");
85
			}
86
		}
87

  
88
		iface.setAccessParams(accessParams);
89
		iface.setExtraFields(extraParams);
90

  
91
		return iface;
92
	}
93

  
94
	private static String getValueBetween(final String s, final String pre, final String post) {
95
		if (pre == null && post == null) {
96
			return StringEscapeUtils.escapeXml(s);
97
		} else if (pre == null) {
98
			return StringEscapeUtils.escapeXml(StringUtils.substringBefore(s, post));
99
		} else if (post == null) {
100
			return StringEscapeUtils.escapeXml(StringUtils.substringAfter(s, pre));
101
		} else {
102
			return StringEscapeUtils.escapeXml(StringUtils.substringBetween(s, pre, post));
103
		}
104
	}
105

  
106
	private static Iterable<String> parseParams(final String s) {
107
		return Splitter.on("@@@").omitEmptyStrings().trimResults().split(s);
108
	}
109

  
110
	private static StringTemplate getTemplate(final Resource res) {
111
		try {
112
			return new StringTemplate(IOUtils.toString(res.getInputStream()));
113
		} catch (IOException e) {
114
			log.error("unable to get template", e);
115
			throw new RuntimeException(e);
116
		}
117
	}
118

  
119
	public static String asSqlValue(final String s) {
120
		return s == null ? "NULL" : "'" + StringEscapeUtils.escapeSql(s) + "'";
121
	}
122

  
123
	public static String asSqlValue(final Boolean b) {
124
		return b == null ? "NULL" : b.toString();
125
	}
126

  
127
	private static String asSqlValue(final Double d) {
128
		return d == null ? "NULL" : d.toString();
129
	}
130

  
131
	private static Object asSqlValue(final Date date) {
132
		if (date == null) { return "NULL"; }
133
		final long millis = date.getTime();
134
		final java.sql.Date sqlDate = new java.sql.Date(millis);
135
		return "'" + sqlDate.toString() + "'";
136
	}
137

  
138
	public static boolean verifyCompliance(final Document doc) {
139

  
140
		for (Object o : doc.selectNodes("//INTERFACE")) {
141
			final String compliance = ((Node) o).valueOf("./INTERFACE_EXTRA_FIELD[@name='" + DatasourceConstants.OVERRIDING_COMPLIANCE_FIELD + "']");
142
			if (!StringUtils.isEmpty(compliance)) {
143
				if (!"unknown".equalsIgnoreCase(compliance) && !"notCompatible".equalsIgnoreCase(compliance)) { return true; }
144
			} else {
145
				final String compliance2 = ((Node) o).valueOf("@compliance");
146
				if (!"unknown".equalsIgnoreCase(compliance2) && !"notCompatible".equalsIgnoreCase(compliance2)) { return true; }
147
			}
148
		}
149

  
150
		return false;
151
	}
152

  
153
	@SuppressWarnings("unchecked")
154
	public static DatasourceDesc xmlToDatasourceDesc(final Document doc) throws DatasourceManagerServiceException {
155

  
156
		final DatasourceDesc ds = new DatasourceDesc();
157

  
158
		ds.setId(findValue(doc, "id", String.class));
159
		ds.setOfficialName(findValue(doc, "officialname", String.class));
160
		ds.setEnglishName(findValue(doc, "englishname", String.class));
161
		ds.setWebsiteUrl(findValue(doc, "websiteurl", String.class));
162
		ds.setLogoUrl(findValue(doc, "logourl", String.class));
163
		ds.setCountryCode(findValue(doc, "countrycode", String.class));
164
		ds.setCountryName(findValue(doc, "countryname", String.class));
165
		ds.setOrganization(findValue(doc, "organization", String.class));
166
		ds.setContactEmail(findValue(doc, "contactemail", String.class));
167
		ds.setLatitude(findValue(doc, "latitude", Double.class));
168
		ds.setLongitude(findValue(doc, "longitude", Double.class));
169
		ds.setTimezone(findValue(doc, "timezone", Double.class));
170
		ds.setNamespacePrefix(findValue(doc, "namespaceprefix", String.class));
171
		ds.setOdNumberOfItems(findValue(doc, "od_numberofitems", String.class));
172
		ds.setOdNumberOfItemsDate(findValue(doc, "od_numberofitemsdate", String.class));
173
		ds.setOdPolicies(findValue(doc, "od_policies", String.class));
174
		ds.setOdLanguages(findValue(doc, "od_languages", String.class));
175
		ds.setOdContentTypes(findValue(doc, "od_contenttypes", String.class));
176
		ds.setCollectedFrom(findValue(doc, "collectedfrom", String.class));
177
		ds.setInferred(findValue(doc, "inferred", Boolean.class));
178
		ds.setDeletedByInference(findValue(doc, "deletedbyinference", Boolean.class));
179
		ds.setTrust(findValue(doc, "trust", Double.class));
180
		ds.setInferenceProvenance(findValue(doc, "inferenceprovenance", String.class));
181
		ds.setDateOfValidation(findValue(doc, "dateofvalidation", Date.class));
182
		ds.setRegisteredBy(findValue(doc, "registeredby", String.class));
183
		ds.setDatasourceClass(findValue(doc, "datasourceclass", String.class));
184
		ds.setProvenanceActionClass(findValue(doc, "provenanceactionclass", String.class));
185
		ds.setDateOfCollection(findValue(doc, "dateofcollection", Date.class));
186
		ds.setTypology(findValue(doc, "typology", String.class));
187
		ds.setActivationId(findValue(doc, "activationid", String.class));
188
		ds.setMergehomonyms(findValue(doc, "mergehomonyms", Boolean.class));
189
		ds.setDescription(findValue(doc, "description", String.class));
190
		ds.setReleaseStartDate(findValue(doc, "releasestartdate", Date.class));
191
		ds.setReleaseEndDate(findValue(doc, "releaseenddate", Date.class));
192
		ds.setMissionStatementUrl(findValue(doc, "missionstatementurl", String.class));
193
		ds.setDataProvider(findValue(doc, "dataprovider", Boolean.class));
194
		ds.setServiceProvider(findValue(doc, "serviceprovider", Boolean.class));
195
		ds.setDatabaseAccessType(findValue(doc, "databaseaccesstype", String.class));
196
		ds.setDataUploadType(findValue(doc, "datauploadtype", String.class));
197
		ds.setDatabaseAccessRestriction(findValue(doc, "databaseaccessrestriction", String.class));
198
		ds.setDataUploadRestriction(findValue(doc, "datauploadrestriction", String.class));
199
		ds.setVersioning(findValue(doc, "versioning", Boolean.class));
200
		ds.setCitationGuidelineUrl(findValue(doc, "citationguidelineurl", String.class));
201
		ds.setQualityManagementKind(findValue(doc, "qualitymanagementkind", String.class));
202
		ds.setPidSystems(findValue(doc, "pidsystems", String.class));
203
		ds.setCertificates(findValue(doc, "certificates", String.class));
204
		ds.setAggregator(findValue(doc, "aggregator", String.class));
205
		ds.setIssn(findValue(doc, "issn", String.class));
206
		ds.setEissn(findValue(doc, "eissn", String.class));
207
		ds.setLissn(findValue(doc, "lissn", String.class));
208
		ds.setInterfaces(findValue(doc, "accessinfopackage", List.class));
209

  
210
		return ds;
211
	}
212

  
213
	@SuppressWarnings("unchecked")
214
	private static <T> T findValue(final Document doc, final String elem, final Class<T> clazz) throws DatasourceManagerServiceException {
215

  
216
		if (clazz == List.class) {
217
			if (elem.equalsIgnoreCase("accessinfopackage")) {
218
				final List<IfaceDesc> ifaces = Lists.newArrayList();
219
				for (Object o : doc.selectNodes("//FIELD[@name='accessinfopackage']/ITEM")) {
220
					final IfaceDesc ifaceDesc = generateIfaceDesc(((Node) o).getText());
221
					if (ifaceDesc != null) {
222
						ifaces.add(ifaceDesc);
223
					}
224
				}
225
				return (T) ifaces;
226
			} else {
227
				throw new DatasourceManagerServiceException("Invalid List element " + elem);
228
			}
229
		} else {
230
			final String val = doc.valueOf("//FIELD[@name='" + elem + "' and not(@isNull='true')]");
231

  
232
			if (clazz == String.class) {
233
				return (T) val;
234
			} else if (val == null || val.isEmpty()) {
235
				return null;
236
			} else if (clazz == Boolean.class) {
237
				return (T) new Boolean(val);
238
			} else if (clazz == Double.class) {
239
				return (T) new Double(val);
240
			} else if (clazz == Date.class) {
241
				try {
242
					return (T) new SimpleDateFormat("yyyy-MM-dd").parse(val);
243
				} catch (ParseException e) {
244
					throw new DatasourceManagerServiceException("Invalid date: " + val);
245
				}
246
			} else {
247
				throw new DatasourceManagerServiceException("Invalid type " + clazz + " for element " + elem);
248
			}
249
		}
250

  
251
	}
252

  
253
	public static Map<String, Object> asMapOfSqlValues(final DatasourceDesc ds) {
254
		final Map<String, Object> map = Maps.newHashMap();
255
		map.put("id", asSqlValue(ds.getId()));
256
		map.put("officialName", asSqlValue(ds.getOfficialName()));
257
		map.put("englishName", asSqlValue(ds.getEnglishName()));
258
		map.put("websiteUrl", asSqlValue(ds.getWebsiteUrl()));
259
		map.put("logoUrl", asSqlValue(ds.getLogoUrl()));
260
		map.put("countryCode", asSqlValue(ds.getCountryCode()));
261
		map.put("countryName", asSqlValue(ds.getCountryName()));
262
		map.put("organization", asSqlValue(ds.getOrganization()));
263
		map.put("contactEmail", asSqlValue(ds.getContactEmail()));
264
		map.put("latitude", asSqlValue(ds.getLatitude()));
265
		map.put("longitude", asSqlValue(ds.getLongitude()));
266
		map.put("timezone", asSqlValue(ds.getTimezone()));
267
		map.put("namespacePrefix", asSqlValue(ds.getNamespacePrefix()));
268
		map.put("odNumberOfItems", asSqlValue(ds.getOdNumberOfItems()));
269
		map.put("odNumberOfItemsDate", asSqlValue(ds.getOdNumberOfItemsDate()));
270
		map.put("odPolicies", asSqlValue(ds.getOdPolicies()));
271
		map.put("odLanguages", asSqlValue(ds.getOdLanguages()));
272
		map.put("odContentTypes", asSqlValue(ds.getOdContentTypes()));
273
		map.put("collectedFrom", asSqlValue(ds.getCollectedFrom()));
274
		map.put("inferred", asSqlValue(ds.isInferred()));
275
		map.put("deletedByInference", asSqlValue(ds.isDeletedByInference()));
276
		map.put("trust", asSqlValue(ds.getTrust()));
277
		map.put("inferenceProvenance", asSqlValue(ds.getInferenceProvenance()));
278
		map.put("dateOfValidation", asSqlValue(ds.getDateOfValidation()));
279
		map.put("registeredBy", asSqlValue(ds.getRegisteredBy()));
280
		map.put("datasourceClass", asSqlValue(ds.getDatasourceClass()));
281
		map.put("provenanceActionClass", asSqlValue(ds.getProvenanceActionClass()));
282
		map.put("dateOfCollection", asSqlValue(ds.getDateOfCollection()));
283
		map.put("typology", asSqlValue(ds.getTypology()));
284
		map.put("activationId", asSqlValue(ds.getActivationId()));
285
		map.put("mergehomonyms", asSqlValue(ds.isMergehomonyms()));
286
		map.put("description", asSqlValue(ds.getDescription()));
287
		map.put("releaseStartDate", asSqlValue(ds.getReleaseStartDate()));
288
		map.put("releaseEndDate", asSqlValue(ds.getReleaseEndDate()));
289
		map.put("missionStatementUrl", asSqlValue(ds.getMissionStatementUrl()));
290
		map.put("dataProvider", asSqlValue(ds.isDataProvider()));
291
		map.put("serviceProvider", asSqlValue(ds.isServiceProvider()));
292
		map.put("databaseAccessType", asSqlValue(ds.getDatabaseAccessType()));
293
		map.put("dataUploadType", asSqlValue(ds.getDataUploadType()));
294
		map.put("databaseAccessRestriction", asSqlValue(ds.getDatabaseAccessRestriction()));
295
		map.put("dataUploadRestriction", asSqlValue(ds.getDataUploadRestriction()));
296
		map.put("versioning", asSqlValue(ds.isVersioning()));
297
		map.put("citationGuidelineUrl", asSqlValue(ds.getCitationGuidelineUrl()));
298
		map.put("qualityManagementKind", asSqlValue(ds.getQualityManagementKind()));
299
		map.put("pidSystems", asSqlValue(ds.getPidSystems()));
300
		map.put("certificates", asSqlValue(ds.getCertificates()));
301
		map.put("aggregator", asSqlValue(ds.getAggregator()));
302
		map.put("issn", asSqlValue(ds.getIssn()));
303
		map.put("eissn", asSqlValue(ds.getEissn()));
304
		map.put("lissn", asSqlValue(ds.getLissn()));
305

  
306
		final ArrayList<Map<String, Object>> ifaces = new ArrayList<>();
307

  
308
		if (ds.getInterfaces() != null) {
309

  
310
			for (IfaceDesc iface : ds.getInterfaces()) {
311
				if (iface.getId() != null && !iface.getId().trim().isEmpty()) {
312
					final Map<String, Object> mapIface = Maps.newHashMap();
313

  
314
					mapIface.put("id", asSqlValue(iface.getId()));
315
					mapIface.put("typology", asSqlValue(iface.getTypology()));
316
					mapIface.put("compliance", asSqlValue(iface.getCompliance()));
317
					mapIface.put("contentDescription", asSqlValue(iface.getContentDescription()));
318
					mapIface.put("accessProtocol", asSqlValue(iface.getAccessProtocol()));
319
					mapIface.put("baseUrl", asSqlValue(iface.getBaseUrl()));
320

  
321
					final Map<String, String> extraFields = Maps.newHashMap();
322
					if (iface.getExtraFields() != null) {
323
						for (String k : iface.getExtraFields().keySet()) {
324
							if (k != null && !k.trim().isEmpty()) {
325
								extraFields.put(asSqlValue(k), asSqlValue(iface.getExtraFields().get(k)));
326
							}
327
						}
328
					}
329
					mapIface.put("extraFields", extraFields);
330

  
331
					final Map<String, String> accessParams = Maps.newHashMap();
332
					if (iface.getAccessParams() != null) {
333
						for (String k : iface.getAccessParams().keySet()) {
334
							if (k != null && !k.trim().isEmpty()) {
335
								accessParams.put(asSqlValue(k), asSqlValue(iface.getAccessParams().get(k)));
336
							}
337
						}
338
					}
339
					mapIface.put("accessParams", accessParams);
340

  
341
					ifaces.add(mapIface);
342
				}
343
			}
344

  
345
			map.put("interfaces", ifaces);
346
		}
347

  
348
		return map;
349
	}
350

  
351
	public static Map<String, Object> asMapOfSqlValues(final Map<String, String> input) {
352
		final Map<String, Object> map = Maps.newHashMap();
353
		for (Map.Entry<String, String> e : input.entrySet()) {
354
			map.put(asSqlValue(e.getKey()), asSqlValue(e.getValue()));
355
		}
356
		return map;
357
	}
358

  
359
}
modules/dnet-openaireplus-datasource-manager/branches/dnet45/src/main/java/eu/dnetlib/enabling/datasources/DatasourceManagerClients.java
1
package eu.dnetlib.enabling.datasources;
2

  
3
import java.io.StringReader;
4
import java.text.ParseException;
5
import java.util.Date;
6
import java.util.List;
7
import java.util.Map;
8
import java.util.regex.Pattern;
9

  
10
import javax.xml.ws.wsaddressing.W3CEndpointReference;
11

  
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
import com.google.common.collect.Lists;
24
import com.google.common.collect.Maps;
25

  
26
import eu.dnetlib.enabling.database.rmi.DatabaseException;
27
import eu.dnetlib.enabling.database.rmi.DatabaseService;
28
import eu.dnetlib.enabling.datasources.rmi.DatasourceDesc;
29
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerServiceException;
30
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException;
31
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
32
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
33
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
34
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
35
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory;
36
import eu.dnetlib.miscutils.functional.UnaryFunction;
37
import eu.dnetlib.miscutils.functional.xml.ApplyXslt;
38

  
39
public class DatasourceManagerClients {
40

  
41
	private static final Resource xslt = new ClassPathResource("/eu/dnetlib/enabling/datasources/repo_2_is.xslt");
42
	private static final String REPOSITORY_SERVICE_RESOURCE_TYPE = "RepositoryServiceResourceType";
43
	private static final Log log = LogFactory.getLog(DatasourceManagerClients.class);
44
	private static final String TMPLS_BASEDIR = "/eu/dnetlib/enabling/datasources/";
45
	private String db;
46
	private UniqueServiceLocator serviceLocator;
47
	private ResultSetClientFactory resultSetClientFactory;
48

  
49
	public boolean isManaged(final String dsId) throws DatasourceManagerServiceException {
50
		try {
51

  
52

  
53
			serviceLocator.getService(DatabaseService.class).contains(getDb(), "datasources", "managed", "true");
54

  
55

  
56
			return true;
57
		} catch (final DatabaseException e) {
58
			throw new DatasourceManagerServiceException(e);
59
		}
60
	}
61

  
62
	public String findDatasourceId(final String profileId) throws DatasourceManagerServiceException {
63
		try {
64
			return serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(
65
					"/*[.//RESOURCE_IDENTIFIER/@value='" + profileId + "']//EXTRA_FIELDS/FIELD[./key='OpenAireDataSourceId']/value/text()");
66
		} catch (final Exception e) {
67
			log.error("Error finding dsId of profile " + profileId, e);
68
			throw new DatasourceManagerServiceException("Error finding dsId of profile " + profileId, e);
69
		}
70
	}
71

  
72
	public String getDatasourceProfile(final String dsId) throws DatasourceManagerServiceException {
73
		try {
74
			return serviceLocator.getService(ISLookUpService.class)
75
					.getResourceProfileByQuery(
76
							"collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')/*[.//EXTRA_FIELDS/FIELD[./key='OpenAireDataSourceId']/value/text() = '"
77
									+ dsId + "']");
78
		} catch (final Exception e) {
79
			return null;
80
		}
81
	}
82

  
83
	public boolean deleteProfile(final String dsId) throws DatasourceManagerServiceException {
84
		try {
85
			final SAXReader reader = new SAXReader();
86

  
87
			final String profile = getDatasourceProfile(dsId);
88

  
89
			if (profile != null) {
90
				final Document docOld = reader.read(new StringReader(profile));
91
				final String profId = docOld.valueOf("//RESOURCE_IDENTIFIER/@value");
92
				serviceLocator.getService(ISRegistryService.class).deleteProfile(profId);
93
			}
94
			return true;
95
		} catch (final Exception e) {
96
			log.error("Error deleting profile", e);
97
			throw new DatasourceManagerServiceException("Error deleting profile", e);
98
		}
99
	}
100

  
101
	public boolean regenerateProfile(final String dsId) throws DatasourceManagerServiceException {
102

  
103
		try {
104
			final SAXReader reader = new SAXReader();
105

  
106
			final List<String> list = getTransformedDatasourcesByCondition("ds.id= '" + dsId + "'", new ApplyXslt(xslt));
107

  
108
			if (list.size() != 1) { throw new DatasourceManagerServiceException("Illegal number of datasource with id " + dsId + ", size: " + list.size()); }
109

  
110
			final Document doc = reader.read(new StringReader(list.get(0)));
111

  
112
			final ISRegistryService registry = serviceLocator.getService(ISRegistryService.class);
113

  
114
			final String profile = getDatasourceProfile(dsId);
115

  
116
			if (profile != null) {
117
				final Document docOld = reader.read(new StringReader(profile));
118
				final String profId = docOld.valueOf("//RESOURCE_IDENTIFIER/@value");
119

  
120
				doc.selectSingleNode("//RESOURCE_IDENTIFIER/@value").setText(profId);
121

  
122
				registry.updateProfile(profId, doc.asXML(), REPOSITORY_SERVICE_RESOURCE_TYPE);
123
				log.info("Profile " + profId + " UPDATED for ds " + dsId);
124
			} else {
125
				final String profId = registry.registerProfile(doc.asXML());
126
				log.info("Valid Profile " + profId + " REGISTERED for ds " + dsId);
127
			}
128
			return true;
129
		} catch (final Exception e) {
130
			log.error("Error saving profile, id: " + dsId, e);
131
			throw new DatasourceManagerServiceException("Error regenerating profile", e);
132
		}
133
	}
134

  
135
	public Iterable<String> searchSQL(final String sql) throws DatabaseException {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff