org.gcube.informationsystem.collector.impl.resources
Class BaseDAIXResource

java.lang.Object
  extended by org.gcube.informationsystem.collector.impl.resources.BaseDAIXResource
All Implemented Interfaces:
DAIXResource
Direct Known Subclasses:
GCUBEInstanceStateResource, GCUBEProfileResource

public class BaseDAIXResource
extends java.lang.Object
implements DAIXResource

Encapsulates a WS-DAIX data resource which represents a collection or document in an XML database.

Author:
Manuele Simi (ISTI-CNR)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.gcube.informationsystem.collector.impl.resources.DAIXResource
DAIXResource.MalformedResourceException
 
Constructor Summary
BaseDAIXResource()
           
BaseDAIXResource(java.lang.String resourceName)
           
 
Method Summary
 void deserializeFromIndexing(java.lang.String content)
          Deserializes the content retrieved from the XML storage
 boolean equals(java.lang.Object obj)
          Indicates whether some other resource is "equal to" this one
 java.lang.String getCollectionName()
           
 org.w3c.dom.Document getContent()
          The resource content as Document
 java.lang.String getResourceName()
           
 java.net.URI getResourceURI()
           
 int hashCode()
          
 java.lang.String serializeForIndexing()
          Creates a serialization of the resource to be indexed
 void setCollectionName(java.lang.String collectionName)
           
 void setContent(org.w3c.dom.Document content)
           
 void setContent(java.lang.String content)
           
 void setResourceName(java.lang.String resourceName)
          Sets the resource unique name
 void setResourceURI(java.net.URI resourceURI)
           
 java.lang.String toString()
           
 java.lang.String toStringFromElement(java.lang.String elementName)
          Returns a sub-serialization of the given XML, starting from the element name
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseDAIXResource

public BaseDAIXResource()

BaseDAIXResource

public BaseDAIXResource(java.lang.String resourceName)
Method Detail

getResourceName

public java.lang.String getResourceName()
Specified by:
getResourceName in interface DAIXResource
Returns:
the resource name

setResourceName

public void setResourceName(java.lang.String resourceName)
Description copied from interface: DAIXResource
Sets the resource unique name

Specified by:
setResourceName in interface DAIXResource
Parameters:
resourceName - the resourceName to set

getResourceURI

public java.net.URI getResourceURI()
Specified by:
getResourceURI in interface DAIXResource
Returns:
the resourceURI

setResourceURI

public void setResourceURI(java.net.URI resourceURI)
Parameters:
resourceURI - the resourceURI to set

getCollectionName

public java.lang.String getCollectionName()
                                   throws DAIXResource.MalformedResourceException
Specified by:
getCollectionName in interface DAIXResource
Returns:
the name of the collection including the resource
Throws:
MalformedResourceException
DAIXResource.MalformedResourceException

setCollectionName

public void setCollectionName(java.lang.String collectionName)
Specified by:
setCollectionName in interface DAIXResource
Parameters:
collectionName - the name of the collection including the resource

getContent

public org.w3c.dom.Document getContent()
                                throws DAIXResource.MalformedResourceException
Description copied from interface: DAIXResource
The resource content as Document

Specified by:
getContent in interface DAIXResource
Returns:
Throws:
DAIXResource.MalformedResourceException

setContent

public void setContent(org.w3c.dom.Document content)
                throws DAIXResource.MalformedResourceException
Specified by:
setContent in interface DAIXResource
Throws:
DAIXResource.MalformedResourceException

setContent

public void setContent(java.lang.String content)
                throws DAIXResource.MalformedResourceException
Specified by:
setContent in interface DAIXResource
Throws:
DAIXResource.MalformedResourceException

toString

public java.lang.String toString()
Specified by:
toString in interface DAIXResource
Overrides:
toString in class java.lang.Object

toStringFromElement

public java.lang.String toStringFromElement(java.lang.String elementName)
                                     throws DAIXResource.MalformedResourceException
Returns a sub-serialization of the given XML, starting from the element name

Specified by:
toStringFromElement in interface DAIXResource
Parameters:
xml - the source XML serialization
elementName - the name of the element
Returns:
the node content serialized as string
Throws:
java.lang.Exception - if the serialization fails
DAIXResource.MalformedResourceException

hashCode

public int hashCode()

Specified by:
hashCode in interface DAIXResource
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other resource is "equal to" this one

Specified by:
equals in interface DAIXResource
Overrides:
equals in class java.lang.Object
Parameters:
obj - the other resource to compare
Returns:
true if the resource is the same to this one

deserializeFromIndexing

public void deserializeFromIndexing(java.lang.String content)
                             throws DAIXResource.MalformedResourceException
Deserializes the content retrieved from the XML storage

Specified by:
deserializeFromIndexing in interface DAIXResource
Parameters:
content - the content
Throws:
DAIXResource.MalformedResourceException

serializeForIndexing

public java.lang.String serializeForIndexing()
Creates a serialization of the resource to be indexed

Specified by:
serializeForIndexing in interface DAIXResource
Returns:
the serialized resource