[opencms-dev] Can module export be done from the command line?
Alexander Kandzior
alex at opencms.org
Tue Apr 12 15:57:27 CEST 2005
> I can't see a command in the CmsShell to do a module export.
> The exportResources command can export all files, but does
> not write a manifest.xml
>
> Can exports be run - somehow - from the command line?
No, currently this is not possible, even though it would be pretty easy to
implement in class org.opencms.main.CmsShellCommands, like so:
public void exportModule(String moduleName, String fileName) throws
Exception {
CmsModule module = OpenCms.getModuleManager().getModule(moduleName);
if (module == null) {
throw new CmsException("Unknown module: " + moduleName);
}
String[] resources = new String[module.getResources().size()];
System.arraycopy(module.getResources().toArray(), 0, resources, 0,
resources.length);
// generate a module export handler
CmsModuleImportExportHandler moduleExportHandler = new
CmsModuleImportExportHandler();
moduleExportHandler.setFileName(fileName);
moduleExportHandler.setAdditionalResources(resources);
moduleExportHandler.setModuleName(module.getName().replace('\\',
'/'));
moduleExportHandler.setDescription("Module export of " +
moduleExportHandler.getModuleName());
// export the module
OpenCms.getImportExportManager().exportData(m_cms,
moduleExportHandler, new CmsShellReport());
}
Best Regards,
Alex.
Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com
More information about the opencms-dev
mailing list