git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@11634 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5583dc080b
commit
fffd2fd2b3
|
@ -4,6 +4,7 @@
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/GCORELIBS"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/GCORELIBS"/>
|
||||||
<classpathentry kind="lib" path="/home/lucio/workspace/Dependencies/ISREGISTRY/org.gcube.informationsystem.registry.stubs.jar"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/DISTRO.RESOURCES"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/GCUBE_CORE"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
2
.project
2
.project
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>Registry</name>
|
<name>Registry_branched</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<Main>
|
<Main>
|
||||||
<Description>IS-Registry: validate, register and unregister GCUBE resources to/from the IS. It also publishes Topics for notifications about GCUBE resource events</Description>
|
<Description>IS-Registry: validate, register and unregister GCUBE resources to/from the IS. It also publishes Topics for notifications about GCUBE resource events</Description>
|
||||||
<Name>IS-Registry-service</Name>
|
<Name>IS-Registry-service</Name>
|
||||||
<Version>1.1.3</Version>
|
<Version>1.2.0</Version>
|
||||||
<Mandatory level="VO"/>
|
<Mandatory level="VO"/>
|
||||||
<Shareable level="VO"/>
|
<Shareable level="VO"/>
|
||||||
<GHNRequirements>
|
<GHNRequirements>
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package org.gcube.informationsystem.registry.impl;
|
package org.gcube.informationsystem.registry.impl;
|
||||||
|
|
||||||
import org.apache.axis.utils.XMLUtils;
|
import org.apache.axis.utils.XMLUtils;
|
||||||
|
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
|
import org.gcube.common.core.porttypes.GCUBEPortType;
|
||||||
import org.gcube.informationsystem.registry.impl.contexts.ProfileContext;
|
import org.gcube.informationsystem.registry.impl.contexts.ProfileContext;
|
||||||
|
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||||
import org.gcube.informationsystem.registry.impl.state.ProfileResource;
|
import org.gcube.informationsystem.registry.impl.state.ProfileResource;
|
||||||
import org.gcube.informationsystem.registry.stubs.GetProfileString;
|
import org.gcube.informationsystem.registry.stubs.GetProfileString;
|
||||||
|
|
||||||
|
@ -13,7 +16,7 @@ import org.gcube.informationsystem.registry.stubs.GetProfileString;
|
||||||
* @author Manuele Simi (CNR)
|
* @author Manuele Simi (CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Registry {
|
public class Registry extends GCUBEPortType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string representation of the profile
|
* Gets a string representation of the profile
|
||||||
|
@ -30,4 +33,9 @@ public class Registry {
|
||||||
throw new GCUBEFault();
|
throw new GCUBEFault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GCUBEServiceContext getServiceContext() {
|
||||||
|
return ServiceContext.getContext();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,9 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.axis.components.uuid.UUIDGen;
|
import org.apache.axis.components.uuid.UUIDGen;
|
||||||
import org.apache.axis.components.uuid.UUIDGenFactory;
|
import org.apache.axis.components.uuid.UUIDGenFactory;
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
import org.gcube.common.core.porttypes.GCUBEPortType;
|
||||||
import org.gcube.common.core.informationsystem.client.XMLResult;
|
|
||||||
import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
|
|
||||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||||
import org.gcube.common.core.resources.GCUBEResource;
|
import org.gcube.common.core.resources.GCUBEResource;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
|
@ -55,7 +53,7 @@ import static org.gcube.informationsystem.registry.impl.core.RegistryConfigurati
|
||||||
* @author Andrea Manzi, Manuele Simi (ISTI-CNR)
|
* @author Andrea Manzi, Manuele Simi (ISTI-CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RegistryFactory{
|
public class RegistryFactory extends GCUBEPortType {
|
||||||
|
|
||||||
private final long delayRemoveTyme= 120000;
|
private final long delayRemoveTyme= 120000;
|
||||||
|
|
||||||
|
@ -175,7 +173,7 @@ public class RegistryFactory{
|
||||||
logger.debug(resource.getID()+" Creating the stateful resource for " + resource.getID());
|
logger.debug(resource.getID()+" Creating the stateful resource for " + resource.getID());
|
||||||
|
|
||||||
ProfileResource presource = (ProfileResource) ProfileContext.getContext().getWSHome().create(ProfileContext.getContext().makeKey(resource.getID()),resource);
|
ProfileResource presource = (ProfileResource) ProfileContext.getContext().getWSHome().create(ProfileContext.getContext().makeKey(resource.getID()),resource);
|
||||||
presource.getPersistenceDelegate().store(presource);
|
presource.store();
|
||||||
|
|
||||||
//Deleting the WSResource created
|
//Deleting the WSResource created
|
||||||
long timestamp;
|
long timestamp;
|
||||||
|
@ -426,7 +424,6 @@ public class RegistryFactory{
|
||||||
* @throws Exception Exception
|
* @throws Exception Exception
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private synchronized void updateCounterInfo(String ID, ResourceType resType, OperationType opType, Calendar updateTime) throws Exception{
|
private synchronized void updateCounterInfo(String ID, ResourceType resType, OperationType opType, Calendar updateTime) throws Exception{
|
||||||
|
|
||||||
RegistryProperty property = new RegistryProperty();
|
RegistryProperty property = new RegistryProperty();
|
||||||
|
@ -441,7 +438,7 @@ public class RegistryFactory{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.getResource().getPersistenceDelegate().store(this.getResource());
|
this.getResource().store();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* return the resource
|
* return the resource
|
||||||
|
@ -485,4 +482,10 @@ public class RegistryFactory{
|
||||||
*/
|
*/
|
||||||
public String updateState(UpdateStateMessage message)throws GCUBEFault{return null;}
|
public String updateState(UpdateStateMessage message)throws GCUBEFault{return null;}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GCUBEServiceContext getServiceContext() {
|
||||||
|
return ServiceContext.getContext();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,32 +2,21 @@ package org.gcube.informationsystem.registry.impl.contexts;
|
||||||
|
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.rmi.RemoteException;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
|
||||||
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
import org.gcube.common.core.contexts.GHNContext;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
|
||||||
|
|
||||||
import static org.gcube.common.core.contexts.GHNContext.Mode;
|
import static org.gcube.common.core.contexts.GHNContext.Mode;
|
||||||
import org.gcube.common.core.informationsystem.client.AtomicCondition;
|
|
||||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||||
import org.gcube.common.core.informationsystem.client.queries.GCUBEGHNQuery;
|
|
||||||
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
|
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
|
||||||
import org.gcube.common.core.informationsystem.publisher.ISLocalPublisher;
|
import org.gcube.common.core.informationsystem.publisher.ISLocalPublisher;
|
||||||
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
|
||||||
import org.gcube.common.core.informationsystem.publisher.ISPublisherException;
|
|
||||||
import org.gcube.common.core.informationsystem.publisher.ISLocalPublisher.LocalProfileConsumer;
|
import org.gcube.common.core.informationsystem.publisher.ISLocalPublisher.LocalProfileConsumer;
|
||||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
|
||||||
import org.gcube.common.core.resources.GCUBEResource;
|
import org.gcube.common.core.resources.GCUBEResource;
|
||||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.utils.events.GCUBEProducer;
|
import org.gcube.common.core.utils.events.GCUBEProducer;
|
||||||
import org.gcube.common.core.utils.events.GCUBETopic;
|
import org.gcube.common.core.utils.events.GCUBETopic;
|
||||||
import org.gcube.common.core.utils.handlers.GCUBEHandler;
|
import org.gcube.common.core.utils.handlers.GCUBEHandler;
|
||||||
import org.gcube.common.core.utils.handlers.GCUBEScheduledHandler;
|
import org.gcube.common.core.utils.handlers.GCUBEScheduledHandler;
|
||||||
import org.gcube.informationsystem.registry.impl.RegistryFactory;
|
import org.gcube.informationsystem.registry.impl.RegistryFactory;
|
||||||
import org.gcube.informationsystem.registry.impl.core.RegistryConfiguration.ROOT_SERVICES;
|
|
||||||
import org.gcube.informationsystem.registry.impl.state.RegistryFactoryResource;
|
import org.gcube.informationsystem.registry.impl.state.RegistryFactoryResource;
|
||||||
import org.gcube.informationsystem.registry.impl.util.EliminatePoolingThread;
|
import org.gcube.informationsystem.registry.impl.util.EliminatePoolingThread;
|
||||||
import org.gcube.informationsystem.registry.stubs.CreateResourceMessage;
|
import org.gcube.informationsystem.registry.stubs.CreateResourceMessage;
|
||||||
|
@ -70,6 +59,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
super(interval, mode);
|
super(interval, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean repeat(Exception exception, int exceptionCount) {
|
protected boolean repeat(Exception exception, int exceptionCount) {
|
||||||
if (exception!=null) {
|
if (exception!=null) {
|
||||||
logger.warn("Failed to create the notification resource (attempt "+exceptionCount+" out of 20)",exception);
|
logger.warn("Failed to create the notification resource (attempt "+exceptionCount+" out of 20)",exception);
|
||||||
|
@ -99,6 +89,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
/**
|
/**
|
||||||
* @return the JNDI name
|
* @return the JNDI name
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getJNDIName() {
|
public String getJNDIName() {
|
||||||
return JNDI_NAME;
|
return JNDI_NAME;
|
||||||
}
|
}
|
||||||
|
@ -132,6 +123,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
|
|
||||||
NotificationResourceScheduler scheduler = new NotificationResourceScheduler(20, GCUBEScheduledHandler.Mode.LAZY);
|
NotificationResourceScheduler scheduler = new NotificationResourceScheduler(20, GCUBEScheduledHandler.Mode.LAZY);
|
||||||
scheduler.setHandled(new GCUBEHandler(){
|
scheduler.setHandled(new GCUBEHandler(){
|
||||||
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -157,7 +149,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
protected void onInitialisation() throws Exception {
|
protected void onInitialisation() throws Exception {
|
||||||
this.client = GHNContext.getImplementation(ISClient.class);
|
this.client = GHNContext.getImplementation(ISClient.class);
|
||||||
topicProducer= new GCUBEProducer<RegistryTopic, GCUBEResource>();
|
topicProducer= new GCUBEProducer<RegistryTopic, GCUBEResource>();
|
||||||
topicProducer.registerTopics(RegistryTopic.CREATE, RegistryTopic.UPDATE, RegistryTopic.REMOVE);
|
//topicProducer.registerTopics(RegistryTopic.CREATE, RegistryTopic.UPDATE, RegistryTopic.REMOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@ import org.gcube.common.core.resources.GCUBEMCollection;
|
||||||
import org.gcube.common.core.resources.GCUBEResource;
|
import org.gcube.common.core.resources.GCUBEResource;
|
||||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||||
import org.gcube.common.core.resources.GCUBEService;
|
import org.gcube.common.core.resources.GCUBEService;
|
||||||
import org.gcube.common.core.resources.GCUBETransformationProgram;
|
|
||||||
import org.gcube.common.core.resources.GCUBEVRE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -48,9 +46,7 @@ public class RegistryConfiguration {
|
||||||
gLiteCE() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
gLiteCE() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||||
gLiteSite() {public GCUBEResource getResourceClass()throws Exception {return null;}},
|
gLiteSite() {public GCUBEResource getResourceClass()throws Exception {return null;}},
|
||||||
gLiteService() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
gLiteService() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||||
VRE() {public GCUBEResource getResourceClass()throws Exception {return GHNContext.getImplementation(GCUBEVRE.class);}},
|
|
||||||
GenericResource() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEGenericResource.class);}},
|
GenericResource() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEGenericResource.class);}},
|
||||||
TransformationProgram() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBETransformationProgram.class);}},
|
|
||||||
MetadataCollection() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEMCollection.class);}};
|
MetadataCollection() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEMCollection.class);}};
|
||||||
|
|
||||||
abstract public GCUBEResource getResourceClass() throws Exception;
|
abstract public GCUBEResource getResourceClass() throws Exception;
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class RegistryPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<
|
||||||
|
|
||||||
super.onLoad(resource, ois);
|
super.onLoad(resource, ois);
|
||||||
resource.setProfile((Document)ois.readObject());
|
resource.setProfile((Document)ois.readObject());
|
||||||
resource.setNotificationProfile(resource.getProfile());
|
//resource.setNotificationProfile(resource.getProfile());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onStore(ProfileResource resource,ObjectOutputStream oos) throws Exception {
|
protected void onStore(ProfileResource resource,ObjectOutputStream oos) throws Exception {
|
||||||
|
|
|
@ -2,17 +2,10 @@ package org.gcube.informationsystem.registry.impl.state;
|
||||||
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.transform.Transformer;
|
|
||||||
import javax.xml.transform.TransformerFactory;
|
|
||||||
import javax.xml.transform.dom.DOMSource;
|
|
||||||
import javax.xml.transform.stream.StreamResult;
|
|
||||||
|
|
||||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier;
|
|
||||||
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
||||||
import org.gcube.common.core.informationsystem.publisher.ISPublisherException;
|
import org.gcube.common.core.informationsystem.publisher.ISPublisherException;
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
import org.gcube.common.core.contexts.GHNContext;
|
||||||
|
@ -20,22 +13,19 @@ import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||||
import org.gcube.common.core.resources.GCUBEResource;
|
import org.gcube.common.core.resources.GCUBEResource;
|
||||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||||
import org.gcube.common.core.resources.GCUBEService;
|
import org.gcube.common.core.resources.GCUBEService;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
|
||||||
import org.gcube.common.core.state.GCUBEWSResource;
|
import org.gcube.common.core.state.GCUBEWSResource;
|
||||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||||
import org.gcube.informationsystem.registry.impl.RegistryFactory;
|
|
||||||
import org.gcube.informationsystem.registry.impl.contexts.ProfileContext;
|
|
||||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||||
import org.globus.wsrf.ResourceException;
|
import org.globus.wsrf.ResourceException;
|
||||||
import org.globus.wsrf.impl.SimpleTopic;
|
|
||||||
import org.oasis.wsrf.properties.GetMultipleResourcePropertiesResponse;
|
|
||||||
import org.oasis.wsrf.properties.GetMultipleResourceProperties_Element;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andrea Manzi
|
* Stateful resource wrapping a {@link GCUBEResource}
|
||||||
|
*
|
||||||
|
* @author Andrea Manzi, Lucio Lelii, Manuele Simi (ISTI-CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProfileResource extends GCUBEWSResource {
|
public class ProfileResource extends GCUBEWSResource {
|
||||||
|
@ -46,17 +36,12 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
|
|
||||||
//private ISNotifier notifier= null;
|
//private ISNotifier notifier= null;
|
||||||
|
|
||||||
protected static final String NotificationProfileRP="NotificationProfile";
|
//protected static final String NotificationProfileRP="NotificationProfile";
|
||||||
|
|
||||||
protected GCUBEResource gCubeResource;
|
protected GCUBEResource gCubeResource;
|
||||||
|
|
||||||
protected static final String ProfileRP="Profile";
|
protected static final String ProfileRP="Profile";
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String[] getTopicNames(){
|
|
||||||
return new String[] {NotificationProfileRP};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] getPropertyNames(){
|
protected String[] getPropertyNames(){
|
||||||
return new String[] {ProfileRP};
|
return new String[] {ProfileRP};
|
||||||
|
@ -102,7 +87,7 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
|
|
||||||
|
|
||||||
this.setProfile(dom);
|
this.setProfile(dom);
|
||||||
this.setNotificationProfile(dom);
|
//this.setNotificationProfile(dom);
|
||||||
this.setGCubeResource(resource);
|
this.setGCubeResource(resource);
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,21 +122,22 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
*
|
*
|
||||||
* @param profile Document
|
* @param profile Document
|
||||||
*/
|
*/
|
||||||
public void setNotificationProfile(Document profile) {
|
/*public void setNotificationProfile(Document profile) {
|
||||||
this.getResourcePropertySet().get(NotificationProfileRP).clear();
|
this.getResourcePropertySet().get(NotificationProfileRP).clear();
|
||||||
this.getResourcePropertySet().get(NotificationProfileRP).add(profile);
|
this.getResourcePropertySet().get(NotificationProfileRP).add(profile);
|
||||||
//this.getPersistenceDelegate().store(this);
|
//this.getPersistenceDelegate().store(this);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get notification Profile
|
* get notification Profile
|
||||||
*
|
*
|
||||||
* @return Document profile
|
* @return Document profile
|
||||||
*/
|
*/
|
||||||
public Document getNotificationProfile() {
|
/*public Document getNotificationProfile() {
|
||||||
return (Document)this.getResourcePropertySet().get(NotificationProfileRP).get(0);
|
return (Document)this.getResourcePropertySet().get(NotificationProfileRP).get(0);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set Profile
|
* set Profile
|
||||||
|
@ -192,9 +178,9 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
* Gets the Resource QName
|
* Gets the Resource QName
|
||||||
* @return the Resource QName
|
* @return the Resource QName
|
||||||
*/
|
*/
|
||||||
private QName generateQName() {
|
//private QName generateQName() {
|
||||||
return new QName(ProfileContext.getContext().getNamespace(), NotificationProfileRP+this.getID().getValue());
|
// return new QName(ProfileContext.getContext().getNamespace(), NotificationProfileRP+this.getID().getValue());
|
||||||
}
|
//}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the Resource
|
* returns the Resource
|
||||||
|
@ -216,8 +202,8 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
|
|
||||||
/** {@inheritDoc}*/
|
/** {@inheritDoc}*/
|
||||||
@Override
|
@Override
|
||||||
public void remove() throws ResourceException{
|
public void onRemove() throws ResourceException{
|
||||||
super.remove();
|
super.onRemove();
|
||||||
logger.info("Resource " + this.getID()+ " is going to be removed.");
|
logger.info("Resource " + this.getID()+ " is going to be removed.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -245,7 +231,7 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
publisher.removeWSResource(this,ServiceContext.getContext().getScope());
|
publisher.removeWSResource(this,ServiceContext.getContext().getScope());
|
||||||
System.out.println(" "+this.getResourcePropertySet().getScope().get(0));
|
//System.out.println(" "+this.getResourcePropertySet().getScope().get(0));
|
||||||
} catch (ISPublisherException e) {
|
} catch (ISPublisherException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -259,7 +245,7 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
* @param resource the resource to update
|
* @param resource the resource to update
|
||||||
* @throws Exception if something goes wrong
|
* @throws Exception if something goes wrong
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void updateResource(GCUBEResource resource) throws Exception{
|
public void updateResource(GCUBEResource resource) throws Exception{
|
||||||
|
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
@ -273,10 +259,10 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
this.setProfile(dom);
|
this.setProfile(dom);
|
||||||
this.setGCubeResource(resource);
|
this.setGCubeResource(resource);
|
||||||
// updates the notification profile too
|
// updates the notification profile too
|
||||||
if (this.hasToLive(resource))
|
/*if (this.hasToLive(resource))
|
||||||
this.setNotificationProfile(dom);
|
this.setNotificationProfile(dom);
|
||||||
|
*/
|
||||||
this.getPersistenceDelegate().store(this);
|
this.store();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
package org.gcube.informationsystem.registry.impl.state;
|
package org.gcube.informationsystem.registry.impl.state;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
|
||||||
|
|
||||||
import org.gcube.common.core.state.GCUBEWSResource;
|
import org.gcube.common.core.state.GCUBEWSResource;
|
||||||
import org.gcube.informationsystem.registry.impl.util.RegistrationThread;
|
|
||||||
import org.gcube.informationsystem.registry.stubs.RegistryProperty;
|
import org.gcube.informationsystem.registry.stubs.RegistryProperty;
|
||||||
import org.globus.wsrf.ResourceException;
|
import org.globus.wsrf.ResourceException;
|
||||||
import org.globus.wsrf.impl.SimpleTopic;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -74,17 +69,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
||||||
return RPNames;
|
return RPNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String[] getPropertyNames() {
|
|
||||||
return RPNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private ArrayList<SimpleTopic> listQname;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Initializes Resource Properties.
|
* Initializes Resource Properties.
|
||||||
|
@ -96,25 +80,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
||||||
this.initialiseRPs();
|
this.initialiseRPs();
|
||||||
logger.debug("RegistryFactoryResource RPs initialised");
|
logger.debug("RegistryFactoryResource RPs initialised");
|
||||||
|
|
||||||
try {
|
|
||||||
//Topic List creation for registration to IS-Notifier
|
|
||||||
listQname = new ArrayList<SimpleTopic>();
|
|
||||||
for (String rpName : RPNames)
|
|
||||||
listQname.add(new SimpleTopic(new QName(this.getPorttypeContext().getNamespace(),rpName)));
|
|
||||||
try {
|
|
||||||
RegistrationThread thread = new RegistrationThread(listQname);
|
|
||||||
Thread t = new Thread(thread);
|
|
||||||
t.start();
|
|
||||||
}catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.error("Error on Registration Thread",e);
|
|
||||||
}
|
|
||||||
//GHNContext.getImplementation(ISPublisher.class).registerWSResource(this,GHNContext.getContext().getDefaultScope());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Error on Initialization of Resource",e);
|
|
||||||
throw new ResourceException("Failed to initialise the RPs and related topics");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package org.gcube.informationsystem.registry.impl.util;
|
package org.gcube.informationsystem.registry.impl.util;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||||
import org.diligentproject.informationservice.disic.stubs.DISICServiceLocator;
|
import org.diligentproject.informationservice.disic.stubs.DISICServiceLocator;
|
||||||
import org.diligentproject.informationservice.disic.stubs.DISICServicePortType;
|
import org.diligentproject.informationservice.disic.stubs.DISICServicePortType;
|
||||||
import org.diligentproject.informationservice.disic.stubs.DeleteProfileParams;
|
import org.diligentproject.informationservice.disic.stubs.DeleteProfileParams;
|
||||||
|
@ -20,7 +22,9 @@ public class ProfileManager {
|
||||||
|
|
||||||
protected static final String ISICpostfix = "DISICService";
|
protected static final String ISICpostfix = "DISICService";
|
||||||
|
|
||||||
protected URL isIcAddress;
|
//protected URL isIcAddress;
|
||||||
|
|
||||||
|
protected Set<EndpointReferenceType> ICEprs = new HashSet<EndpointReferenceType>();
|
||||||
|
|
||||||
protected String VOMapName;
|
protected String VOMapName;
|
||||||
|
|
||||||
|
@ -31,10 +35,8 @@ public class ProfileManager {
|
||||||
Collection,
|
Collection,
|
||||||
RunningInstance,
|
RunningInstance,
|
||||||
ExternalRunningInstance,
|
ExternalRunningInstance,
|
||||||
DHN,
|
GHN,
|
||||||
gLiteResource,
|
gLiteResource,
|
||||||
VDL,
|
|
||||||
TransformationProgram,
|
|
||||||
MetadataCollection,
|
MetadataCollection,
|
||||||
GenericResource
|
GenericResource
|
||||||
}
|
}
|
||||||
|
@ -50,7 +52,7 @@ public class ProfileManager {
|
||||||
logger.error("error retrieving service map for scope " + scope.toString(), e1);
|
logger.error("error retrieving service map for scope " + scope.toString(), e1);
|
||||||
throw new Exception(e1);
|
throw new Exception(e1);
|
||||||
}
|
}
|
||||||
isIcAddress = this.getICRegistratinAddress(map);
|
this.getSinks(map);
|
||||||
VOMapName = scope.getName();
|
VOMapName = scope.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,45 +68,57 @@ public class ProfileManager {
|
||||||
public void removeFromISIC(String uniqueID, String type, GSSCredential ... credentials) throws Exception {
|
public void removeFromISIC(String uniqueID, String type, GSSCredential ... credentials) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
logger.debug(" Removing profile from IS-IC " + isIcAddress.toString());
|
for (EndpointReferenceType sink : this.ICEprs) {
|
||||||
|
String isIcAddress = sink.getAddress().toString();
|
||||||
|
|
||||||
//check if the type has been specified
|
|
||||||
DISICServiceLocator locator_disic = new DISICServiceLocator();
|
|
||||||
DeleteProfileParams params = new DeleteProfileParams();
|
|
||||||
params.setDILIGENTResourceID(uniqueID);
|
|
||||||
if (type != null && type.compareTo("") !=0) {
|
|
||||||
params.setProfileType(type);
|
|
||||||
try {
|
|
||||||
DISICServicePortType dis_ic = locator_disic.getDISICServicePortTypePort(isIcAddress);
|
|
||||||
dis_ic.deleteProfile(params);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("An error occurs while trying to remove the GCUBE Profile with ID " + uniqueID, e);
|
|
||||||
throw new Exception("Unregistration failed for the GCUBE Profile with ID " + uniqueID);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
//check if the type has been specified
|
||||||
try {
|
DISICServiceLocator locator_disic = new DISICServiceLocator();
|
||||||
//the typeof the resource to delete is not specified, try all the resource types
|
DeleteProfileParams params = new DeleteProfileParams();
|
||||||
logger.debug(" trying to remove profile with UniqueID" + uniqueID);
|
params.setDILIGENTResourceID(uniqueID);
|
||||||
for ( int n = 0 ; n < ResourceTypes.values().length ;n++) {
|
if (type != null && type.compareTo("") !=0) {
|
||||||
params.setProfileType(ResourceTypes.values()[n].toString());
|
try {
|
||||||
logger.debug(" Removing profile from IS-IC " + isIcAddress.toString());
|
logger.debug(" Removing profile from sink " + isIcAddress);
|
||||||
DISICServicePortType dis_ic = locator_disic.getDISICServicePortTypePort(isIcAddress);
|
params.setProfileType(type);
|
||||||
|
DISICServicePortType dis_ic = locator_disic.getDISICServicePortTypePort(new URL(isIcAddress));
|
||||||
dis_ic.deleteProfile(params);
|
dis_ic.deleteProfile(params);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("An error occurs while trying to remove the GCUBE Profile with ID " + uniqueID, e);
|
||||||
|
throw new Exception("Unregistration failed for the GCUBE Profile with ID " + uniqueID);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
//the type of the resource to delete is not specified, try all the resource types
|
||||||
|
logger.debug(" trying to remove profile with UniqueID" + uniqueID);
|
||||||
|
for ( int n = 0 ; n < ResourceTypes.values().length ;n++) {
|
||||||
|
params.setProfileType(ResourceTypes.values()[n].toString());
|
||||||
|
logger.debug("Removing profile from sink " + isIcAddress.toString());
|
||||||
|
DISICServicePortType dis_ic = locator_disic.getDISICServicePortTypePort(new URL(isIcAddress));
|
||||||
|
dis_ic.deleteProfile(params);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(" An error occurs while trying to remove the GCUBE Profile with ID "
|
||||||
|
+ uniqueID, e);
|
||||||
|
throw new Exception("Unregistration failed for the GCUBE Profile with ID " + uniqueID);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(" An error occurs while trying to remove the GCUBE Profile with ID "
|
|
||||||
+ uniqueID, e);
|
|
||||||
throw new Exception("Unregistration failed for the GCUBE Profile with ID " + uniqueID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private URL getICRegistratinAddress(ServiceMap map) throws MalformedURLException {
|
private void getSinks(ServiceMap map) throws Exception {
|
||||||
|
/*
|
||||||
String addressISIC = (String) map.getEndpoint(ServiceType.ISPublishService).getAddress().toString();
|
String addressISIC = (String) map.getEndpoint(ServiceType.ISPublishService).getAddress().toString();
|
||||||
addressISIC = addressISIC.substring(0, addressISIC.lastIndexOf("/") + 1) + ISICpostfix;
|
addressISIC = addressISIC.substring(0, addressISIC.lastIndexOf("/") + 1) + ISICpostfix;
|
||||||
return new URL(addressISIC);
|
return new URL(addressISIC);*/
|
||||||
|
//get the list of IC where to register the RPs
|
||||||
|
if (map.getEndpoints(ServiceType.ISICProfileQueryPT) != null)
|
||||||
|
this.ICEprs.addAll(map.getEndpoints(ServiceType.ISICProfileQueryPT));
|
||||||
|
if (map.getEndpoints(ServiceType.ISICAllQueryPT) != null)
|
||||||
|
this.ICEprs.addAll(map.getEndpoints(ServiceType.ISICAllQueryPT));
|
||||||
|
|
||||||
|
if (this.ICEprs.size() == 0)
|
||||||
|
throw new Exception("No sink available in the Service Map");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||||
import org.gcube.informationsystem.registry.stubs.CreateResourceMessage;
|
import org.gcube.informationsystem.registry.stubs.CreateResourceMessage;
|
||||||
import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
||||||
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||||
import org.gridforum.jgss.ExtendedGSSCredential;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GCUBE resource registration tester
|
* GCUBE resource registration tester
|
||||||
|
@ -46,8 +45,7 @@ public class RegistryRegistrationTest {
|
||||||
|
|
||||||
// get the scope and the factory URI
|
// get the scope and the factory URI
|
||||||
GCUBEScope scope = GCUBEScope.getScope(args[2]);
|
GCUBEScope scope = GCUBEScope.getScope(args[2]);
|
||||||
EndpointReferenceType factoryEPR = scope.getServiceMap().getEndpoint(
|
EndpointReferenceType factoryEPR = scope.getServiceMap().getEndpoints(ServiceType.ISICAllRegistrationPT).iterator().next();
|
||||||
ServiceType.ISRegistry);
|
|
||||||
|
|
||||||
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
||||||
import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage;
|
import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage;
|
||||||
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||||
|
|
||||||
import org.gridforum.jgss.ExtendedGSSCredential;
|
|
||||||
|
|
||||||
public class RegistryRemoveTest {
|
public class RegistryRemoveTest {
|
||||||
|
|
||||||
|
@ -19,7 +18,6 @@ public class RegistryRemoveTest {
|
||||||
|
|
||||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||||
|
|
||||||
ExtendedGSSCredential cred; // =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]);
|
|
||||||
|
|
||||||
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||||
import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
||||||
import org.gcube.informationsystem.registry.stubs.UpdateResourceMessage;
|
import org.gcube.informationsystem.registry.stubs.UpdateResourceMessage;
|
||||||
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||||
import org.gridforum.jgss.ExtendedGSSCredential;
|
|
||||||
|
|
||||||
public class RegistryUpdateTest {
|
public class RegistryUpdateTest {
|
||||||
|
|
||||||
|
@ -22,15 +21,11 @@ public static void main (String[]args ) throws Exception {
|
||||||
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
||||||
|
|
||||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FileReader fis = new FileReader (args[1]);
|
FileReader fis = new FileReader (args[1]);
|
||||||
GCUBEService resource =GHNContext.getImplementation(GCUBEService.class);
|
GCUBEService resource =GHNContext.getImplementation(GCUBEService.class);
|
||||||
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
||||||
resource.load(fis);
|
resource.load(fis);
|
||||||
|
|
||||||
|
|
||||||
RegistryFactoryPortType registryFactoryPortType= null;
|
RegistryFactoryPortType registryFactoryPortType= null;
|
||||||
try {
|
try {
|
||||||
factoryEPR.setAddress(new Address(args[0]));
|
factoryEPR.setAddress(new Address(args[0]));
|
||||||
|
|
Loading…
Reference in New Issue