From 1cefab7d2ed91b6294eef90b5123cac4d22ce240 Mon Sep 17 00:00:00 2001 From: Lucio Lelii Date: Thu, 18 Sep 2008 18:11:28 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@3357 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../registry/impl/contexts/ServiceContext.java | 10 +++++----- .../registry/impl/state/ProfileResource.java | 14 +++++++++++++- .../registry/test/RegistryUpdateTest.java | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/org/gcube/informationsystem/registry/impl/contexts/ServiceContext.java b/src/org/gcube/informationsystem/registry/impl/contexts/ServiceContext.java index 98ac779..2ae7932 100644 --- a/src/org/gcube/informationsystem/registry/impl/contexts/ServiceContext.java +++ b/src/org/gcube/informationsystem/registry/impl/contexts/ServiceContext.java @@ -117,7 +117,7 @@ public class ServiceContext extends GCUBEServiceContext { GCUBERunningInstance RegistryRIProfile = ServiceContext.getContext().getInstance(); GCUBERIQuery query = ServiceContext.getContext().client.getQuery(GCUBERIQuery.class); query.addAtomicConditions(new AtomicCondition("//ServiceClass", ServiceContext.this.getServiceClass()),new AtomicCondition("//ServiceName", this.getName())); - if (ServiceContext.getContext().client.execute(query, GHNContext.getContext().getDefaultScope()).size() == 0) + if (ServiceContext.getContext().client.execute(query, ServiceContext.getContext().getScope()).size() == 0) registerProfile(RegistryRIProfile, GCUBERunningInstance.TYPE); ServiceContext.getContext().checkCodeployedServices(); @@ -162,7 +162,7 @@ public class ServiceContext extends GCUBEServiceContext { throws ISPublisherException, Exception { if (GHNContext.getContext().getMode() == GHNContext.Mode.ROOT) GHNContext.getImplementation(ISPublisher.class).registerGCUBEResource( - resource, GHNContext.getContext().getDefaultScope(), + resource, ServiceContext.getContext().getScope(), ServiceContext.getContext()); } @@ -200,7 +200,7 @@ public class ServiceContext extends GCUBEServiceContext { query.addAtomicConditions(new AtomicCondition( "//Endpoint@EntryName","gcube/informationsystem/notifier/Notifier"),new AtomicCondition("//ServiceName", ROOT_SERVICES.ISNOTIFIER.getName())); - if (client.execute(query, GHNContext.getContext().getDefaultScope()).size() == 0) + if (client.execute(query, ServiceContext.getContext().getScope()).size() == 0) registerProfile(NotifierRIProfile, GCUBERunningInstance.TYPE); } @@ -210,7 +210,7 @@ public class ServiceContext extends GCUBEServiceContext { query.addAtomicConditions(new AtomicCondition( "//Endpoint@EntryName","gcube/informationsystem/isic/ISICFactoryService"),new AtomicCondition("//ServiceName", ROOT_SERVICES.ISIC.getName())); - if (client.execute(query, GHNContext.getContext().getDefaultScope()).size() == 0) + if (client.execute(query, ServiceContext.getContext().getScope()).size() == 0) registerProfile(ISICRIProfile, GCUBERunningInstance.TYPE); } // registers the local GHNManager profile @@ -221,7 +221,7 @@ public class ServiceContext extends GCUBEServiceContext { GCUBEGHNQuery node = client.getQuery(GCUBEGHNQuery.class); node.addAtomicConditions(new AtomicCondition("/GHNDescription/Name", ghnProfile.getNodeDescription().getName())); - if (client.execute(node, GHNContext.getContext().getDefaultScope()).size() == 0) + if (client.execute(node, ServiceContext.getContext().getScope()).size() == 0) registerProfile(ghnProfile, GCUBEHostingNode.TYPE); } diff --git a/src/org/gcube/informationsystem/registry/impl/state/ProfileResource.java b/src/org/gcube/informationsystem/registry/impl/state/ProfileResource.java index ee4a1a6..b5707f3 100644 --- a/src/org/gcube/informationsystem/registry/impl/state/ProfileResource.java +++ b/src/org/gcube/informationsystem/registry/impl/state/ProfileResource.java @@ -23,6 +23,7 @@ import org.gcube.common.core.utils.logging.GCUBELog; import org.gcube.informationsystem.registry.impl.RegistryFactory; 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; @@ -97,9 +98,20 @@ public class ProfileResource extends GCUBEWSResource { synchronized(RegistryFactory.notificationMap) { if (!(RegistryFactory.notificationMap.contains(this.getID()))) { try { - publisher = GHNContext.getImplementation(ISPublisher.class); notifier = GHNContext.getImplementation(ISNotifier.class); + System.out.println("i'm here ---------------"); + for (SimpleTopic s : listQname) + System.out.println(s); + System.out.println(listQname); + System.out.println(listQname.getClass()); + try { notifier.registerISNotification(this.getEPR(), listQname, ServiceContext.getContext()); + } catch (ArrayStoreException e) { + System.out.println(e); + e.printStackTrace(); + System.out.println("end stack trace"); + } + System.out.println("i'm there xxx---------------"); } catch (Exception e){ e.printStackTrace(); throw new ResourceException(e); diff --git a/src/org/gcube/informationsystem/registry/test/RegistryUpdateTest.java b/src/org/gcube/informationsystem/registry/test/RegistryUpdateTest.java index 0dbcc1b..7148ce7 100644 --- a/src/org/gcube/informationsystem/registry/test/RegistryUpdateTest.java +++ b/src/org/gcube/informationsystem/registry/test/RegistryUpdateTest.java @@ -23,7 +23,7 @@ public static void main (String[]args ) throws Exception { GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}}; - ExtendedGSSCredential cred =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]); + FileReader fis = new FileReader (args[1]); GCUBEService resource =GHNContext.getImplementation(GCUBEService.class); @@ -40,7 +40,7 @@ public static void main (String[]args ) throws Exception { } UpdateResourceMessage message = new UpdateResourceMessage(); - managerSec.useCredentials(cred); + registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope(args[3]),managerSec); try {