public class BasicArchiveService extends Object implements org.sakaiproject.archive.api.ArchiveService
...
| Modifier and Type | Field and Description |
|---|---|
String[] |
CT_roles |
String[] |
CT_tools_toImport |
protected org.sakaiproject.entity.api.EntityManager |
m_entityManager
Dependency: EntityManager.
|
protected org.sakaiproject.component.api.ServerConfigurationService |
m_serverConfigurationService
Dependency: ServerConfigurationService.
|
protected String |
m_storagePath
A full path and file name to the storage file.
|
String[] |
SAKAI_roles |
String[] |
sakaiServicesToImport |
HashMap |
tool_draft_flag |
protected static HashMap |
userIdTrans |
protected HashSet |
usersListAllowImport |
String[] |
WT_roles |
String[] |
WT_tools_toImport |
| Constructor and Description |
|---|
BasicArchiveService() |
| Modifier and Type | Method and Description |
|---|---|
String |
archive(String siteId)
Create an archive for the resources of a site.
|
protected static String |
archiveSite(org.sakaiproject.site.api.Site site,
Document doc,
Stack stack)
Archive the site definition.
|
protected static String |
archiveUsers(org.sakaiproject.site.api.Site site,
Document doc,
Stack stack)
Archive the users defined in this site (internal users only).
|
boolean |
checkSakaiRole(String siteId,
String userId)
When Sakai is importing an item archived by Sakai, check the creator's role first.
|
protected boolean |
checkSakaiService(String serviceName) |
protected boolean |
checkSystemRole(String system,
String roleId)
When Sakai is importing a role in site.xml, check if it is a qualified role.
|
void |
destroy()
Final cleanup.
|
void |
init()
Final initialization, once all dependencies are set.
|
String |
merge(String fileName,
String siteId,
String creatorId)
Process a merge for the file, or if it's a directory, for all contained files (one level deep).
|
protected void |
mergeSite(String siteId,
String fromSiteId,
Element element,
HashMap useIdTrans,
String creatorId)
Merge the site definition from the site part of the archive file into the site service.
|
protected void |
mergeSiteInfo(Element el,
String siteId)
Merge the site info like description from the site part of the archive file into the site service.
|
protected void |
mergeSiteRoles(Element el,
String siteId,
HashMap useIdTrans)
Merge the the permission-roles settings into the site
|
protected String |
mergeUsers(Element element,
HashMap useIdTrans)
Merge the user list into the the system.
|
protected void |
processMerge(String fileName,
String siteId,
StringBuilder results,
Map attachmentNames,
String creatorId)
Read in an archive file and merge the entries into the specified site.
|
void |
setEntityManager(org.sakaiproject.entity.api.EntityManager service)
Dependency: EntityManager.
|
void |
setServerConfigurationService(org.sakaiproject.component.api.ServerConfigurationService service)
Dependency: ServerConfigurationService.
|
void |
setStoragePath(String path)
Configuration: Set the Storage Path.
|
protected String |
translateServiceName(String name)
Old archives have the old CHEF 1.2 service names...
|
protected void |
unlock(String lock,
String reference)
Check security permission.
|
protected String m_storagePath
protected static final HashMap userIdTrans
protected HashSet usersListAllowImport
public String[] SAKAI_roles
public String[] CT_roles
public String[] WT_roles
public String[] sakaiServicesToImport
public String[] CT_tools_toImport
public String[] WT_tools_toImport
public HashMap tool_draft_flag
protected org.sakaiproject.component.api.ServerConfigurationService m_serverConfigurationService
protected org.sakaiproject.entity.api.EntityManager m_entityManager
public void setServerConfigurationService(org.sakaiproject.component.api.ServerConfigurationService service)
service - The ServerConfigurationService.public void setStoragePath(String path)
path - The storage path.public void setEntityManager(org.sakaiproject.entity.api.EntityManager service)
service - The EntityManager.public void init()
public void destroy()
public String archive(String siteId)
archive in interface org.sakaiproject.archive.api.ArchiveServicesiteId - The id of the site to archive.protected static String archiveSite(org.sakaiproject.site.api.Site site, Document doc, Stack stack)
site - 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 "site" element.protected static String archiveUsers(org.sakaiproject.site.api.Site site, Document doc, Stack stack)
site - 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 "site" element.public String merge(String fileName, String siteId, String creatorId)
merge in interface org.sakaiproject.archive.api.ArchiveServicefileName - The site name (for the archive file) to read from.mergeId - The id string to use to make ids in the merge consistent and unique.creatorId - The creator id
If null or blank, the date/time string of the merge is used.public boolean checkSakaiRole(String siteId, String userId)
siteId - userId - protected boolean checkSystemRole(String system, String roleId)
roleId - protected boolean checkSakaiService(String serviceName)
protected void processMerge(String fileName, String siteId, StringBuilder results, Map attachmentNames, String creatorId)
fileName - The site name (for the archive file) to read from.siteId - The id of the site to merge the content into.results - A buffer to accumulate result messages.attachmentNames - A map of old to new attachment names.useIdTrans - A map of old WorkTools id to new Ctools idcreatorId - The creator idprotected void unlock(String lock, String reference) throws org.sakaiproject.exception.PermissionException
lock - The lock id string.reference - The resource's reference string, or null if no resource is involved.org.sakaiproject.exception.PermissionException - thrown if the user does not have accessprotected void mergeSiteInfo(Element el, String siteId) throws org.sakaiproject.exception.IdInvalidException, org.sakaiproject.exception.IdUsedException, org.sakaiproject.exception.PermissionException, org.sakaiproject.exception.IdUnusedException, org.sakaiproject.exception.InUseException
element - The XML DOM tree of messages to merge.siteId - The id of the site getting imported into.org.sakaiproject.exception.IdInvalidExceptionorg.sakaiproject.exception.IdUsedExceptionorg.sakaiproject.exception.PermissionExceptionorg.sakaiproject.exception.IdUnusedExceptionorg.sakaiproject.exception.InUseExceptionprotected void mergeSiteRoles(Element el, String siteId, HashMap useIdTrans) throws org.sakaiproject.exception.PermissionException
element - The XML DOM tree of messages to merge.siteId - The id of the site getting imported into.org.sakaiproject.exception.PermissionExceptionprotected String mergeUsers(Element element, HashMap useIdTrans) throws org.sakaiproject.exception.IdInvalidException, org.sakaiproject.exception.IdUsedException, org.sakaiproject.exception.PermissionException
element - The XML DOM tree of messages to merge.org.sakaiproject.exception.IdInvalidExceptionorg.sakaiproject.exception.IdUsedExceptionorg.sakaiproject.exception.PermissionExceptionprotected void mergeSite(String siteId, String fromSiteId, Element element, HashMap useIdTrans, String creatorId)
siteId - The id of the site getting imported into.fromSiteId - The id of the site the archive was made from.element - The XML DOM tree of messages to merge.creatorId - The creator idCopyright © 2003-2014 Sakai Foundations. All Rights Reserved.