public class ImportExportBaseService extends JahiaService implements ImportExportService, Observer
| Modifier and Type | Field and Description |
|---|---|
static String |
DYNAMIC_MOUNT_POINT_ATTR |
static String |
EXPORT_PROPERTIES |
static String |
LIVE_REPOSITORY_XML |
static String |
MOUNTS_ZIP |
static String |
REFERENCES_ZIP |
static String |
REPOSITORY_XML |
static String |
ROLES_ZIP |
static String |
SERVER_PERMISSIONS_XML |
static String |
SITE_PROPERTIES |
static String |
STATIC_MOUNT_POINT_ATTR |
static String |
USERS_XML |
static String |
USERS_ZIP |
settingsBeanDATE_FORMAT, FROM, INCLUDE_ALL_FILES, INCLUDE_DEFINITIONS, INCLUDE_LIVE_EXPORT, INCLUDE_MOUNTS, INCLUDE_ROLES, INCLUDE_SITE_INFOS, INCLUDE_TEMPLATES, INCLUDE_USERS, JAHIA_URI, NO_RECURSE, SERVER_DIRECTORY, SKIP_BINARY, SYSTEM_VIEW, TO, VIEW_ACL, VIEW_CONTENT, VIEW_JAHIALINKS, VIEW_METADATA, VIEW_PID, VIEW_VERSION, VIEW_WORKFLOW, XSL_PATH| Modifier and Type | Method and Description |
|---|---|
void |
cleanFilesList(File expandedFolder,
List<String> fileList)
Remove the list of files temporarily expanded to the given folder.
|
static String |
detectImportContentType(String declaredContentType,
String fileName)
Helper method to determine which type of the import the uploaded file represents.
|
int |
detectXmlFormat(InputStream is)
Detects the type of the import from the provided stream.
|
JCRNodeWrapper |
ensureDir(JCRSessionWrapper session,
String path,
JahiaSite site) |
void |
ensureFile(JCRSessionWrapper session,
String path,
InputStream inputStream,
String type,
JahiaSite destSite) |
void |
exportAll(OutputStream outputStream,
Map<String,Object> params)
Performs the full repository export into the provided output stream using the specified parameters.
|
void |
exportNode(JCRNodeWrapper node,
JCRNodeWrapper exportRoot,
OutputStream out,
Map<String,Object> params)
Export JCR node as xml
|
void |
exportSites(OutputStream outputStream,
Map<String,Object> params,
List<JCRSiteNode> sites)
Export complete sites
|
void |
exportZip(JCRNodeWrapper node,
JCRNodeWrapper exportRoot,
OutputStream out,
Map<String,Object> params)
Export JCR content along with binaries into a zip
|
List<AttributeProcessor> |
getAttributeProcessors()
Returns a list of configured attribute processors for the import.
|
File |
getFileList(org.springframework.core.io.Resource file,
Map<String,Long> sizes,
List<String> fileList)
Gets the list of files from the given ZIP file.
|
static ImportExportBaseService |
getInstance() |
void |
importCategories(Category rootCategory,
InputStream is)
Performs the import of categories from the provided import stream into the specified root category.
|
void |
importSiteZip(File file,
JCRSessionWrapper session)
Import the sitee from the specified file.
|
void |
importSiteZip(JCRNodeWrapper nodeWrapper)
Import the site from the specified file node.
|
void |
importSiteZip(org.springframework.core.io.Resource file)
Import the site from the specified resource.
|
void |
importSiteZip(org.springframework.core.io.Resource file,
JahiaSite site,
Map<Object,Object> infos)
Import a full site zip into a newly created site.
|
void |
importSiteZip(org.springframework.core.io.Resource file,
JahiaSite site,
Map<Object,Object> infos,
org.springframework.core.io.Resource legacyMappingFilePath,
org.springframework.core.io.Resource legacyDefinitionsFilePath)
Import a full site zip into a newly created site.
|
void |
importSiteZip(org.springframework.core.io.Resource file,
JahiaSite site,
Map<Object,Object> infos,
org.springframework.core.io.Resource legacyMappingFilePath,
org.springframework.core.io.Resource legacyDefinitionsFilePath,
JCRSessionWrapper session)
Import a full site zip into a newly created site.
|
void |
importSiteZip(org.springframework.core.io.Resource file,
JCRSessionWrapper session)
Import the site from the specified resource using the provided JCR session.
|
List<String[]> |
importUsers(File file)
Performs a batch import of users from the provided file
|
void |
importXML(String parentNodePath,
InputStream content,
int rootBehavior)
Performs an import of the XML content, detecting its type: users,
categories or general JCR content.
|
void |
importXML(String parentNodePath,
InputStream content,
int rootBehavior,
Map<String,List<String>> references,
JCRSessionWrapper session)
Imports the provided content.
|
void |
importZip(String parentNodePath,
org.springframework.core.io.Resource file,
int rootBehavior)
Performs an import of the ZIP file.
|
void |
importZip(String parentNodePath,
org.springframework.core.io.Resource file,
int rootBehaviour,
JCRSessionWrapper session)
Performs an import of the ZIP file.
|
void |
importZip(String parentNodePath,
org.springframework.core.io.Resource file,
int rootBehaviour,
JCRSessionWrapper session,
Set<String> filesToIgnore,
boolean useReferenceKeeper)
Imports the content of the specified resource.
|
void |
setAttributeProcessors(List<AttributeProcessor> attributeProcessors)
Sets a list of configured attribute processors for the import.
|
void |
setCategoryService(CategoryService categoryService)
Injects an instance of the category service
|
void |
setExpandImportedFilesOnDisk(boolean expandImportedFilesOnDisk) |
void |
setExpandImportedFilesOnDiskPath(String expandImportedFilesOnDiskPath) |
void |
setFileWatcherService(JahiaFileWatcherService fileWatcherService) |
void |
setJcrStoreService(JCRStoreService jcrStoreService) |
void |
setLegacyPidMappingTool(LegacyPidMappingTool legacyPidMappingTool) |
void |
setPostImportPatcher(PostImportPatcher postImportPatcher) |
void |
setSchedulerService(SchedulerService schedulerService) |
void |
setSitesService(JahiaSitesService sitesService) |
void |
setTemplatePackageRegistry(TemplatePackageRegistry templatePackageRegistry) |
void |
setXmlContentTransformers(List<XMLContentTransformer> xmlContentTransformers) |
void |
start() |
void |
stop() |
void |
update(Observable o,
Object arg) |
ValidationResults |
validateImportFile(JCRSessionWrapper session,
InputStream is,
String contentType,
List<String> installedModules)
Validates a JCR content import file in document format and returns expected failures.
|
getSettingsBean, setSettingsBeanpublic static final String REPOSITORY_XML
public static final String LIVE_REPOSITORY_XML
public static final String USERS_XML
public static final String USERS_ZIP
public static final String SERVER_PERMISSIONS_XML
public static final String SITE_PROPERTIES
public static final String EXPORT_PROPERTIES
public static final String MOUNTS_ZIP
public static final String REFERENCES_ZIP
public static final String ROLES_ZIP
public static final String STATIC_MOUNT_POINT_ATTR
public static final String DYNAMIC_MOUNT_POINT_ATTR
public static ImportExportBaseService getInstance()
public static String detectImportContentType(String declaredContentType, String fileName)
declaredContentType - the declared content typefileName - the uploaded file namepublic void start()
start in class JahiaServicepublic void setExpandImportedFilesOnDisk(boolean expandImportedFilesOnDisk)
public void setExpandImportedFilesOnDiskPath(String expandImportedFilesOnDiskPath)
public List<AttributeProcessor> getAttributeProcessors()
public void setAttributeProcessors(List<AttributeProcessor> attributeProcessors)
attributeProcessors - a list of configured attribute processors for the importpublic void stop()
stop in class JahiaServicepublic void setSitesService(JahiaSitesService sitesService)
public void setSchedulerService(SchedulerService schedulerService)
public void setJcrStoreService(JCRStoreService jcrStoreService)
public void setFileWatcherService(JahiaFileWatcherService fileWatcherService)
public void exportAll(OutputStream outputStream, Map<String,Object> params) throws JahiaException, javax.jcr.RepositoryException, IOException, SAXException, TransformerException
ImportExportServiceexportAll in interface ImportExportServiceoutputStream - the output stream to write exported content intoparams - the export optionsJahiaException - in case of processing errorsjavax.jcr.RepositoryException - for JCR-related errorsIOException - I/O communication errorsSAXException - in case of a parsing exceptionsTransformerException - XSLT transformation errorspublic void exportSites(OutputStream outputStream, Map<String,Object> params, List<JCRSiteNode> sites) throws javax.jcr.RepositoryException, IOException, SAXException, TransformerException
ImportExportServiceexportSites in interface ImportExportServicejavax.jcr.RepositoryException - in case of JCR-related errorsIOExceptionSAXExceptionTransformerExceptionpublic void exportZip(JCRNodeWrapper node, JCRNodeWrapper exportRoot, OutputStream out, Map<String,Object> params) throws javax.jcr.RepositoryException, SAXException, IOException, TransformerException
ImportExportServiceexportZip in interface ImportExportServicenode - node to exportout - outputstreamparams - @throws JahiaExceptionjavax.jcr.RepositoryException - in case of JCR-related errorsSAXExceptionIOExceptionTransformerExceptionpublic void exportNode(JCRNodeWrapper node, JCRNodeWrapper exportRoot, OutputStream out, Map<String,Object> params) throws javax.jcr.RepositoryException, SAXException, IOException, TransformerException
ImportExportServiceexportNode in interface ImportExportServicenode - node to exportout - outputstreamparams - @throws JahiaExceptionjavax.jcr.RepositoryException - in case of JCR-related errorsSAXExceptionIOExceptionTransformerExceptionpublic void importSiteZip(JCRNodeWrapper nodeWrapper) throws javax.jcr.RepositoryException, IOException, JahiaException
ImportExportServiceimportSiteZip in interface ImportExportServicenodeWrapper - the file node to read content of the imported site fromjavax.jcr.RepositoryException - in case of a JCR errorIOException - in case of an I/O exceptionJahiaException - if a processing error happenspublic void importSiteZip(File file, JCRSessionWrapper session) throws javax.jcr.RepositoryException, IOException, JahiaException
ImportExportServiceimportSiteZip in interface ImportExportServicefile - the file to read content of the imported site fromsession - current JCR session instancejavax.jcr.RepositoryException - in case of a JCR errorIOException - in case of an I/O exceptionJahiaException - if a processing error happenspublic void importSiteZip(org.springframework.core.io.Resource file)
throws javax.jcr.RepositoryException,
IOException,
JahiaException
ImportExportServiceimportSiteZip in interface ImportExportServicefile - the resource to read content of the imported site fromjavax.jcr.RepositoryException - in case of a JCR errorIOException - in case of an I/O exceptionJahiaException - if a processing error happenspublic void importSiteZip(org.springframework.core.io.Resource file,
JCRSessionWrapper session)
throws javax.jcr.RepositoryException,
IOException
ImportExportServiceimportSiteZip in interface ImportExportServicefile - the resource to read content of the imported site fromsession - current JCR session to use for the importjavax.jcr.RepositoryException - in case of a JCR errorIOException - in case of an I/O exceptionpublic void importSiteZip(org.springframework.core.io.Resource file,
JahiaSite site,
Map<Object,Object> infos)
throws javax.jcr.RepositoryException,
IOException
ImportExportServiceimportSiteZip in interface ImportExportServicefile - Zip filesite - The new site where to importinfos - site infosjavax.jcr.RepositoryException - in case of JCR-related errorsIOExceptionpublic void importSiteZip(org.springframework.core.io.Resource file,
JahiaSite site,
Map<Object,Object> infos,
org.springframework.core.io.Resource legacyMappingFilePath,
org.springframework.core.io.Resource legacyDefinitionsFilePath)
throws javax.jcr.RepositoryException,
IOException
ImportExportServiceimportSiteZip in interface ImportExportServicefile - Zip filesite - The new site where to importinfos - site infoslegacyMappingFilePath - path to the legacy mappingslegacyDefinitionsFilePath - path for the legacy definitionsjavax.jcr.RepositoryException - in case of JCR-related errorsIOExceptionpublic void importSiteZip(org.springframework.core.io.Resource file,
JahiaSite site,
Map<Object,Object> infos,
org.springframework.core.io.Resource legacyMappingFilePath,
org.springframework.core.io.Resource legacyDefinitionsFilePath,
JCRSessionWrapper session)
throws javax.jcr.RepositoryException,
IOException
file - Zip filesite - The new site where to importinfos - site infoslegacyMappingFilePath - path to the legacy mappingslegacyDefinitionsFilePath - path for the legacy definitionssession - the current JCR session to use for the importjavax.jcr.RepositoryException - in case of JCR-related errorsIOException - in case of I/O errorspublic void cleanFilesList(File expandedFolder, List<String> fileList)
expandedFolder - path to the expanded folder on disk - if null, do nothingfileList - list of files expanded to diskpublic JCRNodeWrapper ensureDir(JCRSessionWrapper session, String path, JahiaSite site) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void ensureFile(JCRSessionWrapper session, String path, InputStream inputStream, String type, JahiaSite destSite)
public void importCategories(Category rootCategory, InputStream is)
ImportExportServiceimportCategories in interface ImportExportServicerootCategory - the root category to useis - the input stream to read import content frompublic List<String[]> importUsers(File file) throws IOException, javax.jcr.RepositoryException
ImportExportServiceimportUsers in interface ImportExportServicefile - a file to read user data fromIOException - in case of a reading/parsing errorjavax.jcr.RepositoryExceptionpublic int detectXmlFormat(InputStream is)
is - the input stream to read imported content fromXMLFormatDetectionHandlerpublic void importXML(String parentNodePath, InputStream content, int rootBehavior) throws IOException, javax.jcr.RepositoryException, JahiaException
ImportExportServiceimportXML in interface ImportExportServiceparentNodePath - the path of the parent node, where the content should be
importedcontent - the XML content streamrootBehavior - Ignore root xml element - can be used to import multiple nodes in the same node, using one single
importIOException - in case of read/write errorsjavax.jcr.RepositoryException - in case of repository operation errorsJahiaException - in case of errors during categories importpublic void importXML(String parentNodePath, InputStream content, int rootBehavior, Map<String,List<String>> references, JCRSessionWrapper session) throws IOException, javax.jcr.RepositoryException, JahiaException
parentNodePath - the node to use as a parent for the importcontent - the input stream to read content fromrootBehavior - the root behaviour (see DocumentViewImportHandler)session - current JCR sessionIOException - in case of an I/O operation errorjavax.jcr.RepositoryException - in case of a JCR-related errorJahiaException - in case of a processing errorpublic void importZip(String parentNodePath, org.springframework.core.io.Resource file, int rootBehavior) throws IOException, javax.jcr.RepositoryException
ImportExportServiceimportZip in interface ImportExportServicerootBehavior - Ignore root xml element - can be used to import multiple nodes in the same node, using one single
importIOExceptionjavax.jcr.RepositoryException - in case of JCR-related errorspublic ValidationResults validateImportFile(JCRSessionWrapper session, InputStream is, String contentType, List<String> installedModules)
validateImportFile in interface ImportExportServicesession - current JCR session instanceis - the input stream with a JCR content in document formatcontentType - the content type for the contentinstalledModules - the list of installed modules, where the first element is a template set namepublic void importZip(String parentNodePath, org.springframework.core.io.Resource file, int rootBehaviour, JCRSessionWrapper session) throws IOException, javax.jcr.RepositoryException
ImportExportServiceimportZip in interface ImportExportServicerootBehaviour - Ignore root xml element - can be used to import multiple nodes in the same node, using one single
importIOExceptionjavax.jcr.RepositoryException - in case of JCR-related errorspublic void importZip(String parentNodePath, org.springframework.core.io.Resource file, int rootBehaviour, JCRSessionWrapper session, Set<String> filesToIgnore, boolean useReferenceKeeper) throws IOException, javax.jcr.RepositoryException
importZip in interface ImportExportServiceparentNodePath - the node to use as a parent for the importfile - the file with the content to be importedrootBehaviour - the root behaviour (see DocumentViewImportHandler)session - current JCR sessionfilesToIgnore - set of files to be skippedIOException - in case of an I/O operation errorjavax.jcr.RepositoryException - in case of a JCR-related errorpublic File getFileList(org.springframework.core.io.Resource file, Map<String,Long> sizes, List<String> fileList) throws IOException
file - ZIP file with content to be importedsizes - collection holding sizes of uncompressed file elementsfileList - collection into which the files from ZIP file will be addedIOExceptionpublic void setCategoryService(CategoryService categoryService)
categoryService - category service instancepublic void setXmlContentTransformers(List<XMLContentTransformer> xmlContentTransformers)
public void setLegacyPidMappingTool(LegacyPidMappingTool legacyPidMappingTool)
public void setPostImportPatcher(PostImportPatcher postImportPatcher)
public void setTemplatePackageRegistry(TemplatePackageRegistry templatePackageRegistry)
public void update(Observable o, Object arg)
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.