/** * Gets the virtual resources for the export folder.<p> * * @param cms the CMS context * @return the list of resources for the export folder * * @throws CmsException if something goes wrong */ private List<CmsResource> getVirtualResourcesForExport(CmsObject cms) throws CmsException { List<CmsResource> virtualResources = Lists.newArrayList(); for (String name : OpenCms.getModuleManager().getImportExportRepository().getModuleFileNames()) { String path = CmsStringUtil.joinPaths(EXPORT_PATH, name); CmsResource res = createFakeBinaryFile(path); virtualResources.add(res); } return virtualResources; }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#deleteResource(org.opencms.file.CmsObject, java.lang.String, org.opencms.file.CmsResource.CmsResourceDeleteMode) */ @Override public boolean deleteResource(CmsObject cms, String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException { if (matchParentPath(EXPORT_PATH, resourcename)) { String fileName = CmsResource.getName(resourcename); boolean result = OpenCms.getModuleManager().getImportExportRepository().deleteModule(fileName); return result; } else { return false; } }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#writeFile(org.opencms.file.CmsObject, org.opencms.file.CmsFile) */ @Override public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException { if (matchParentPath(IMPORT_PATH, resource.getRootPath())) { OpenCms.getModuleManager().getImportExportRepository().importModule( CmsResource.getName(resource.getRootPath()), resource.getContents()); m_importFileUpdateCache.put(resource.getRootPath(), Long.valueOf(System.currentTimeMillis())); m_importDataCache.put(resource.getRootPath(), resource); return resource; } else { return super.writeFile(cms, resource); } }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#createResource(org.opencms.file.CmsObject, java.lang.String, int, byte[], java.util.List) */ @Override public CmsResource createResource( CmsObject cms, String resourcename, int type, byte[] content, List<CmsProperty> properties) throws CmsException, CmsIllegalArgumentException { if (matchParentPath(IMPORT_PATH, resourcename)) { CmsResource res = createFakeBinaryFile(resourcename, 0); CmsFile file = new CmsFile(res); file.setContents(content); OpenCms.getModuleManager().getImportExportRepository().importModule( CmsResource.getName(resourcename), content); m_importFileUpdateCache.put(resourcename, Long.valueOf(System.currentTimeMillis())); return file; } else { return super.createResource(cms, resourcename, type, content, properties); } }
byte[] data = OpenCms.getModuleManager().getImportExportRepository().getExportedModuleData( CmsResource.getName(resourcepath), cms.getRequestContext().getCurrentProject()); byte[] data = OpenCms.getModuleManager().getImportExportRepository().getModuleLog().readLog(moduleName); resultFile.setContents(data); return resultFile;