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 exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<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"/>
|
||||
</classpath>
|
||||
|
|
2
.project
2
.project
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Registry</name>
|
||||
<name>Registry_branched</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<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>
|
||||
<Name>IS-Registry-service</Name>
|
||||
<Version>1.1.3</Version>
|
||||
<Version>1.2.0</Version>
|
||||
<Mandatory level="VO"/>
|
||||
<Shareable level="VO"/>
|
||||
<GHNRequirements>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.gcube.informationsystem.registry.impl;
|
||||
|
||||
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.porttypes.GCUBEPortType;
|
||||
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.stubs.GetProfileString;
|
||||
|
||||
|
@ -13,7 +16,7 @@ import org.gcube.informationsystem.registry.stubs.GetProfileString;
|
|||
* @author Manuele Simi (CNR)
|
||||
*
|
||||
*/
|
||||
public class Registry {
|
||||
public class Registry extends GCUBEPortType {
|
||||
|
||||
/**
|
||||
* Gets a string representation of the profile
|
||||
|
@ -30,4 +33,9 @@ public class Registry {
|
|||
throw new GCUBEFault();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GCUBEServiceContext getServiceContext() {
|
||||
return ServiceContext.getContext();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,9 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import org.apache.axis.components.uuid.UUIDGen;
|
||||
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.informationsystem.client.ISClient;
|
||||
import org.gcube.common.core.informationsystem.client.XMLResult;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
|
||||
import org.gcube.common.core.porttypes.GCUBEPortType;
|
||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||
import org.gcube.common.core.resources.GCUBEResource;
|
||||
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)
|
||||
*
|
||||
*/
|
||||
public class RegistryFactory{
|
||||
public class RegistryFactory extends GCUBEPortType {
|
||||
|
||||
private final long delayRemoveTyme= 120000;
|
||||
|
||||
|
@ -175,7 +173,7 @@ public class RegistryFactory{
|
|||
logger.debug(resource.getID()+" Creating the stateful resource for " + resource.getID());
|
||||
|
||||
ProfileResource presource = (ProfileResource) ProfileContext.getContext().getWSHome().create(ProfileContext.getContext().makeKey(resource.getID()),resource);
|
||||
presource.getPersistenceDelegate().store(presource);
|
||||
presource.store();
|
||||
|
||||
//Deleting the WSResource created
|
||||
long timestamp;
|
||||
|
@ -426,7 +424,6 @@ public class RegistryFactory{
|
|||
* @throws Exception Exception
|
||||
*/
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private synchronized void updateCounterInfo(String ID, ResourceType resType, OperationType opType, Calendar updateTime) throws Exception{
|
||||
|
||||
RegistryProperty property = new RegistryProperty();
|
||||
|
@ -441,7 +438,7 @@ public class RegistryFactory{
|
|||
}
|
||||
|
||||
}
|
||||
this.getResource().getPersistenceDelegate().store(this.getResource());
|
||||
this.getResource().store();
|
||||
}
|
||||
/**
|
||||
* return the resource
|
||||
|
@ -485,4 +482,10 @@ public class RegistryFactory{
|
|||
*/
|
||||
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.rmi.RemoteException;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.faults.GCUBEFault;
|
||||
|
||||
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.queries.GCUBEGHNQuery;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
|
||||
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.resources.GCUBEHostingNode;
|
||||
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.utils.events.GCUBEProducer;
|
||||
import org.gcube.common.core.utils.events.GCUBETopic;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEHandler;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEScheduledHandler;
|
||||
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.util.EliminatePoolingThread;
|
||||
import org.gcube.informationsystem.registry.stubs.CreateResourceMessage;
|
||||
|
@ -70,6 +59,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
super(interval, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean repeat(Exception exception, int exceptionCount) {
|
||||
if (exception!=null) {
|
||||
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
|
||||
*/
|
||||
@Override
|
||||
public String getJNDIName() {
|
||||
return JNDI_NAME;
|
||||
}
|
||||
|
@ -132,6 +123,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
|
||||
NotificationResourceScheduler scheduler = new NotificationResourceScheduler(20, GCUBEScheduledHandler.Mode.LAZY);
|
||||
scheduler.setHandled(new GCUBEHandler(){
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
|
||||
try {
|
||||
|
@ -157,7 +149,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
protected void onInitialisation() throws Exception {
|
||||
this.client = GHNContext.getImplementation(ISClient.class);
|
||||
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.GCUBERunningInstance;
|
||||
import org.gcube.common.core.resources.GCUBEService;
|
||||
import org.gcube.common.core.resources.GCUBETransformationProgram;
|
||||
import org.gcube.common.core.resources.GCUBEVRE;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,10 +45,8 @@ public class RegistryConfiguration {
|
|||
gLiteSE() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||
gLiteCE() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||
gLiteSite() {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);}},
|
||||
TransformationProgram() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBETransformationProgram.class);}},
|
||||
gLiteService() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||
GenericResource() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEGenericResource.class);}},
|
||||
MetadataCollection() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEMCollection.class);}};
|
||||
|
||||
abstract public GCUBEResource getResourceClass() throws Exception;
|
||||
|
|
|
@ -13,7 +13,7 @@ public class RegistryPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<
|
|||
|
||||
super.onLoad(resource, ois);
|
||||
resource.setProfile((Document)ois.readObject());
|
||||
resource.setNotificationProfile(resource.getProfile());
|
||||
//resource.setNotificationProfile(resource.getProfile());
|
||||
}
|
||||
|
||||
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.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
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.ISPublisherException;
|
||||
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.GCUBERunningInstance;
|
||||
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.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.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.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 {
|
||||
|
@ -46,17 +36,12 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
|
||||
//private ISNotifier notifier= null;
|
||||
|
||||
protected static final String NotificationProfileRP="NotificationProfile";
|
||||
//protected static final String NotificationProfileRP="NotificationProfile";
|
||||
|
||||
protected GCUBEResource gCubeResource;
|
||||
|
||||
protected static final String ProfileRP="Profile";
|
||||
|
||||
@Override
|
||||
protected String[] getTopicNames(){
|
||||
return new String[] {NotificationProfileRP};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String[] getPropertyNames(){
|
||||
return new String[] {ProfileRP};
|
||||
|
@ -102,7 +87,7 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
|
||||
|
||||
this.setProfile(dom);
|
||||
this.setNotificationProfile(dom);
|
||||
//this.setNotificationProfile(dom);
|
||||
this.setGCubeResource(resource);
|
||||
|
||||
|
||||
|
@ -137,21 +122,22 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
*
|
||||
* @param profile Document
|
||||
*/
|
||||
public void setNotificationProfile(Document profile) {
|
||||
/*public void setNotificationProfile(Document profile) {
|
||||
this.getResourcePropertySet().get(NotificationProfileRP).clear();
|
||||
this.getResourcePropertySet().get(NotificationProfileRP).add(profile);
|
||||
//this.getPersistenceDelegate().store(this);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* get notification Profile
|
||||
*
|
||||
* @return Document profile
|
||||
*/
|
||||
public Document getNotificationProfile() {
|
||||
/*public Document getNotificationProfile() {
|
||||
return (Document)this.getResourcePropertySet().get(NotificationProfileRP).get(0);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* set Profile
|
||||
|
@ -192,9 +178,9 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
* Gets the Resource QName
|
||||
* @return the Resource QName
|
||||
*/
|
||||
private QName generateQName() {
|
||||
return new QName(ProfileContext.getContext().getNamespace(), NotificationProfileRP+this.getID().getValue());
|
||||
}
|
||||
//private QName generateQName() {
|
||||
// return new QName(ProfileContext.getContext().getNamespace(), NotificationProfileRP+this.getID().getValue());
|
||||
//}
|
||||
|
||||
/**
|
||||
* returns the Resource
|
||||
|
@ -216,8 +202,8 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
|
||||
/** {@inheritDoc}*/
|
||||
@Override
|
||||
public void remove() throws ResourceException{
|
||||
super.remove();
|
||||
public void onRemove() throws ResourceException{
|
||||
super.onRemove();
|
||||
logger.info("Resource " + this.getID()+ " is going to be removed.");
|
||||
|
||||
try {
|
||||
|
@ -245,7 +231,7 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
|
||||
try {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -259,7 +245,7 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
* @param resource the resource to update
|
||||
* @throws Exception if something goes wrong
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
public void updateResource(GCUBEResource resource) throws Exception{
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
|
@ -273,10 +259,10 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
this.setProfile(dom);
|
||||
this.setGCubeResource(resource);
|
||||
// updates the notification profile too
|
||||
if (this.hasToLive(resource))
|
||||
/*if (this.hasToLive(resource))
|
||||
this.setNotificationProfile(dom);
|
||||
|
||||
this.getPersistenceDelegate().store(this);
|
||||
*/
|
||||
this.store();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
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.informationsystem.registry.impl.util.RegistrationThread;
|
||||
import org.gcube.informationsystem.registry.stubs.RegistryProperty;
|
||||
import org.globus.wsrf.ResourceException;
|
||||
import org.globus.wsrf.impl.SimpleTopic;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -73,18 +68,7 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
protected String[] getTopicNames() {
|
||||
return RPNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getPropertyNames() {
|
||||
return RPNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private ArrayList<SimpleTopic> listQname;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Initializes Resource Properties.
|
||||
|
@ -95,26 +79,7 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
/* Initialize the RP's */
|
||||
this.initialiseRPs();
|
||||
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;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
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.DISICServicePortType;
|
||||
import org.diligentproject.informationservice.disic.stubs.DeleteProfileParams;
|
||||
|
@ -20,7 +22,9 @@ public class ProfileManager {
|
|||
|
||||
protected static final String ISICpostfix = "DISICService";
|
||||
|
||||
protected URL isIcAddress;
|
||||
//protected URL isIcAddress;
|
||||
|
||||
protected Set<EndpointReferenceType> ICEprs = new HashSet<EndpointReferenceType>();
|
||||
|
||||
protected String VOMapName;
|
||||
|
||||
|
@ -31,10 +35,8 @@ public class ProfileManager {
|
|||
Collection,
|
||||
RunningInstance,
|
||||
ExternalRunningInstance,
|
||||
DHN,
|
||||
gLiteResource,
|
||||
VDL,
|
||||
TransformationProgram,
|
||||
GHN,
|
||||
gLiteResource,
|
||||
MetadataCollection,
|
||||
GenericResource
|
||||
}
|
||||
|
@ -50,7 +52,7 @@ public class ProfileManager {
|
|||
logger.error("error retrieving service map for scope " + scope.toString(), e1);
|
||||
throw new Exception(e1);
|
||||
}
|
||||
isIcAddress = this.getICRegistratinAddress(map);
|
||||
this.getSinks(map);
|
||||
VOMapName = scope.getName();
|
||||
}
|
||||
|
||||
|
@ -65,46 +67,58 @@ public class ProfileManager {
|
|||
|
||||
public void removeFromISIC(String uniqueID, String type, GSSCredential ... credentials) throws Exception {
|
||||
|
||||
|
||||
logger.debug(" Removing profile from IS-IC " + isIcAddress.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 {
|
||||
try {
|
||||
//the typeof 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 IS-IC " + isIcAddress.toString());
|
||||
DISICServicePortType dis_ic = locator_disic.getDISICServicePortTypePort(isIcAddress);
|
||||
dis_ic.deleteProfile(params);
|
||||
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) {
|
||||
try {
|
||||
logger.debug(" Removing profile from sink " + isIcAddress);
|
||||
params.setProfileType(type);
|
||||
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);
|
||||
}
|
||||
|
||||
} 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();
|
||||
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.RegistryFactoryPortType;
|
||||
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||
import org.gridforum.jgss.ExtendedGSSCredential;
|
||||
|
||||
/**
|
||||
* GCUBE resource registration tester
|
||||
|
@ -46,8 +45,7 @@ public class RegistryRegistrationTest {
|
|||
|
||||
// get the scope and the factory URI
|
||||
GCUBEScope scope = GCUBEScope.getScope(args[2]);
|
||||
EndpointReferenceType factoryEPR = scope.getServiceMap().getEndpoint(
|
||||
ServiceType.ISRegistry);
|
||||
EndpointReferenceType factoryEPR = scope.getServiceMap().getEndpoints(ServiceType.ISICAllRegistrationPT).iterator().next();
|
||||
|
||||
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.service.RegistryFactoryServiceAddressingLocator;
|
||||
|
||||
import org.gridforum.jgss.ExtendedGSSCredential;
|
||||
|
||||
public class RegistryRemoveTest {
|
||||
|
||||
|
@ -19,7 +18,6 @@ public class RegistryRemoveTest {
|
|||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||
|
||||
ExtendedGSSCredential cred; // =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]);
|
||||
|
||||
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.UpdateResourceMessage;
|
||||
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||
import org.gridforum.jgss.ExtendedGSSCredential;
|
||||
|
||||
public class RegistryUpdateTest {
|
||||
|
||||
|
@ -22,15 +21,11 @@ public static void main (String[]args ) throws Exception {
|
|||
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
||||
|
||||
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||
|
||||
|
||||
|
||||
FileReader fis = new FileReader (args[1]);
|
||||
GCUBEService resource =GHNContext.getImplementation(GCUBEService.class);
|
||||
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
||||
resource.load(fis);
|
||||
|
||||
|
||||
|
||||
RegistryFactoryPortType registryFactoryPortType= null;
|
||||
try {
|
||||
factoryEPR.setAddress(new Address(args[0]));
|
||||
|
|
Loading…
Reference in New Issue