org.sakaiproject.metaobj.shared.mgt.home
Class XmlElementHome

java.lang.Object
  extended byorg.sakaiproject.metaobj.shared.mgt.home.XmlElementHome
All Implemented Interfaces:
CloneableObjectHome, InitializingBean, PresentableObjectHome, ReadableObjectHome, ResourceLoaderAware, StructuredArtifactHomeInterface, WritableObjectHome
Direct Known Subclasses:
StructuredArtifactHome

public class XmlElementHome
extends Object
implements StructuredArtifactHomeInterface, InitializingBean, ResourceLoaderAware

Created by IntelliJ IDEA. User: John Ellis Date: Apr 9, 2004 Time: 1:22:35 PM To change this template use File | Settings | File Templates.


Field Summary
protected  org.apache.commons.logging.Log logger
           
static String XML_HOME_PATH
           
static String XSD_DIR
           
 
Constructor Summary
XmlElementHome()
           
XmlElementHome(String rootNode)
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 Artifact cloneArtifact(Artifact copy, String newName)
           
 Artifact createInstance()
          Creates an empty instance of this home's object
 Artifact createSample()
          Creates a sample instance of the object with each field filled in with some representative data.
 Collection findByOwner(Agent owner)
          Find all the instances of this home's objects that are owned by the supplied owner.
 org.jdom.Element getArtifactAsXml(Artifact art)
           
 String getDocumentRoot()
           
 String getExternalType()
          Used to get an externally unique type to identify this home across running osp instances
 String getExternalUri(Id artifactId, String name)
           
 IdManager getIdManager()
           
 String getInstruction()
           
 Class getInterface()
           
 Date getModified()
           
 String getRootNode()
           
 SchemaNode getRootSchema()
           
 SchemaNode getSchema()
           
protected  File getSchemaFile(String schemaFileName)
           
 String getSchemaFileName()
           
 String getSiteId()
           
 InputStream getStream(Id artifactId)
           
 Type getType()
           
 String getTypeId()
           
 boolean isInstance(Artifact testObject)
          Determines if the supplied object is handled by this home.
 boolean isSystemOnly()
           
 Artifact load(Id id)
          Load the object from the backing store.
protected  Artifact load(String id)
           
protected  String pathToWebInf()
           
 void prepareInstance(Artifact object)
           
 void refresh()
          re-initialize any configuration
 void remove(Artifact object)
           
 void setIdManager(IdManager idManager)
           
 void setInstruction(String instruction)
           
 void setModified(Date schemaDate)
           
 void setResourceLoader(ResourceLoader resourceLoader)
           
 void setRootNode(String rootNode)
           
 void setSchema(SchemaNode schema)
           
 void setSchemaFileName(String schemaFileName)
           
 void setType(Type type)
           
 void setTypeId(String typeId)
           
 Artifact store(Artifact object)
          Update or add the supplied object to the store.
 Artifact store(String displayName, String contentType, Type type, InputStream in)
           
 Artifact update(Artifact object, InputStream in)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

XSD_DIR

public static final String XSD_DIR
See Also:
Constant Field Values

XML_HOME_PATH

public static final String XML_HOME_PATH
See Also:
Constant Field Values
Constructor Detail

XmlElementHome

public XmlElementHome()

XmlElementHome

public XmlElementHome(String rootNode)
Method Detail

getSchema

public SchemaNode getSchema()
Specified by:
getSchema in interface StructuredArtifactHomeInterface

getDocumentRoot

public String getDocumentRoot()

getSchemaFile

protected File getSchemaFile(String schemaFileName)

setSchema

public void setSchema(SchemaNode schema)

store

public Artifact store(Artifact object)
               throws PersistenceException
Description copied from interface: WritableObjectHome
Update or add the supplied object to the store.

Specified by:
store in interface WritableObjectHome
Parameters:
object - The object to be updated or added
Returns:
The object with info such as Id in the case of add. In the case of update, the object will be returned as supplied.
Throws:
PersistenceException

remove

public void remove(Artifact object)
            throws PersistenceException
Specified by:
remove in interface WritableObjectHome
Throws:
PersistenceException

store

public Artifact store(String displayName,
                      String contentType,
                      Type type,
                      InputStream in)
               throws PersistenceException
Specified by:
store in interface WritableObjectHome
Throws:
PersistenceException

update

public Artifact update(Artifact object,
                       InputStream in)
                throws PersistenceException
Specified by:
update in interface WritableObjectHome
Throws:
PersistenceException

getType

public Type getType()
Specified by:
getType in interface StructuredArtifactHomeInterface

getExternalType

public String getExternalType()
Description copied from interface: ReadableObjectHome
Used to get an externally unique type to identify this home across running osp instances

Specified by:
getExternalType in interface ReadableObjectHome
Returns:
an externally unique type suitable for storage and later import

setType

public void setType(Type type)

load

public Artifact load(Id id)
              throws PersistenceException
Description copied from interface: ReadableObjectHome
Load the object from the backing store.

Specified by:
load in interface ReadableObjectHome
Parameters:
id - Uniquely identifies the object.
Returns:
The loaded object
Throws:
PersistenceException

load

protected Artifact load(String id)
                 throws PersistenceException
Throws:
PersistenceException

createInstance

public Artifact createInstance()
Description copied from interface: ReadableObjectHome
Creates an empty instance of this home's object

Specified by:
createInstance in interface ReadableObjectHome
Returns:
An empty object instance

prepareInstance

public void prepareInstance(Artifact object)
Specified by:
prepareInstance in interface ReadableObjectHome

createSample

public Artifact createSample()
Description copied from interface: ReadableObjectHome
Creates a sample instance of the object with each field filled in with some representative data.

Specified by:
createSample in interface ReadableObjectHome
Returns:
An object instance with sample data filled in.

findByOwner

public Collection findByOwner(Agent owner)
                       throws FinderException
Description copied from interface: ReadableObjectHome
Find all the instances of this home's objects that are owned by the supplied owner. How do we handle permissions here?

Specified by:
findByOwner in interface ReadableObjectHome
Parameters:
owner - The owner in question.
Returns:
A list of objects.
Throws:
FinderException

isInstance

public boolean isInstance(Artifact testObject)
Description copied from interface: ReadableObjectHome
Determines if the supplied object is handled by this home.

Specified by:
isInstance in interface ReadableObjectHome
Parameters:
testObject - the object to be tested.
Returns:
true if the supplied object is handled by this home

refresh

public void refresh()
Description copied from interface: ReadableObjectHome
re-initialize any configuration

Specified by:
refresh in interface ReadableObjectHome

getExternalUri

public String getExternalUri(Id artifactId,
                             String name)
Specified by:
getExternalUri in interface ReadableObjectHome

getStream

public InputStream getStream(Id artifactId)
Specified by:
getStream in interface ReadableObjectHome

isSystemOnly

public boolean isSystemOnly()
Specified by:
isSystemOnly in interface ReadableObjectHome

getInterface

public Class getInterface()
Specified by:
getInterface in interface ReadableObjectHome

getRootNode

public String getRootNode()
Specified by:
getRootNode in interface StructuredArtifactHomeInterface

setRootNode

public void setRootNode(String rootNode)

getModified

public Date getModified()
Specified by:
getModified in interface StructuredArtifactHomeInterface

setModified

public void setModified(Date schemaDate)

getSchemaFileName

public String getSchemaFileName()

setSchemaFileName

public void setSchemaFileName(String schemaFileName)

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.

pathToWebInf

protected String pathToWebInf()

getIdManager

public IdManager getIdManager()

setIdManager

public void setIdManager(IdManager idManager)

getTypeId

public String getTypeId()

setTypeId

public void setTypeId(String typeId)

setResourceLoader

public void setResourceLoader(ResourceLoader resourceLoader)
Specified by:
setResourceLoader in interface ResourceLoaderAware

getInstruction

public String getInstruction()
Specified by:
getInstruction in interface StructuredArtifactHomeInterface

setInstruction

public void setInstruction(String instruction)

getRootSchema

public SchemaNode getRootSchema()
Specified by:
getRootSchema in interface StructuredArtifactHomeInterface

getSiteId

public String getSiteId()
Specified by:
getSiteId in interface StructuredArtifactHomeInterface

cloneArtifact

public Artifact cloneArtifact(Artifact copy,
                              String newName)
                       throws PersistenceException
Specified by:
cloneArtifact in interface CloneableObjectHome
Throws:
PersistenceException

getArtifactAsXml

public org.jdom.Element getArtifactAsXml(Artifact art)
Specified by:
getArtifactAsXml in interface PresentableObjectHome