diff --git a/pom.xml b/pom.xml index dd5e15a..4cc0eb1 100644 --- a/pom.xml +++ b/pom.xml @@ -74,8 +74,8 @@ org.gcube.resources registry-publisher - - [1.2.4-SNAPSHOT, 2.0.0-SNAPSHOT) + [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) + diff --git a/src/main/java/org/gcube/application/framework/core/util/GenericResource.java b/src/main/java/org/gcube/application/framework/core/util/GenericResource.java index a5e804f..8b9badf 100644 --- a/src/main/java/org/gcube/application/framework/core/util/GenericResource.java +++ b/src/main/java/org/gcube/application/framework/core/util/GenericResource.java @@ -26,12 +26,12 @@ import org.gcube.application.framework.core.session.SessionManager; import org.gcube.application.framework.core.util.CacheEntryConstants; import org.gcube.application.framework.core.util.QueryString; import org.gcube.application.framework.core.util.SessionConstants; -import org.gcube.common.resources.gcore.Resources; +//import org.gcube.common.resources.gcore.Resources; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.informationsystem.publisher.RegistryPublisher; -import org.gcube.informationsystem.publisher.RegistryPublisherFactory; -import org.gcube.informationsystem.publisher.ScopedPublisher; -import org.gcube.informationsystem.publisher.stubs.registry.faults.PublisherException; +//import org.gcube.informationsystem.publisher.RegistryPublisherFactory; +//import org.gcube.informationsystem.publisher.ScopedPublisher; +//import org.gcube.informationsystem.publisher.stubs.registry.faults.PublisherException; import org.gcube.resources.discovery.client.api.DiscoveryClient; import org.gcube.resources.discovery.client.queries.api.SimpleQuery; import org.w3c.dom.Document; @@ -43,8 +43,8 @@ import org.slf4j.LoggerFactory; import static org.gcube.resources.discovery.icclient.ICFactory.*; -import org.gcube.common.resources.gcore.Resource; -import org.gcube.common.resources.gcore.ServiceInstance; +//import org.gcube.common.resources.gcore.Resource; +//import org.gcube.common.resources.gcore.ServiceInstance; /** @@ -62,7 +62,7 @@ public class GenericResource implements GenericResourceInfoI { // protected static ISPublisher publisher = null; // protected static ISClient client = null; - protected static ScopedPublisher scopedPublisher = null; +// protected static ScopedPublisher scopedPublisher = null; protected static RegistryPublisher publisher = null; protected static DiscoveryClient client = null; @@ -82,7 +82,7 @@ public class GenericResource implements GenericResourceInfoI { session = SessionManager.getInstance().getASLSession(extrenalSessionID, username); try { ScopeProvider.instance.set(session.getScope()); - scopedPublisher = RegistryPublisherFactory.scopedPublisher(); +// scopedPublisher = RegistryPublisherFactory.scopedPublisher(); publisher = RegistryPublisherFactory.create(); } catch (Exception e) { logger.error("Exception:", e); @@ -109,7 +109,7 @@ public class GenericResource implements GenericResourceInfoI { this.session = session; try { ScopeProvider.instance.set(session.getScope()); - scopedPublisher = RegistryPublisherFactory.scopedPublisher(); +// scopedPublisher = RegistryPublisherFactory.scopedPublisher(); publisher = RegistryPublisherFactory.create(); } catch (Exception e) { logger.error("Exception:", e); @@ -316,8 +316,33 @@ public class GenericResource implements GenericResourceInfoI { //maybe should change the visibility (into public) of addScope() within the Resource class of common-gcore-resources package in order to use it here. List scopes=new ArrayList(); scopes.add(session.getScope()); - org.gcube.common.resources.gcore.GenericResource res = scopedPublisher.create(gCubeRes, scopes); - logger.info("Created Generic Resource with id: "+res.id()+" on scope: "+scopes.toString()); + + + + + + + +// org.gcube.common.resources.gcore.GenericResource res = scopedPublisher.create(gCubeRes, scopes); +// logger.info("Created Generic Resource with id: "+res.id()+" on scope: "+scopes.toString()); + + + + + + + + + + + + + + + + + + // 1-oct-2013 -- adding generic resource to cache logger.info("Adding it also in cache..."); diff --git a/src/main/java/org/gcube/application/framework/core/util/RuntimeResource.java b/src/main/java/org/gcube/application/framework/core/util/RuntimeResource.java index 1bc2190..8cc7412 100644 --- a/src/main/java/org/gcube/application/framework/core/util/RuntimeResource.java +++ b/src/main/java/org/gcube/application/framework/core/util/RuntimeResource.java @@ -20,7 +20,7 @@ import org.gcube.common.resources.gcore.ServiceEndpoint; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.informationsystem.publisher.RegistryPublisher; import org.gcube.informationsystem.publisher.RegistryPublisherFactory; -import org.gcube.informationsystem.publisher.ScopedPublisher; +//import org.gcube.informationsystem.publisher.ScopedPublisher; import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException; import org.gcube.resources.discovery.client.api.DiscoveryClient; import org.slf4j.Logger; @@ -32,8 +32,8 @@ public class RuntimeResource { private static final Logger logger = LoggerFactory.getLogger(RuntimeResource.class); - protected static ScopedPublisher scopedPublisher = null; -// protected static RegistryPublisher registryPublisher = null; +// protected static ScopedPublisher scopedPublisher = null; + protected static RegistryPublisher registryPublisher = null; protected static DiscoveryClient client = null; /** @@ -47,8 +47,9 @@ public class RuntimeResource { session = SessionManager.getInstance().getASLSession(extrenalSessionID, username); try { ScopeProvider.instance.set(session.getScope()); - scopedPublisher = RegistryPublisherFactory.scopedPublisher(); -// registryPublisher = RegistryPublisherFactory.create(); + +// scopedPublisher = RegistryPublisherFactory.scopedPublisher(); + registryPublisher = RegistryPublisherFactory.create(); } catch (Exception e) { logger.error("Exception:", e); } @@ -70,8 +71,8 @@ public class RuntimeResource { this.session = session; try { ScopeProvider.instance.set(session.getScope()); - scopedPublisher = RegistryPublisherFactory.scopedPublisher(); -// registryPublisher = RegistryPublisherFactory.create(); +// scopedPublisher = RegistryPublisherFactory.scopedPublisher(); + registryPublisher = RegistryPublisherFactory.create(); } catch (Exception e) { logger.error("Exception:", e); } @@ -93,10 +94,10 @@ public class RuntimeResource { * @throws RemoteException */ public String createRuntimeResource(ServiceEndpoint runtimeResource) throws RegistryNotFoundException { - List scopes = new ArrayList(); - scopes.add(session.getScope()); - ServiceEndpoint se = scopedPublisher.create(runtimeResource, scopes); -// ServiceEndpoint se = registryPublisher.create(runtimeResource); +// List scopes = new ArrayList(); +// scopes.add(session.getScope()); +// ServiceEndpoint se = scopedPublisher.create(runtimeResource, scopes); + ServiceEndpoint se = registryPublisher.create(runtimeResource); logger.debug("Created Runtime Resource with id: "+se.id()+" on scope: "+scopes.toString()); return se.id(); } @@ -109,8 +110,8 @@ public class RuntimeResource { */ public String updateRuntimeResource(ServiceEndpoint runtimeResource) throws RemoteException { try { - ServiceEndpoint se = scopedPublisher.update(runtimeResource); -// ServiceEndpoint se = registryPublisher.update(runtimeResource); +// ServiceEndpoint se = scopedPublisher.update(runtimeResource); + ServiceEndpoint se = registryPublisher.update(runtimeResource); logger.debug("Updated Runtime Resource with id: "+runtimeResource.id()+"\tNew id : "+se.id()); return se.id(); } catch (Exception e) { @@ -129,8 +130,8 @@ public class RuntimeResource { try { List scopes=new ArrayList(); scopes.add(session.getScope()); - ServiceEndpoint se = scopedPublisher.remove(runtimeResource,scopes); -// ServiceEndpoint se = registryPublisher.remove(runtimeResource); +// ServiceEndpoint se = scopedPublisher.remove(runtimeResource,scopes); + ServiceEndpoint se = registryPublisher.remove(runtimeResource); logger.debug("Deleted Runtime Resource with id: "+runtimeResource.id()); return se.id(); } catch (Exception e) {