org.sakaiproject.metaobj.shared.mgt
Class EntityProducerBase

java.lang.Object
  extended byorg.sakaiproject.metaobj.shared.mgt.EntityProducerBase
All Implemented Interfaces:
EntityProducer
Direct Known Subclasses:
MetaobjEntityProducer

public abstract class EntityProducerBase
extends Object
implements EntityProducer

Created by IntelliJ IDEA. User: John Ellis Date: Nov 7, 2005 Time: 1:40:10 PM To change this template use File | Settings | File Templates.


Nested Class Summary
 
Nested classes inherited from class org.sakaiproject.service.legacy.entity.EntityProducer
EntityProducer.ChangeType
 
Constructor Summary
EntityProducerBase()
           
 
Method Summary
 String archive(String siteId, Document doc, Stack stack, String archivePath, List attachments)
          Archive the resources for the given site.
 void destroy()
           
protected  ContentEntityWrapper getContentEntityWrapper(Reference ref)
           
protected  String getContext()
           
 Entity getEntity(Reference ref)
          Access the referenced Entity - the entity will belong to the service.
 Collection getEntityAuthzGroups(Reference ref)
          Access a collection of authorization group ids for security on the for the referenced entity - the entity will belong to the service.
 String getEntityDescription(Reference ref)
          Create an entity description for the entity referenced - the entity will belong to the service.
 EntityManager getEntityManager()
           
 ResourceProperties getEntityResourceProperties(Reference ref)
          Access the resource properties for the referenced entity - the entity will belong to the service.
 String getEntityUrl(Reference ref)
          Access a URL for the referenced entity - the entity will belong to the service.
 HttpAccess getHttpAccess()
          Get the HttpAccess object that supports entity access via the access servlet for my entities.
 void importEntities(String fromContext, String toContext, List ids)
          import Entites from the source context into the destination context
 String merge(String siteId, Element root, String archivePath, String fromSiteId, Map attachmentNames, Map userIdTrans, Set userListAllowImport)
          Merge the resources from the archive into the given site.
 boolean parseEntityReference(String reference, Reference ref)
          If the service recognizes the reference as its own, parse it and fill in the Reference
protected  ReferenceParser parseReference(String wholeRef)
           
 void setEntityManager(EntityManager entityManager)
           
 void setHttpAccess(HttpAccess httpAccess)
           
 void syncWithSiteChange(Site site, EntityProducer.ChangeType change)
          Synchronize any entities related to the Site given this change in the Site, possibly a structural change where a tool is added or removed, or the site is new, or being deleted.
 boolean willArchiveMerge()
           
 boolean willImport()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.service.legacy.entity.EntityProducer
getLabel
 

Constructor Detail

EntityProducerBase

public EntityProducerBase()
Method Detail

willArchiveMerge

public boolean willArchiveMerge()
Specified by:
willArchiveMerge in interface EntityProducer
Returns:
true if the serice wants to be part of archive / merge, false if not.

willImport

public boolean willImport()
Specified by:
willImport in interface EntityProducer
Returns:
true if the serice wants to be part of import, false if not.

archive

public String archive(String siteId,
                      Document doc,
                      Stack stack,
                      String archivePath,
                      List attachments)
Description copied from interface: EntityProducer
Archive the resources for the given site.

Specified by:
archive in interface EntityProducer
Parameters:
siteId - the id of the site.
doc - The document to contain the xml.
stack - The stack of elements, the top of which will be the containing element of the "service.name" element.
archivePath - The path to the folder where we are writing auxilary files.
attachments - A list of attachments - add to this if any attachments need to be included in the archive.
Returns:
A log of status messages from the archive.

merge

public String merge(String siteId,
                    Element root,
                    String archivePath,
                    String fromSiteId,
                    Map attachmentNames,
                    Map userIdTrans,
                    Set userListAllowImport)
Description copied from interface: EntityProducer
Merge the resources from the archive into the given site.

Specified by:
merge in interface EntityProducer
Parameters:
siteId - The id of the site getting imported into.
root - The XML DOM tree of content to merge.
attachmentNames - A map of old attachment name (as found in the DOM) to new attachment name.
Returns:
A log of status messages from the merge.

importEntities

public void importEntities(String fromContext,
                           String toContext,
                           List ids)
Description copied from interface: EntityProducer
import Entites from the source context into the destination context

Specified by:
importEntities in interface EntityProducer
Parameters:
fromContext - The source context
toContext - The destination context
ids - when null, all entities will be imported; otherwise, only entities with those ids will be imported

parseEntityReference

public boolean parseEntityReference(String reference,
                                    Reference ref)
Description copied from interface: EntityProducer
If the service recognizes the reference as its own, parse it and fill in the Reference

Specified by:
parseEntityReference in interface EntityProducer
Parameters:
reference - The reference string to examine.
ref - The Reference object to set with the results of the parse from a recognized reference.
Returns:
true if the reference belonged to the service, false if not.

getContext

protected String getContext()

getEntityDescription

public String getEntityDescription(Reference ref)
Description copied from interface: EntityProducer
Create an entity description for the entity referenced - the entity will belong to the service.

Specified by:
getEntityDescription in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The entity description, or null if one cannot be made.

getEntityResourceProperties

public ResourceProperties getEntityResourceProperties(Reference ref)
Description copied from interface: EntityProducer
Access the resource properties for the referenced entity - the entity will belong to the service.

Specified by:
getEntityResourceProperties in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The ResourceProperties object for the entity, or null if it has none.

getContentEntityWrapper

protected ContentEntityWrapper getContentEntityWrapper(Reference ref)

parseReference

protected ReferenceParser parseReference(String wholeRef)

getEntity

public Entity getEntity(Reference ref)
Description copied from interface: EntityProducer
Access the referenced Entity - the entity will belong to the service.

Specified by:
getEntity in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The Entity, or null if not found.

getEntityUrl

public String getEntityUrl(Reference ref)
Description copied from interface: EntityProducer
Access a URL for the referenced entity - the entity will belong to the service.

Specified by:
getEntityUrl in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The entity's URL, or null if it does not have one.

getEntityAuthzGroups

public Collection getEntityAuthzGroups(Reference ref)
Description copied from interface: EntityProducer
Access a collection of authorization group ids for security on the for the referenced entity - the entity will belong to the service.

Specified by:
getEntityAuthzGroups in interface EntityProducer
Parameters:
ref - The entity reference.
Returns:
The entity's collection of authorization group ids, or null if this cannot be done.

syncWithSiteChange

public void syncWithSiteChange(Site site,
                               EntityProducer.ChangeType change)
Description copied from interface: EntityProducer
Synchronize any entities related to the Site given this change in the Site, possibly a structural change where a tool is added or removed, or the site is new, or being deleted.

Specified by:
syncWithSiteChange in interface EntityProducer
Parameters:
site - The site that has just changed.
change - The ChangeType for the site (newly added, updated, or just removed).

getEntityManager

public EntityManager getEntityManager()

setEntityManager

public void setEntityManager(EntityManager entityManager)

getHttpAccess

public HttpAccess getHttpAccess()
Description copied from interface: EntityProducer
Get the HttpAccess object that supports entity access via the access servlet for my entities.

Specified by:
getHttpAccess in interface EntityProducer
Returns:
The HttpAccess object for my entities, or null if I do not support access.

setHttpAccess

public void setHttpAccess(HttpAccess httpAccess)

destroy

public void destroy()