Initial commit for 2.0.0 release: porting on the new XMLCollectionAccess portType exposed by the IS-Collector
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@31227 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
51dfef335b
commit
106e858284
|
@ -1,4 +1,7 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.information-system.registry.2-0-0" date="">
|
||||
<Change>Porting on the new XMLCollectionAccess portType exposed by the IS-Collector</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.information-system.registry.1-4-0" date="2010-08-30">
|
||||
<Change>Classes of living resources configurable via JNDI</Change>
|
||||
</Changeset>
|
||||
|
|
|
@ -18,7 +18,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.4.0</Version>
|
||||
<Version>2.0.0</Version>
|
||||
<Mandatory level="VO"/>
|
||||
<Shareable level="VO"/>
|
||||
<GHNRequirements>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<Version>1.0.0</Version>
|
||||
</Service>
|
||||
<Package>IS-Registry-stubs</Package>
|
||||
<Version>1.4.0</Version>
|
||||
<Version>2.0.0</Version>
|
||||
<Scope level="GHN"/>
|
||||
<Optional>false</Optional>
|
||||
</Dependency>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<Software>
|
||||
<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-stubs</Name>
|
||||
<Version>1.4.0</Version>
|
||||
<Version>2.0.0</Version>
|
||||
<MultiVersion value="true"/>
|
||||
<Mandatory level="GHN"/>
|
||||
<Shareable level="VO"/>
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package org.gcube.informationsystem.registry.impl.profilemanagement;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.axis.message.addressing.AttributedURI;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.apache.axis.types.URI;
|
||||
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -14,9 +17,16 @@ import org.gcube.common.core.scope.ServiceMap;
|
|||
import org.gcube.common.core.scope.ServiceMap.ServiceType;
|
||||
import org.gcube.common.core.security.GCUBEServiceSecurityManager;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.informationsystem.collector.stubs.DeleteProfileParams;
|
||||
import org.gcube.informationsystem.collector.stubs.XMLCollectionAccessPortType;
|
||||
import org.gcube.informationsystem.collector.stubs.service.XMLCollectionAccessServiceLocator;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdai.DataResourceUnavailableFaultType;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdai.InvalidResourceNameFaultType;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdai.NotAuthorizedFaultType;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdai.ServiceBusyFaultType;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdaix.RemoveDocumentRequestWrapper;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdaix.RemoveDocumentsRequest;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdaix.RemoveDocumentsResponse;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdaix.XMLCollectionAccessPT;
|
||||
import org.gcube.informationsystem.collector.stubs.wsdaix.service.WsdaixServiceAddressingLocator;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||
|
||||
public class ProfileManager {
|
||||
|
@ -66,15 +76,10 @@ public class ProfileManager {
|
|||
for (EndpointReferenceType sink : this.ICEprs) {
|
||||
String isIcAddress = sink.getAddress().toString();
|
||||
// check if the type has been specified
|
||||
DeleteProfileParams params = new DeleteProfileParams();
|
||||
params.setID(uniqueID);
|
||||
if (type != null && type.compareTo("") != 0) {
|
||||
try {
|
||||
logger.debug("Removing profile from sink " + isIcAddress);
|
||||
params.setProfileType(type);
|
||||
XMLCollectionAccessPortType port = new XMLCollectionAccessServiceLocator().getXMLCollectionAccessPortTypePort(new URL(isIcAddress));
|
||||
port = GCUBERemotePortTypeContext.getProxy(port, scope, manager);
|
||||
port.deleteProfile(params);
|
||||
this.removeDocuments(isIcAddress, scope, new URI("gcube://resource"), new URI("gcube://Profiles/"+ type), uniqueID);
|
||||
} catch (Exception e) {
|
||||
logger.error(
|
||||
"An error occurs while trying to remove the GCUBE Profile with ID "
|
||||
|
@ -83,18 +88,13 @@ public class ProfileManager {
|
|||
"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);
|
||||
XMLCollectionAccessPortType port = new XMLCollectionAccessServiceLocator().getXMLCollectionAccessPortTypePort(new URL(isIcAddress));
|
||||
port = GCUBERemotePortTypeContext.getProxy(port, scope, manager);
|
||||
for (int n = 0; n < ResourceTypes.values().length; n++) {
|
||||
params.setProfileType(ResourceTypes.values()[n].toString());
|
||||
logger.debug("Removing profile from sink " + isIcAddress.toString());
|
||||
port.deleteProfile(params);
|
||||
this.removeDocuments(isIcAddress, scope, new URI("gcube://resource"), new URI("gcube://Profiles/"+ ResourceTypes.values()[n].toString()), uniqueID);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(
|
||||
|
@ -109,27 +109,32 @@ public class ProfileManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Queries the IS to find a GCUBEResource given its ID
|
||||
*
|
||||
* @param ID
|
||||
* @param resourceClass
|
||||
* @return
|
||||
* @throws ISMalformedQueryException
|
||||
* @throws ISInvalidQueryException
|
||||
* @throws ISException
|
||||
* Executes the RemoveDocuments operation
|
||||
* @param serviceURL The URL of the data service
|
||||
* @param resourceName The abstract name of the data resource
|
||||
* @param collectionURI The URI of the collection from which documents should be removed
|
||||
* @param documentNames An array of document names that should be removed
|
||||
*/
|
||||
/*public static GCUBEResource getProfileFromIS(String ID, Class<? extends GCUBEResource> resourceClass) throws ISMalformedQueryException, ISInvalidQueryException, ISException {
|
||||
|
||||
GCUBEGenericQuery query = client.getQuery("GCUBEResourceQuery");
|
||||
|
||||
GCUBEResourceFromIDQuery query =client.getQuery(GCUBEResourceFromIDQuery.class);
|
||||
query.setResourceClass(resourceClass);
|
||||
query.setResourceID(ID);
|
||||
List<GCUBEResource> resource = client.execute(query, GHNContext.getContext().getDefaultScope());
|
||||
if (resource != null) return resource.get(0);
|
||||
else return null;
|
||||
|
||||
}*/
|
||||
private RemoveDocumentsResponse removeDocuments(String serviceURL, GCUBEScope scope,
|
||||
URI resourceName, URI collectionURI, String documentName)
|
||||
throws DataResourceUnavailableFaultType, MalformedURLException, RemoteException, ServiceBusyFaultType,
|
||||
InvalidResourceNameFaultType, InvalidCollectionNameFaultType, NotAuthorizedFaultType {
|
||||
RemoveDocumentsRequest request = new RemoveDocumentsRequest();
|
||||
request.setDataResourceAbstractName(resourceName);
|
||||
RemoveDocumentRequestWrapper[] wrappers = new RemoveDocumentRequestWrapper[1];
|
||||
wrappers[0] = new RemoveDocumentRequestWrapper();
|
||||
wrappers[0].setDocumentName(documentName);
|
||||
request.setRemoveDocumentRequestWrapper(wrappers);
|
||||
request.setCollectionName(collectionURI);
|
||||
XMLCollectionAccessPT stubs = null;
|
||||
try {
|
||||
stubs = new WsdaixServiceAddressingLocator().getXMLCollectionAccessPTPort(new URL(serviceURL));
|
||||
stubs = GCUBERemotePortTypeContext.getProxy(stubs, scope);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to get documentes", e);
|
||||
}
|
||||
return stubs.removeDocuments(request);
|
||||
}
|
||||
|
||||
private void getSinks(final ServiceMap map) throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue