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

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

public class StructuredArtifactHome
extends XmlElementHome
implements StructuredArtifactHomeInterface, WorksiteAware, ApplicationContextAware, Comparable, StreamableObjectHome

Created by IntelliJ IDEA. User: John Ellis Date: May 17, 2004 Time: 2:52:00 PM To change this template use File | Settings | File Templates.


Field Summary
protected static org.apache.commons.logging.Log logger
           
 
Fields inherited from class org.sakaiproject.metaobj.shared.mgt.home.XmlElementHome
XML_HOME_PATH, XSD_DIR
 
Constructor Summary
StructuredArtifactHome()
           
 
Method Summary
protected  org.jdom.Element addAnnotations(SchemaNode schema)
           
protected  Artifact addArtifact(Artifact object)
           
 Artifact cloneArtifact(Artifact copy, String newName)
           
 int compareTo(Object o)
           
protected  org.jdom.Element createInstructions()
           
 org.jdom.Element getArtifactAsXml(Artifact art)
           
 String getHostBaseUrl()
           
 IdManager getIdManager()
           
protected  InputStream getInfoStream(Artifact object)
          protected InputStream getFileStream(StructuredArtifact xmlObject) { StringBuffer sb = new StringBuffer();

format.format(new Object[]{getHostBaseUrl(), xmlObject.getId().getValue(), getType().getId().getValue(), getWorksiteManager().getCurrentWorksiteId() }, sb, new FieldPosition(0)); logger.debug("redirecting to: " + sb.toString()); InputStream is = new ByteArrayInputStream(sb.toString().getBytes());

return is; }

 PresentableObjectHome getRepositoryHelper()
           
 String getSiteId()
           
 InputStream getStream(Id artifactId)
           
protected  WorksiteManager getWorksiteManager()
           
 boolean isGlobal()
           
 boolean isModifiable()
           
 boolean isSystemOnly()
           
 Artifact load(Id id)
          Load the object from the backing store.
 void remove(Artifact object)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setIdManager(IdManager idManager)
           
 void setRepositoryHelper(PresentableObjectHome repositoryHelper)
           
 void setSiteId(String siteId)
           
 Artifact store(Artifact object)
          Update or add the supplied object to the store.
protected  Artifact updateArtifact(Artifact object)
           
 
Methods inherited from class org.sakaiproject.metaobj.shared.mgt.home.XmlElementHome
afterPropertiesSet, createInstance, createSample, findByOwner, getDocumentRoot, getExternalType, getExternalUri, getInstruction, getInterface, getModified, getRootNode, getRootSchema, getSchema, getSchemaFile, getSchemaFileName, getType, getTypeId, isInstance, load, pathToWebInf, prepareInstance, refresh, setInstruction, setModified, setResourceLoader, setRootNode, setSchema, setSchemaFileName, setType, setTypeId, store, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.metaobj.shared.mgt.home.StructuredArtifactHomeInterface
getInstruction, getModified, getRootNode, getRootSchema, getSchema, getType
 
Methods inherited from interface org.sakaiproject.metaobj.shared.mgt.WritableObjectHome
store, update
 
Methods inherited from interface org.sakaiproject.metaobj.shared.mgt.ReadableObjectHome
createInstance, createSample, findByOwner, getExternalType, getExternalUri, getInterface, isInstance, prepareInstance, refresh
 

Field Detail

logger

protected static final org.apache.commons.logging.Log logger
Constructor Detail

StructuredArtifactHome

public StructuredArtifactHome()
Method Detail

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
Overrides:
store in class XmlElementHome
Throws:
PersistenceException

updateArtifact

protected Artifact updateArtifact(Artifact object)
                           throws PersistenceException
Throws:
PersistenceException

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
Overrides:
load in class XmlElementHome
Throws:
PersistenceException

remove

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

cloneArtifact

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

addArtifact

protected Artifact addArtifact(Artifact object)
                        throws PersistenceException
Throws:
PersistenceException

getInfoStream

protected InputStream getInfoStream(Artifact object)
                             throws PersistenceException
protected InputStream getFileStream(StructuredArtifact xmlObject) { StringBuffer sb = new StringBuffer();

format.format(new Object[]{getHostBaseUrl(), xmlObject.getId().getValue(), getType().getId().getValue(), getWorksiteManager().getCurrentWorksiteId() }, sb, new FieldPosition(0)); logger.debug("redirecting to: " + sb.toString()); InputStream is = new ByteArrayInputStream(sb.toString().getBytes());

return is; }

Throws:
PersistenceException

getHostBaseUrl

public String getHostBaseUrl()

getArtifactAsXml

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

createInstructions

protected org.jdom.Element createInstructions()

addAnnotations

protected org.jdom.Element addAnnotations(SchemaNode schema)

getSiteId

public String getSiteId()
Specified by:
getSiteId in interface StructuredArtifactHomeInterface
Overrides:
getSiteId in class XmlElementHome

setSiteId

public void setSiteId(String siteId)

isModifiable

public boolean isModifiable()

isGlobal

public boolean isGlobal()
Returns:
true if SAD is global (available to all worksites)

getRepositoryHelper

public PresentableObjectHome getRepositoryHelper()

setRepositoryHelper

public void setRepositoryHelper(PresentableObjectHome repositoryHelper)

getIdManager

public IdManager getIdManager()
Overrides:
getIdManager in class XmlElementHome

setIdManager

public void setIdManager(IdManager idManager)
Overrides:
setIdManager in class XmlElementHome

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getStream

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

isSystemOnly

public boolean isSystemOnly()
Specified by:
isSystemOnly in interface ReadableObjectHome
Overrides:
isSystemOnly in class XmlElementHome

getWorksiteManager

protected WorksiteManager getWorksiteManager()