Project

General

Profile

« Previous | Next » 

Revision 47406

moved to dnet45

View differences:

modules/uoa-clients/trunk/deploy.info
1 1
{
2 2
  "type_source": "SVN", 
3 3
  "goal": "package -U -T 4C source:jar", 
4
  "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-clients/trunk", 
5
  "deploy_repository": "dnet4-snapshots", 
4
  "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/uoa-clients/trunk", 
5
  "deploy_repository": "dnet45-snapshots", 
6 6
  "version": "4", 
7 7
  "mail": "antleb@di.uoa.gr, kiatrop@di.uoa.gr", 
8
  "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", 
8
  "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", 
9 9
  "name": "uoa-clients"
10
}
10
}
modules/uoa-clients/trunk/src/main/java/eu/dnetlib/clients/enabling/database/ws/DatabaseServiceClient.java
17 17
	private eu.dnetlib.enabling.database.rmi.DatabaseService dbService;
18 18

  
19 19
	@Override
20
	public boolean importFromEPR(String db, EPR epr, String xslt) {
20
	public void importFromEPR(String db, EPR epr, String xslt) {
21 21
		try {
22
			return dbService
23
					.importFromEPR(db, EPRUtils.createW3CEPR(epr), xslt);
22
			dbService.importFromEPR(db, EPRUtils.createW3CEPR(epr), xslt);
23

  
24 24
		} catch (Exception e) {
25 25
			logger.error("Error importing from epr", e);
26

  
27
			return false;
28 26
		}
29 27
	}
30 28

  
modules/uoa-clients/trunk/src/main/java/eu/dnetlib/clients/enabling/islookup/ws/ISLookUpClient.java
29 29
		this.isLookUp = (eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService) webService;
30 30
	}
31 31

  
32
	public EPR searchProfile(String XQuery) throws ISLookUpServiceException {
33
		try {
34
			logger.debug("Performing search: " + XQuery);
35
			
36
			W3CEndpointReference endpointReference = isLookUp
37
					.searchProfile(XQuery);
38

  
39
			return createEPR(endpointReference);
40
		} catch (ISLookUpException e) {
41
			logger.error(e);
42
			
43
			throw new ISLookUpServiceException(e);
44
		} catch (Exception e) {
45
			logger.error(e);
46
			
47
			throw new ISLookUpServiceException("Error performing search");
48
		}
49
	}
50

  
51 32
	public List<String> quickSearchProfile(String XQuery)
52 33
			throws ISLookUpServiceException {
53 34
		try {
......
124 105
		// return isLookUp.identify();
125 106
	}
126 107

  
127
	private EPR createEPR(W3CEndpointReference endpointReference) {
128
		return EPRUtils.createEPR(endpointReference);
129
	}
130

  
131 108
	@Override
132 109
	public void notify(Notification notification) {
133 110
		// TODO Auto-generated method stub
modules/uoa-clients/trunk/src/main/java/eu/dnetlib/clients/enabling/actionmanager/ws/ActionManagerServiceClient.java
32 32
	}
33 33

  
34 34
	@Override
35
	public String createAction(String splitRuleId, String set, Agent agent,
36
			Operation operation, String infoPackage, Provenance provenance,
37
			String trust, String nsprefix) throws ActionManagerException {
38
		return service.createAction(splitRuleId, set, agent, operation, infoPackage, provenance, trust, nsprefix);
35
	public boolean deleteSet(String setId) throws ActionManagerException {
36
		return service.deleteSet(setId);
39 37
	}
40 38

  
41 39
	@Override
42
	public String updateAction(String actionId, String splitRuleId, String set,
43
			Agent agent, Operation operation, String infoPackage,
44
			Provenance provenance, String trust, String nsprefix)
45
			throws ActionManagerException {
46
		return service.updateAction(actionId, splitRuleId, set, agent, operation, infoPackage, provenance, trust, nsprefix);
47
	}
48

  
49
	@Override
50
	public boolean deleteAction(String actionId) throws ActionManagerException {
51
		return service.deleteAction(actionId);
52
	}
53

  
54
	@Override
55
	public List<String> getActionsByAgent(String agentId, int limit)
56
			throws ActionManagerException {
57
		return service.getActionsByAgent(agentId, limit);
58
	}
59

  
60
	@Override
61 40
	public ServiceIdentity identify() {
62 41
		return null;
63 42
	}
modules/uoa-clients/trunk/src/main/java/eu/dnetlib/clients/utils/ws/CompatibilityServiceLocatorFactory.java
1 1
package eu.dnetlib.clients.utils.ws;
2 2

  
3 3
//import deltix.qsrv.comm.xml.ThrowableTransientAnnotationReaderBuilder;
4

  
4 5
import eu.dnetlib.api.DriverService;
5
import eu.dnetlib.api.DriverServiceEndpoint;
6 6
import eu.dnetlib.api.enabling.A2Service;
7
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
8
import eu.dnetlib.enabling.tools.DynamicServiceLocator;
9
import eu.dnetlib.enabling.tools.DynamicServiceLocatorLocationScorer;
7
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
10 8
import eu.dnetlib.enabling.tools.ServiceResolver;
11 9
import eu.dnetlib.enabling.tools.registration.ServiceNameResolver;
12 10
import eu.dnetlib.soap.cxf.StandaloneCxfEndpointReferenceBuilder;
......
16 14
import gr.uoa.di.driver.util.RefreshingServiceLocator;
17 15
import gr.uoa.di.driver.util.ServiceLocator;
18 16
import gr.uoa.di.driver.util.ServiceLocatorFactory;
17
import org.apache.log4j.Logger;
19 18

  
20 19
import java.util.Map;
21 20
import java.util.concurrent.Executors;
22 21
import java.util.concurrent.ScheduledExecutorService;
23 22

  
24
import org.apache.log4j.Logger;
25

  
26 23
/**
27 24
 * This is an implementation of ServiceLocatorFactory for web service transport
28 25
 * layer. This implementation assumes that all service interfaces are part of
29 26
 * the DriverService hierarchy, but does not require that the web service
30 27
 * interfaces belong to the DriverWebService hierarchy.
31 28
 * 
32
 * This implementation is created for dnet1.1, where there is no common API for
29
 * This implementation is created for dnet45, where there is no common API for
33 30
 * all partners and the only transport layer is SOAP based for all services.
34 31
 * 
35 32
 * @author <a href="mailto:antleb@di.uoa.gr">Antonis Lempesis</a>
......
43 40
	private Map<Class<?>, ServiceClientFactory<?>> clientMap = null;
44 41
	private CompatibilityEndpointResolver endpointResolver = null;
45 42
	private StandaloneCxfEndpointReferenceBuilder eprBuilder = null;
46
	private eu.dnetlib.enabling.tools.ServiceLocator<ISLookUpService> lookUpLocator = null;
47
	private DynamicServiceLocatorLocationScorer scorer = null;
48 43
	private ServiceNameResolver serviceNameResolver = null;
49 44
	private ServiceResolver serviceResolver = null;
50 45
	private ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
51 46
	private long locatorRefreshPeriod = 5*60*1000; // 5 minutes
52 47

  
48
	private UniqueServiceLocator serviceLocator = null;
49

  
53 50
	public void init() {
54 51
		logger.debug("Init...");
55 52
	}
......
106 103
	private <S extends DriverService> ServiceLocator<S> newDynamicServiceLocator(
107 104
			Class<S> serviceClass) {
108 105
		CompatibilityServiceLocator<S> locator = new CompatibilityServiceLocator<S>();
109
		DynamicServiceLocator<DriverServiceEndpoint<S>> serviceLocator = 
110
				new DynamicServiceLocator<DriverServiceEndpoint<S>>();
111

  
112
		serviceLocator.setClazz((Class<DriverServiceEndpoint<S>>) configuration.getEndpointClass(serviceClass));
113
		serviceLocator.setEprBuilder(eprBuilder);
114
		serviceLocator.setLookUpLocator(lookUpLocator);
115
		serviceLocator.setScorer(scorer);
116
		serviceLocator.setServiceNameResolver(serviceNameResolver);
117
		serviceLocator.setServiceResolver(serviceResolver);
118
		
119
		
120 106
		ServiceClientFactory<S> clientFactory = (ServiceClientFactory<S>) clientMap.get(serviceClass);
121 107

  
122 108
		locator.setClientFactory(clientFactory);
123 109
		locator.setServiceClass(serviceClass);
124
		locator.setServiceLocator(serviceLocator);
110
		locator.setServiceLocator(this.serviceLocator);
125 111

  
126 112
		return locator;
127 113
	}
128 114

  
129
/*	private ServiceLocator<A2Service> newA2ServiceLocator(String serviceUrl) {
130
		// get the endpoint
131
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
132
		factory.setServiceClass(eu.dnetlib.enabling.aas.rmi.A2Service.class);
133
		factory.setAddress(serviceUrl);
134

  
135
		// annotation reader support required to handle A2Error's stacktrace
136
		JAXBDataBinding dataBinding = new JAXBDataBinding();
137
		Map<String, Object> contextProperties = new HashMap<String, Object>();
138

  
139
		try {
140
			contextProperties.put(
141
					com.sun.xml.bind.api.JAXBRIContext.ANNOTATION_READER,
142
					new ThrowableTransientAnnotationReaderBuilder()
143
							.buildInstance());
144
		} catch (Exception e) {
145
			throw new RuntimeException(e);
146
		}
147

  
148
		dataBinding.setContextProperties(contextProperties);
149
		factory.setDataBinding(dataBinding);
150

  
151
		eu.dnetlib.enabling.aas.rmi.A2Service endpoint = (eu.dnetlib.enabling.aas.rmi.A2Service) factory
152
				.create();
153

  
154
		// create the client
155
		AASClient client = new AASClient();
156

  
157
		client.setA2Service(endpoint);
158

  
159
		StaticServiceLocator<A2Service> locator = new StaticServiceLocator<A2Service>(client);
160

  
161
		return locator;
162
	}
163
*/
164 115
	public StandaloneCxfEndpointReferenceBuilder getEprBuilder() {
165 116
		return eprBuilder;
166 117
	}
......
169 120
		this.eprBuilder = eprBuilder;
170 121
	}
171 122

  
172
	public eu.dnetlib.enabling.tools.ServiceLocator<ISLookUpService> getLookUpLocator() {
173
		return lookUpLocator;
174
	}
175 123

  
176
	public void setLookUpLocator(
177
			eu.dnetlib.enabling.tools.ServiceLocator<ISLookUpService> lookUpLocator) {
178
		this.lookUpLocator = lookUpLocator;
179
	}
180

  
181
	public DynamicServiceLocatorLocationScorer getScorer() {
182
		return scorer;
183
	}
184

  
185
	public void setScorer(DynamicServiceLocatorLocationScorer scorer) {
186
		this.scorer = scorer;
187
	}
188

  
189 124
	public ServiceNameResolver getServiceNameResolver() {
190 125
		return serviceNameResolver;
191 126
	}
......
225 160
	public void setClientMap(Map<Class<?>, ServiceClientFactory<?>> clientMap) {
226 161
		this.clientMap = clientMap;
227 162
	}
163

  
164
	public UniqueServiceLocator getServiceLocator() {
165
		return serviceLocator;
166
	}
167

  
168
	public void setServiceLocator(UniqueServiceLocator serviceLocator) {
169
		this.serviceLocator = serviceLocator;
170
	}
228 171
}
modules/uoa-clients/trunk/src/main/java/eu/dnetlib/clients/utils/ws/CompatibilityServiceLocator.java
1 1
package eu.dnetlib.clients.utils.ws;
2 2

  
3
import eu.dnetlib.common.rmi.BaseService;
4
import eu.dnetlib.enabling.is.store.rmi.ISStoreService;
5
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
6
import eu.dnetlib.utils.resolver.TransportConfiguration;
3 7
import org.apache.log4j.Logger;
4 8

  
5 9
import eu.dnetlib.api.DriverService;
......
23 27
public class CompatibilityServiceLocator<S extends DriverService> implements
24 28
		ServiceLocator<S> {
25 29

  
26
	private static Logger logger = Logger
27
			.getLogger(CompatibilityServiceLocator.class);
30
	private static Logger logger = Logger.getLogger(CompatibilityServiceLocator.class);
28 31

  
29
	/**
30
	 * The CNR service locator. It is not bounded because the endpoints do not
31
	 * follow the DriverWebService hierarchy.
32
	 */
33
	private eu.dnetlib.enabling.tools.ServiceLocator<?> serviceLocator = null;
32
	private UniqueServiceLocator serviceLocator;
34 33

  
35 34
	/** The service class */
36 35
	private Class<S> serviceClass = null;
37 36

  
37
	TransportConfiguration transportConfiguration = null;
38

  
38 39
	/** The factory used to create service clients */
39 40
	private ServiceClientFactory<S> clientFactory = null;
40 41

  
......
45 46
		S service = null;
46 47

  
47 48
		try {
48
			Object endpoint = serviceLocator.getService();
49
			Class<? extends BaseService> endpointClass =  (Class<? extends BaseService>) transportConfiguration.getEndpointClass(serviceClass);
49 50

  
51
			Object endpoint = serviceLocator.getService(ISStoreService.class);
52

  
50 53
			logger.debug("Found service endpoint of type: "
51 54
					+ endpoint.getClass().getName());
52 55

  
......
58 61
		return service;
59 62
	}
60 63

  
61
	public eu.dnetlib.enabling.tools.ServiceLocator<?> getServiceLocator() {
64
	public UniqueServiceLocator getServiceLocator() {
62 65
		return serviceLocator;
63 66
	}
64 67

  
65
	public void setServiceLocator(
66
			eu.dnetlib.enabling.tools.ServiceLocator<?> serviceLocator) {
68
	public void setServiceLocator(UniqueServiceLocator serviceLocator) {
67 69
		this.serviceLocator = serviceLocator;
68 70
	}
69 71

  
modules/uoa-clients/trunk/src/main/resources/eu/dnetlib/clients/ws/springContext-locatorFactory.xml
13 13
	<bean id="serviceLocatorFactory" class="eu.dnetlib.clients.utils.ws.CompatibilityServiceLocatorFactory" init-method="init" lazy-init="true">
14 14
		<property name="clientMap" ref="serviceClientFactoryMap" />
15 15
		<property name="eprBuilder" ref="cxfEndpointReferenceBuilder" />
16
		<property name="lookUpLocator" ref="cnr.lookUpLocator" />
17
		<property name="scorer" ref="locatorScorer" />
18 16
		<property name="serviceNameResolver" ref="compatServiceNameResolver" />
19 17
		<property name="serviceResolver" ref="cnr.serviceResolver" />
20 18
		<property name="configuration" ref="transportConfiguration" />
21
		<property name="endpointResolver" ref="serviceResolver" />
19
		<property name="endpointResolver" ref="endpointResolver" />
22 20
	</bean>
21

  
22
	<bean id="cnr.uniqueServiceLocator" class="eu.dnetlib.enabling.locators.DefaultUniqueServiceLocator">
23
		<property name="defaultComparator" >
24
			<bean class="eu.dnetlib.enabling.locators.comparators.PreferLocalRunningInstanceComparator" />
25
		</property>
26
		<property name="serviceNameResolver" ref="compatServiceNameResolver"/>
27
		<property name="isLookupService" ref="cnr.lookUpService"/>
28

  
29
	</bean>
23 30
	
24
	<bean name="serviceResolver" class="eu.dnetlib.clients.utils.ws.CompatibilityEndpointResolver">
31
	<bean name="endpointResolver" class="eu.dnetlib.clients.utils.ws.CompatibilityEndpointResolver">
25 32
		<property name="config" ref="transportConfiguration" />
26 33
		<property name="clientFactoryMap" ref="serviceClientFactoryMap" />
27 34
		<property name="serviceResolver" ref="cnr.serviceResolver" />
......
40 47
		 </map>
41 48
		</property>
42 49
	</bean>
43
	
50

  
51
	<!--<bean id="serviceResolver" class="Compa"-->
52

  
53
	<alias name="cnr.serviceResolver" alias="serviceResolver"/>
54

  
44 55
	<bean name="cnr.serviceResolver" class="eu.dnetlib.enabling.tools.JaxwsServiceResolverImpl" />
45
	
46
	<bean id="locatorScorer" class="eu.dnetlib.enabling.tools.DefaultServiceLocatorLocationScorer" >
47
		<property name="eprBuilder" ref="cxfEndpointReferenceBuilder" />
48
	</bean>
49 56

  
50 57
	<util:map id="serviceClientFactoryMap">
51 58
		<entry key="eu.dnetlib.api.enabling.A2Service">
......
252 259
				<entry key="eu.dnetlib.api.data.IndexService" value="eu.dnetlib.functionality.index.client.IndexClient" /> 
253 260
				<entry key="eu.dnetlib.api.data.PublisherService" value="eu.dnetlib.data.information.publisher.rmi.PublisherService" />
254 261
				<entry key="eu.dnetlib.api.data.SearchService" value="eu.dnetlib.clients.data.search.ws.SearchWebService" />
255
<!-- 				<entry key="eu.dnetlib.api.data.SimilarityService" value="eu.dnetlib.data.information.similarity.ISimilarityService"/> -->
256 262
				<entry key="eu.dnetlib.api.data.DatasourceManagerService" value="eu.dnetlib.enabling.datasources.rmi.DatasourceManagerService"/>
257 263
				<entry key="eu.dnetlib.api.data.MDStoreService" value="eu.dnetlib.data.mdstore.MDStoreService"/>
258 264
				<entry key="eu.dnetlib.api.data.StatsManagerService" value="eu.dnetlib.clients.data.statsmanager.ws.StatsManagerWebService"/>
259
<!-- 				<entry key="eu.dnetlib.api.enabling.A2Service" value="eu.dnetlib.enabling.aas.rmi.A2Service" /> -->
260 265
				<entry key="eu.dnetlib.api.enabling.HostingContextManagerService" value="eu.dnetlib.clients.enabling.hcm.ws.HostingContextManagerWebService" />
261 266
				<entry key="eu.dnetlib.api.enabling.HostingNodeManagerService" value="eu.dnetlib.clients.enabling.hnm.ws.HostingNodeManagerWebService" />
262 267
				<entry key="eu.dnetlib.api.enabling.ISLookUpService" value="eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService" />
modules/uoa-clients/trunk/pom.xml
2 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 3
	<parent>
4 4
		<groupId>eu.dnetlib</groupId>
5
		<artifactId>dnet-parent</artifactId>
5
		<artifactId>dnet45-parent</artifactId>
6 6
		<version>1.0.0-SNAPSHOT</version>
7 7
	</parent>
8 8
	<modelVersion>4.0.0</modelVersion>
9 9
	<groupId>eu.dnetlib</groupId>
10 10
	<artifactId>uoa-clients</artifactId>
11 11
	<packaging>jar</packaging>
12
	<version>1.2.1-SNAPSHOT</version>
12
	<version>2.0.0-SNAPSHOT</version>
13 13
	<scm>
14
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-clients/trunk</developerConnection>
14
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/uoa-clients/trunk</developerConnection>
15 15
	</scm>
16 16
	<dependencies>
17 17
		<dependency>
18 18
			<groupId>eu.dnetlib</groupId>
19 19
			<artifactId>uoa-domain</artifactId>
20
			<version>[1.2.0, 1.3.0-SNAPSHOT)</version>
20
			<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
21 21
		</dependency>
22 22
		<dependency>
23 23
			<groupId>eu.dnetlib</groupId>
24 24
			<artifactId>uoa-api</artifactId>
25
			<version>[1.2.0, 1.3.0-SNAPSHOT)</version>
25
			<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
26 26
		</dependency>
27 27
		<dependency>
28 28
			<groupId>eu.dnetlib</groupId>
29 29
			<artifactId>uoa-commons</artifactId>
30
			<version>[1.2.0, 1.3.0-SNAPSHOT)</version>
30
			<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
31 31
		</dependency>
32 32
		<dependency>
33 33
			<groupId>eu.dnetlib</groupId>
34 34
			<artifactId>cnr-rmi-api</artifactId>
35
			<version>[2.3.0]</version>
35
			<version>2.6.1-SNAPSHOT</version>
36 36
		</dependency>
37 37
		<dependency>
38 38
			<groupId>eu.dnetlib</groupId>
39 39
			<artifactId>dnet-datasource-manager-rmi</artifactId>
40
			<version>[4.0.0]</version>
40
			<version>[4.0.1-SNAPSHOT]</version>
41 41
		</dependency>
42 42
		<dependency>
43 43
			<groupId>eu.dnetlib</groupId>
44 44
			<artifactId>cnr-enabling-database-api</artifactId>
45
			<version>[1.0.0]</version>
45
			<version>[2.1.1-SNAPSHOT]</version>
46 46
		</dependency>
47 47
		<dependency>
48 48
			<groupId>eu.dnetlib</groupId>
49 49
			<artifactId>cnr-service-common</artifactId>
50
			<version>[1.0.0]</version>
50
			<version>[2.1.6-SNAPSHOT]</version>
51 51
		</dependency>
52 52
		<dependency>
53 53
			<groupId>eu.dnetlib</groupId>
54 54
			<artifactId>cnr-spring-utils</artifactId>
55
			<version>[1.0.0]</version>
55
			<version>[1.0.1-SNAPSHOT]</version>
56 56
		</dependency>
57 57
		<dependency>
58 58
			<groupId>eu.dnetlib</groupId>
59 59
			<artifactId>dnet-index-client</artifactId>
60
			<version>[1.1.0]</version>
60
			<version>[2.3.1-SNAPSHOT]</version>
61 61
		</dependency>
62 62
	</dependencies>
63 63
</project>

Also available in: Unified diff