From fc09428ffe65551a0f0c891995faa4402ca2751c Mon Sep 17 00:00:00 2001 From: Manuele Simi Date: Sat, 31 Jul 2010 23:44:39 +0000 Subject: [PATCH] Lifting on living resources management git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@25581 82a268e6-3cf1-43bd-a215-b396298e98cf --- resource.xml | 53 ------------------- resourcetemp.xml | 52 ------------------ .../impl/porttypes/RegistryFactory.java | 28 ++++------ 3 files changed, 9 insertions(+), 124 deletions(-) delete mode 100644 resource.xml delete mode 100644 resourcetemp.xml diff --git a/resource.xml b/resource.xml deleted file mode 100644 index 2e9332b..0000000 --- a/resource.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' standalone='yes' ?> -<Resource> -<ID>lucio-test-6</ID> -<Type>GenericResource</Type> -<Profile> -<Name>BrokerXSLT_dc_anylanguage_to_es_anylanguage</Name> -<Description>XSLT to transform from DC schema to ES schema</Description> -<Body> -<xsl:stylesheet exclude-result-prefixes="xsl dc" version="1.0" xmlns:dc="http://dublincore.org/documents/dces/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> -<xsl:output indent="yes" method="xml" omit-xml-declaration="yes" /> -<xsl:template match="/"> -<esTemplate> -<esObject> -<title> -<xsl:value-of select="normalize-space(dc:ol/dc:title)" /> -</title> -<description /> -<purpose /> -<provenance> -<xsl:apply-templates select="dc:ol/dc:creator" /> -</provenance> -<type> -<xsl:value-of select="normalize-space(dc:ol/dc:type)" /> -</type> -<descKeys /> -<timeFrame> -<begin /> -<end> -<xsl:value-of select="normalize-space(dc:ol/dc:date)" /> -</end> -</timeFrame> -<location> -<width /> -<centerLat /> -<centerLon /> -<westBL /> -<eastBL /> -<southBL /> -<northBL /> -</location> -<suppInfo /> -</esObject> -</esTemplate> -</xsl:template> -<xsl:template match="dc:ol/dc:creator"> -<creator> -<xsl:value-of select="normalize-space(.)" /> -</creator> -</xsl:template> -</xsl:stylesheet> -</Body> -</Profile> -</Resource> diff --git a/resourcetemp.xml b/resourcetemp.xml deleted file mode 100644 index 7ca6297..0000000 --- a/resourcetemp.xml +++ /dev/null @@ -1,52 +0,0 @@ - -lucio-test-7 -GenericResource - -BrokerXSLT_dc_anylanguage_to_es_anylanguage -XSLT to transform from DC schema to ES schema - - - - - - - -<xsl:value-of select="normalize-space(dc:ol/dc:title)"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/org/gcube/informationsystem/registry/impl/porttypes/RegistryFactory.java b/src/org/gcube/informationsystem/registry/impl/porttypes/RegistryFactory.java index 6b1466e..8cca0fc 100644 --- a/src/org/gcube/informationsystem/registry/impl/porttypes/RegistryFactory.java +++ b/src/org/gcube/informationsystem/registry/impl/porttypes/RegistryFactory.java @@ -79,6 +79,8 @@ public class RegistryFactory extends GCUBEPortType { /** the key used to label the Factory Resource */ public static final String NOTIFICATOR_RESOURCE_KEY = "RegistryResource"; + + private static Integer resourceCounter = new Integer(0); /** * {@inheritDoc} @@ -106,8 +108,7 @@ public class RegistryFactory extends GCUBEPortType { */ @SuppressWarnings("unchecked") public String createResource(CreateResourceMessage mess) - throws SchemaValidationFault, RemoteException, - ProfileAlreadyRegisteredFault, ResourceNotAcceptedFault { + throws SchemaValidationFault, RemoteException, ProfileAlreadyRegisteredFault, ResourceNotAcceptedFault { GCUBEResource resource = null; @@ -124,9 +125,7 @@ public class RegistryFactory extends GCUBEPortType { try { resource = ResourceType.valueOf(mess.getType()).getResourceClass(); - resource.load(new BufferedReader(new InputStreamReader( - new ByteArrayInputStream(profile.getBytes("UTF-8")), - "UTF-8"))); + resource.load(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(profile.getBytes("UTF-8")),"UTF-8"))); // the parse Profile class allows to extract from profiles // information about type/SCOPE/UniqueID @@ -135,11 +134,9 @@ public class RegistryFactory extends GCUBEPortType { String[] scopes = mess.getScopes(); if (scopes != null) { for (String scope : scopes) { - logger.debug(resource.getID() - + " Adding Scopes to Profile " + scope); + logger.debug(resource.getID() + " Adding Scopes to Profile " + scope); resource.addScope(GCUBEScope.getScope(scope)); } - } // check ID if (resource.getID() == null || resource.getID().compareTo("") == 0) { @@ -175,14 +172,10 @@ public class RegistryFactory extends GCUBEPortType { } else { // try to create resource try { - logger.debug(resource.getID() - + " Creating the stateful resource for " - + resource.getID()); + logger.debug("Creating the stateful resource N."+ ++resourceCounter + " for " + resource.getID()); ProfileResource presource = (ProfileResource) ProfileContext - .getContext().getWSHome().create( - ProfileContext.getContext().makeKey( - resource.getID()), resource); + .getContext().getWSHome().create(ProfileContext.getContext().makeKey(resource.getID()), resource); presource.store(); // Deleting the WSResource created if != from GHN || RI @@ -203,9 +196,7 @@ public class RegistryFactory extends GCUBEPortType { event.setPayload(resource); ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.CREATE, event); } catch (Exception e) { - logger.warn( - "Error updating Counting info for resource with ID " - + resource.getID(), e); + logger.warn("Error updating Counting info for resource with ID " + resource.getID(), e); } } @@ -256,8 +247,7 @@ public class RegistryFactory extends GCUBEPortType { */ @SuppressWarnings("unchecked") public UpdateResourceResponse updateResource(UpdateResourceMessage mess) - throws RemoteException, SchemaValidationFault, - ResourceNotAcceptedFault, GCUBEFault { + throws RemoteException, SchemaValidationFault, ResourceNotAcceptedFault, GCUBEFault { logger.info("UpdateResource operation invoked"); String ID = mess.getUniqueID();