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
This commit is contained in:
parent
a393b71001
commit
fc09428ffe
53
resource.xml
53
resource.xml
|
@ -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>
|
|
|
@ -1,52 +0,0 @@
|
||||||
<Resource>
|
|
||||||
<ID>lucio-test-7</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>
|
|
|
@ -79,6 +79,8 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
|
|
||||||
/** the key used to label the Factory Resource */
|
/** the key used to label the Factory Resource */
|
||||||
public static final String NOTIFICATOR_RESOURCE_KEY = "RegistryResource";
|
public static final String NOTIFICATOR_RESOURCE_KEY = "RegistryResource";
|
||||||
|
|
||||||
|
private static Integer resourceCounter = new Integer(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -106,8 +108,7 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public String createResource(CreateResourceMessage mess)
|
public String createResource(CreateResourceMessage mess)
|
||||||
throws SchemaValidationFault, RemoteException,
|
throws SchemaValidationFault, RemoteException, ProfileAlreadyRegisteredFault, ResourceNotAcceptedFault {
|
||||||
ProfileAlreadyRegisteredFault, ResourceNotAcceptedFault {
|
|
||||||
|
|
||||||
GCUBEResource resource = null;
|
GCUBEResource resource = null;
|
||||||
|
|
||||||
|
@ -124,9 +125,7 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
try {
|
try {
|
||||||
resource = ResourceType.valueOf(mess.getType()).getResourceClass();
|
resource = ResourceType.valueOf(mess.getType()).getResourceClass();
|
||||||
|
|
||||||
resource.load(new BufferedReader(new InputStreamReader(
|
resource.load(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(profile.getBytes("UTF-8")),"UTF-8")));
|
||||||
new ByteArrayInputStream(profile.getBytes("UTF-8")),
|
|
||||||
"UTF-8")));
|
|
||||||
|
|
||||||
// the parse Profile class allows to extract from profiles
|
// the parse Profile class allows to extract from profiles
|
||||||
// information about type/SCOPE/UniqueID
|
// information about type/SCOPE/UniqueID
|
||||||
|
@ -135,11 +134,9 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
String[] scopes = mess.getScopes();
|
String[] scopes = mess.getScopes();
|
||||||
if (scopes != null) {
|
if (scopes != null) {
|
||||||
for (String scope : scopes) {
|
for (String scope : scopes) {
|
||||||
logger.debug(resource.getID()
|
logger.debug(resource.getID() + " Adding Scopes to Profile " + scope);
|
||||||
+ " Adding Scopes to Profile " + scope);
|
|
||||||
resource.addScope(GCUBEScope.getScope(scope));
|
resource.addScope(GCUBEScope.getScope(scope));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// check ID
|
// check ID
|
||||||
if (resource.getID() == null || resource.getID().compareTo("") == 0) {
|
if (resource.getID() == null || resource.getID().compareTo("") == 0) {
|
||||||
|
@ -175,14 +172,10 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
} else {
|
} else {
|
||||||
// try to create resource
|
// try to create resource
|
||||||
try {
|
try {
|
||||||
logger.debug(resource.getID()
|
logger.debug("Creating the stateful resource N."+ ++resourceCounter + " for " + resource.getID());
|
||||||
+ " Creating the stateful resource for "
|
|
||||||
+ resource.getID());
|
|
||||||
|
|
||||||
ProfileResource presource = (ProfileResource) ProfileContext
|
ProfileResource presource = (ProfileResource) ProfileContext
|
||||||
.getContext().getWSHome().create(
|
.getContext().getWSHome().create(ProfileContext.getContext().makeKey(resource.getID()), resource);
|
||||||
ProfileContext.getContext().makeKey(
|
|
||||||
resource.getID()), resource);
|
|
||||||
presource.store();
|
presource.store();
|
||||||
|
|
||||||
// Deleting the WSResource created if != from GHN || RI
|
// Deleting the WSResource created if != from GHN || RI
|
||||||
|
@ -203,9 +196,7 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
event.setPayload(resource);
|
event.setPayload(resource);
|
||||||
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.CREATE, event);
|
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.CREATE, event);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn(
|
logger.warn("Error updating Counting info for resource with ID " + resource.getID(), e);
|
||||||
"Error updating Counting info for resource with ID "
|
|
||||||
+ resource.getID(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,8 +247,7 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public UpdateResourceResponse updateResource(UpdateResourceMessage mess)
|
public UpdateResourceResponse updateResource(UpdateResourceMessage mess)
|
||||||
throws RemoteException, SchemaValidationFault,
|
throws RemoteException, SchemaValidationFault, ResourceNotAcceptedFault, GCUBEFault {
|
||||||
ResourceNotAcceptedFault, GCUBEFault {
|
|
||||||
|
|
||||||
logger.info("UpdateResource operation invoked");
|
logger.info("UpdateResource operation invoked");
|
||||||
String ID = mess.getUniqueID();
|
String ID = mess.getUniqueID();
|
||||||
|
|
Loading…
Reference in New Issue