git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@6036 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1f6381d20f
commit
f197ceeaaf
|
@ -1,18 +1,10 @@
|
|||
package org.gcube.informationsystem.registry.impl;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.axis.utils.XMLUtils;
|
||||
import org.gcube.common.core.faults.GCUBEFault;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.ProfileContext;
|
||||
import org.gcube.informationsystem.registry.impl.state.ProfileResource;
|
||||
import org.gcube.informationsystem.registry.stubs.GetProfileString;
|
||||
import org.globus.wsrf.ResourceException;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,12 +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.faults.GCUBEFault;
|
||||
import org.gcube.common.core.resources.GCUBEGenericResource;
|
||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||
import org.gcube.common.core.resources.GCUBEResource;
|
||||
import org.gcube.common.core.resources.impl.kxml.GCUBEResourceImpl;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.state.GCUBEWSResourceKey;
|
||||
import org.gcube.common.core.utils.events.GCUBEEvent;
|
||||
|
@ -78,7 +75,7 @@ public class RegistryFactory{
|
|||
/**
|
||||
* Map of registration to Notification
|
||||
*/
|
||||
public static List<GCUBEWSResourceKey> notificationMap = Collections.synchronizedList(new ArrayList<GCUBEWSResourceKey>());
|
||||
public static final List<GCUBEWSResourceKey> notificationMap = Collections.synchronizedList(new ArrayList<GCUBEWSResourceKey>());
|
||||
|
||||
/** the key used to label the Factory Resource */
|
||||
public static final String NOTIFICATOR_RESOURCE_KEY = "RegistryResource";
|
||||
|
@ -116,6 +113,7 @@ public class RegistryFactory{
|
|||
* @throws RemoteException
|
||||
* @throws ProfileAlreadyRegisteredFault
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public String createResource(CreateResourceMessage mess) throws SchemaValidationFault,RemoteException,ProfileAlreadyRegisteredFault {
|
||||
GCUBEResource resource=null;
|
||||
|
||||
|
@ -136,12 +134,7 @@ public class RegistryFactory{
|
|||
resource=ResourceType.valueOf(mess.getType()).getResourceClass();
|
||||
|
||||
resource.load(new BufferedReader(new InputStreamReader(new ByteArrayInputStream(profile.getBytes("UTF-8")), "UTF-8")));
|
||||
|
||||
if (mess.getType().compareTo(GCUBEGenericResource.TYPE)==0){
|
||||
System.out.println("profile:" +profile);
|
||||
System.out.println("------------");
|
||||
System.out.println(((GCUBEGenericResource) resource).getBody());
|
||||
}
|
||||
|
||||
//the parse Profile class allows to extract from profiles information about type/SCOPE/UniqueID
|
||||
//in order to distinguish among different Resource Type
|
||||
//Adding scopes to Profile
|
||||
|
@ -269,6 +262,7 @@ public class RegistryFactory{
|
|||
* @return RemoveResourceResponse
|
||||
* @throws RemoteException Exceptions
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public RemoveResourceResponse removeResource (RemoveResourceMessage inputMessage) throws RemoteException,GCUBEFault{
|
||||
logSecurityInfo("removeResource");
|
||||
logger.info("RemoveResource operation invoked");
|
||||
|
@ -303,7 +297,9 @@ public class RegistryFactory{
|
|||
if (type.compareTo(GCUBEHostingNode.TYPE) == 0)
|
||||
RegistryUtil.unregisterRIRelatedToGHN(ID,this);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error removing profile related to this GHNID for ID ", e);
|
||||
logger.error("Error removing profile related to this GHNID for ID ", e);
|
||||
System.out.println("error removing RI related to GHN");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (this.isResourceCreated(ID)){
|
||||
|
@ -318,9 +314,9 @@ public class RegistryFactory{
|
|||
throw new RemoteException();
|
||||
}
|
||||
try {
|
||||
|
||||
|
||||
GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>();
|
||||
GCUBEResource resource =GHNContext.getImplementation(GCUBEResource.class);
|
||||
GCUBEResource resource =ResourceType.valueOf(type).getResourceClass();
|
||||
resource.setID(ID);
|
||||
event.setPayload(resource);
|
||||
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.REMOVE, event);
|
||||
|
|
|
@ -15,7 +15,7 @@ public class ProfileContext extends GCUBEStatefulPortTypeContext{
|
|||
|
||||
private ProfileContext(){}
|
||||
|
||||
protected static ProfileContext cache = new ProfileContext();
|
||||
protected static final ProfileContext cache = new ProfileContext();
|
||||
|
||||
|
||||
public static ProfileContext getContext() {
|
||||
|
|
|
@ -15,7 +15,6 @@ 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.state.GCUBETopicList;
|
||||
import org.gcube.common.core.utils.events.GCUBEProducer;
|
||||
import org.gcube.common.core.utils.events.GCUBETopic;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEHandler;
|
||||
|
@ -35,7 +34,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
|
||||
public static final String JNDI_NAME = "gcube/informationsystem/registry";
|
||||
|
||||
protected static ServiceContext cache = new ServiceContext();
|
||||
protected static final ServiceContext cache = new ServiceContext();
|
||||
|
||||
protected ISClient client = null;
|
||||
|
||||
|
@ -89,6 +88,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
return topicProducer;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void onReady() throws Exception {
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ import javax.xml.namespace.QName;
|
|||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
|
||||
import org.apache.axis.utils.XMLUtils;
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISPublisherException;
|
||||
|
@ -24,7 +22,6 @@ 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.Topic;
|
||||
import org.globus.wsrf.impl.SimpleTopic;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
|
@ -75,7 +72,7 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
|
||||
try {
|
||||
resource.store(writer);
|
||||
System.out.println("create Profile "+ writer.toString());
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
|
@ -158,7 +155,7 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
* @return the Resource QName
|
||||
*/
|
||||
private QName generateQName() {
|
||||
return new QName(ProfileContext.getContext().getNamespace(), NotificationProfileRP.toString()+this.getID().getValue());
|
||||
return new QName(ProfileContext.getContext().getNamespace(), NotificationProfileRP+this.getID().getValue());
|
||||
}
|
||||
|
||||
public GCUBEResource getGCubeResource() {
|
||||
|
@ -207,6 +204,7 @@ public class ProfileResource extends GCUBEWSResource {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateResource(GCUBEResource resource) throws Exception{
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
|
|
|
@ -125,7 +125,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RI property
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setRunningInstance (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(RunningInstanceRP).clear();
|
||||
this.getResourcePropertySet().get(RunningInstanceRP).add(property);
|
||||
|
@ -150,7 +149,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setExternalRunningInstance (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(ExternalRunningInstanceRP).clear();
|
||||
this.getResourcePropertySet().get(ExternalRunningInstanceRP).add(property);
|
||||
|
@ -177,7 +175,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setService (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(ServiceRP).clear();
|
||||
this.getResourcePropertySet().get(ServiceRP).add(property);
|
||||
|
@ -203,7 +200,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setCollection (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(CollectionRP).clear();
|
||||
this.getResourcePropertySet().get(CollectionRP).add(property);
|
||||
|
@ -228,7 +224,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setCS (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(CSRP).clear();
|
||||
this.getResourcePropertySet().get(CSRP).add(property);
|
||||
|
@ -253,7 +248,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setCSInstance (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(CSInstanceRP).clear();
|
||||
this.getResourcePropertySet().get(CSInstanceRP).add(property);
|
||||
|
@ -279,7 +273,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setGHN (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(GHNRP).clear();
|
||||
this.getResourcePropertySet().get(GHNRP).add(property);
|
||||
|
@ -303,7 +296,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setGLiteSE (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(gLiteSERP).clear();
|
||||
this.getResourcePropertySet().get(gLiteSERP).add(property);
|
||||
|
@ -327,7 +319,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setGLiteCE (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(gLiteCERP).clear();
|
||||
this.getResourcePropertySet().get(gLiteCERP).add(property);
|
||||
|
@ -353,7 +344,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setGLiteSite (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(gLiteSiteRP).clear();
|
||||
this.getResourcePropertySet().get(gLiteSiteRP).add(property);
|
||||
|
@ -378,7 +368,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setGLiteService (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(gLiteServiceRP).clear();
|
||||
this.getResourcePropertySet().get(gLiteServiceRP).add(property);
|
||||
|
@ -402,7 +391,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setVRE (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(VRERP).clear();
|
||||
this.getResourcePropertySet().get(VRERP).add(property);
|
||||
|
@ -427,7 +415,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setMetadataCollection (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(MetadataCollectionRP).clear();
|
||||
this.getResourcePropertySet().get(MetadataCollectionRP).add(property);
|
||||
|
@ -454,7 +441,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
|
|||
* @param property The RegistryProperty
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setGenericResource (RegistryProperty property) {
|
||||
this.getResourcePropertySet().get(GenericResourceRP).clear();
|
||||
this.getResourcePropertySet().get(GenericResourceRP).add(property);
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package org.gcube.informationsystem.registry.impl.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.gcube.common.core.informationsystem.notifier.ISNotifier;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class RegistryUtil {
|
|||
if (client==null) client = GHNContext.getImplementation(ISClient.class);
|
||||
RemoveResourceMessage message = null;
|
||||
GCUBEGenericQuery query = client.getQuery("RIOnGHN");
|
||||
query.addParameters(new QueryParameter("ID", GHNContext.getContext().getGHNID()));
|
||||
query.addParameters(new QueryParameter("ID", id));
|
||||
|
||||
//query to IS on order to retrieve the RI deployed on the GHN;
|
||||
List<XMLResult> resources = client.execute(query, ServiceContext.getContext().getScope());
|
||||
|
@ -82,6 +82,6 @@ public class RegistryUtil {
|
|||
} catch (RemoteException rme) {}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue