diff --git a/etc/registrationFactory.xml b/etc/registrationFactory.xml
index d74ba37..a423e0b 100644
--- a/etc/registrationFactory.xml
+++ b/etc/registrationFactory.xml
@@ -38,13 +38,6 @@
registry:MetadataCollection
registry:TransformationProgram
- provider:RI
- provider:ServiceID
- provider:ServiceName
- provider:ServiceClass
- provider:VO
- provider:GHN
- provider:Scope
diff --git a/org/gcube/informationsystem/registry/impl/core/RegistryConfiguration.java b/org/gcube/informationsystem/registry/impl/core/RegistryConfiguration.java
index a55c44f..3d0ad33 100644
--- a/org/gcube/informationsystem/registry/impl/core/RegistryConfiguration.java
+++ b/org/gcube/informationsystem/registry/impl/core/RegistryConfiguration.java
@@ -2,12 +2,25 @@ package org.gcube.informationsystem.registry.impl.core;
/**
*
-* @author Andrea Manzi
+* Local Configuration of the IS-Registry
+*
+* @author Andrea Manzi, Manuele Simi (CNR)
*
*/
public class RegistryConfiguration {
+
+ /** The root service to take care at service's startup */
+ public static enum ROOT_SERVICES {
+ ISIC() {String getName() {return "InformationSystem";} String getClazz() {return "IS-IC";}},
+ ISNOTIFIER() {String getName() {return "InformationSystem";} String getClazz() {return "IS-Notifier";}},
+ GHNMANAGER() {String getName() {return "VREManagement";} String getClazz() {return "GHNManager";}};
+
+ abstract String getName();
+ abstract String getClazz();
+ }
+
/**
*
*/
diff --git a/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java b/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java
index 33c3a60..8789f98 100644
--- a/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java
+++ b/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java
@@ -81,7 +81,9 @@ public class RegistryFactory extends GCUBEStartupPortType{
*/
public static List notificationMap = Collections.synchronizedList(new ArrayList());
-
+ /** the key used to label the Factory Resource */
+ protected static final String NOTIFICATOR_RESOURCE_KEY = "RegistryResource";
+
@Override
protected GCUBEServiceContext getServiceContext() {
return ServiceContext.getContext();
@@ -395,7 +397,7 @@ public class RegistryFactory extends GCUBEStartupPortType{
private RegistryFactoryResource getResource() throws RemoteException {
Object resource = null;
try {
- resource = FactoryContext.getContext().getWSHome().find(FactoryContext.getContext().makeKey("RegistryResource"));
+ resource = FactoryContext.getContext().getWSHome().find(FactoryContext.getContext().makeKey(NOTIFICATOR_RESOURCE_KEY));
} catch (Exception e) {
logger.error(" Unable to access resource", e);
}
diff --git a/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java b/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java
index be4e543..20a0e4c 100644
--- a/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java
+++ b/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java
@@ -13,8 +13,11 @@ import org.globus.wsrf.ResourceException;
/**
*
+ * The RegistryFactoryResource has the role to maintain WS-Topics used to notify changes each time
+ * a GCUBEResource profile is created/removed/updated. A single instance of this class is created within
+ * each instance of the IS-Registry service.
*
- * @author Andrea Manzi
+ * @author Andrea Manzi, Manuele Simi (CNR)
*
*/
public class RegistryFactoryResource extends GCUBEWSResource {
@@ -51,8 +54,7 @@ public class RegistryFactoryResource extends GCUBEWSResource {
@Override
- protected String[] getTopicNames() {
- // TODO Auto-generated method stub
+ protected String[] getTopicNames() {
return RPNames;
}
diff --git a/org/gcube/informationsystem/registry/impl/core/ServiceContext.java b/org/gcube/informationsystem/registry/impl/core/ServiceContext.java
index 9b2fa58..168b6a2 100644
--- a/org/gcube/informationsystem/registry/impl/core/ServiceContext.java
+++ b/org/gcube/informationsystem/registry/impl/core/ServiceContext.java
@@ -10,17 +10,19 @@ import org.gcube.common.core.informationsystem.publisher.ISPublisherException;
import org.gcube.common.core.resources.GCUBEHostingNode;
import org.gcube.common.core.resources.GCUBEResource;
import org.gcube.common.core.resources.GCUBERunningInstance;
+import org.gcube.informationsystem.registry.impl.core.RegistryConfiguration.ROOT_SERVICES;
+
/**
- * IS-Registry service context
+ * IS-Registry service context
+ *
+ * @author Andrea Manzi, Manuele SImi (CNR)
*
- * @author Andrea Manzi (ISTI-CNR)
- *
*/
-public class ServiceContext extends GCUBEServiceContext{
+public class ServiceContext extends GCUBEServiceContext {
+
+ public static final String JNDI_NAME = "gcube/informationsystem/registry";
- public static final String JNDI_NAME="gcube/informationsystem/registry";
-
protected static ServiceContext cache = new ServiceContext();
private ServiceContext() {}
@@ -28,84 +30,80 @@ public class ServiceContext extends GCUBEServiceContext{
public static ServiceContext getContext() {
return cache;
}
+
public String getJNDIName() {
return JNDI_NAME;
}
@Override
- protected void onReady() throws Exception{
-
-
+ protected void onReady() throws Exception {
+
GCUBERunningInstance RegistryRIProfile = null;
GCUBERunningInstance NotifierRIProfile = null;
GCUBERunningInstance ISICRIProfile = null;
-
GCUBERunningInstance GHNManagerProfile = null;
-
+
GCUBEHostingNode ghnProfile = null;
- String ghnName ="";
+ String ghnName = "";
GCUBERIsFromClassAndName queryRI = null;
-
+
GCUBEResourceXPathQuery queryGHN = null;
-
+
boolean isNotifierCodeployed = false;
- boolean isICCodeployed =false;
-
+ boolean isICCodeployed = false;
+
ISClient client = null;
-
-// create GeneralQueryManager
+ //creates the single RegistryResource used to raise notifications about profiles' changes
+ FactoryContext.getContext().getWSHome().create(
+ FactoryContext.getContext().makeKey(RegistryFactory.NOTIFICATOR_RESOURCE_KEY));
+
+ // create GeneralQueryManager
try {
- client = GHNContext.getImplementation(ISClient.class);
+ client = GHNContext.getImplementation(ISClient.class);
queryRI = client.getQuery(GCUBERIsFromClassAndName.class);
queryGHN = client.getQuery(GCUBEResourceXPathQuery.class);
- }catch (Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
-
-
try {
- RegistryRIProfile= ServiceContext.getContext().getInstance();
+ RegistryRIProfile = ServiceContext.getContext().getInstance();
} catch (Exception e) {
e.printStackTrace();
}
try {
- NotifierRIProfile= GHNContext.getContext().getServiceContext("InformationSystem", "IS-Notifier").getInstance();
- isNotifierCodeployed= true;
+ NotifierRIProfile = GHNContext.getContext().getServiceContext(
+ ROOT_SERVICES.ISNOTIFIER.getClazz(), ROOT_SERVICES.ISNOTIFIER.getName()).getInstance();
+ isNotifierCodeployed = true;
} catch (Exception e) {
e.printStackTrace();
}
try {
- GHNManagerProfile= GHNContext.getContext().getServiceContext("VREManagement", "GHNManager").getInstance();
+ GHNManagerProfile = GHNContext.getContext().getServiceContext(ROOT_SERVICES.GHNMANAGER.getClazz(), ROOT_SERVICES.GHNMANAGER.getName()).getInstance();
} catch (Exception e) {
e.printStackTrace();
}
-
try {
- ISICRIProfile=GHNContext.getContext().getServiceContext("InformationSystem", "IS-IC").getInstance();
+ ISICRIProfile = GHNContext.getContext().getServiceContext( ROOT_SERVICES.ISIC.getClazz(), ROOT_SERVICES.ISIC.getName()).getInstance();
isICCodeployed = true;
} catch (Exception e) {
e.printStackTrace();
}
-
-
try {
- ghnProfile=GHNContext.getContext().getGHN();
-
- ghnName=ghnProfile.getNodeDescription().getName();
-
+ ghnProfile = GHNContext.getContext().getGHN();
+ ghnName = ghnProfile.getNodeDescription().getName();
} catch (Exception e) {
e.printStackTrace();
}
@@ -117,64 +115,69 @@ public class ServiceContext extends GCUBEServiceContext{
e1.printStackTrace();
}
- //Check if the Registry profile is alerady registered
+ // Check if the Registry profile is alerady registered
try {
-
- queryRI.setEntryName( "gcube/informationsystem/registry/RegistryFactory");
- queryRI.setResourceClass("InformationSystem");
- queryRI.setResourceName("IS-Registry");
- if (client.execute(queryRI, GHNContext.getContext().getDefaultScope()).size()==0) registerProfile(RegistryRIProfile,GCUBERunningInstance.TYPE);
-
-
-
+ // registers the my profile
+ queryRI.setEntryName("gcube/informationsystem/registry/RegistryFactory");
+ queryRI.setResourceClass(this.getServiceClass());
+ queryRI.setResourceName(this.getName());
+ if (client.execute(queryRI,
+ GHNContext.getContext().getDefaultScope()).size() == 0)
+ registerProfile(RegistryRIProfile, GCUBERunningInstance.TYPE);
+
+ // registers the local IS-Notifier profile
if (isNotifierCodeployed) {
- queryRI.setEntryName( "gcube/informationsystem/notifier/Notifier");
- queryRI.setResourceClass("InformationSystem");
- queryRI.setResourceName("IS-Notifier");
- if (client.execute(queryRI, GHNContext.getContext().getDefaultScope()).size()==0) registerProfile(NotifierRIProfile,GCUBERunningInstance.TYPE);
+ queryRI.setEntryName("gcube/informationsystem/notifier/Notifier");
+ queryRI.setResourceClass(ROOT_SERVICES.ISNOTIFIER.getClazz());
+ queryRI.setResourceName(ROOT_SERVICES.ISNOTIFIER.getName());
+ if (client.execute(queryRI,
+ GHNContext.getContext().getDefaultScope()).size() == 0)
+ registerProfile(NotifierRIProfile, GCUBERunningInstance.TYPE);
}
+ // registers the local IS-IC profile
if (isICCodeployed) {
- queryRI.setEntryName( "gcube/informationsystem/isic/ISICFactoryService");
- queryRI.setResourceClass("InformationSystem");
- queryRI.setResourceName("IS-IC");
- if (client.execute(queryRI, GHNContext.getContext().getDefaultScope()).size()==0) registerProfile(ISICRIProfile,GCUBERunningInstance.TYPE);
+ queryRI.setEntryName("gcube/informationsystem/isic/ISICFactoryService");
+ queryRI.setResourceClass(ROOT_SERVICES.ISIC.getClazz());
+ queryRI.setResourceName(ROOT_SERVICES.ISIC.getName());
+ if (client.execute(queryRI, GHNContext.getContext().getDefaultScope()).size() == 0)
+ registerProfile(ISICRIProfile, GCUBERunningInstance.TYPE);
}
-
-
-
+ // registers the local GHNManager profile
queryGHN.setResourceType(GCUBEHostingNode.TYPE);
- queryGHN.setXPath("/GHNDescription/Name/string() eq '" + ghnName + "'");
- if (client.execute(queryGHN, GHNContext.getContext().getDefaultScope()).size()==0) registerProfile(ghnProfile,GCUBEHostingNode.TYPE);
-
- }catch (Exception e) {
+ queryGHN.setXPath("/GHNDescription/Name/string() eq '" + ghnName + "'");
+ if (client.execute(queryGHN, GHNContext.getContext().getDefaultScope()).size() == 0)
+ registerProfile(ghnProfile, GCUBEHostingNode.TYPE);
+
+ } catch (Exception e) {
e.printStackTrace();
}
-
-
- }
-
- @Override
- protected void onInitialisation() throws Exception {
- FactoryContext.getContext().getWSHome().create(FactoryContext.getContext().makeKey("RegistryResource"));
}
+ @Override
+ protected void onInitialisation() throws Exception {
+
+ }
/**
- * Register the Profile
+ * Register the Profile
*
- * @param resource teh gCUBEResource
- * @param type The profile Type
- * @throws Exception
- * @throws ISPublisherException
+ * @param resource
+ * teh gCUBEResource
+ * @param type
+ * The profile Type
+ * @throws Exception
+ * @throws ISPublisherException
*/
- private void registerProfile(GCUBEResource resource,String type) throws ISPublisherException, Exception {
- GHNContext.getImplementation(ISPublisher.class).registerGCUBEResource(resource, GHNContext.getContext().getDefaultScope(), ServiceContext.getContext());
-
+ private void registerProfile(GCUBEResource resource, String type)
+ throws ISPublisherException, Exception {
+ if (GHNContext.getContext().getMode() == GHNContext.Mode.ROOT)
+ GHNContext.getImplementation(ISPublisher.class).registerGCUBEResource(
+ resource, GHNContext.getContext().getDefaultScope(),
+ ServiceContext.getContext());
}
-
}
\ No newline at end of file