Hi sivasvn here is a typical code of creating image, resources in DMS

public class LmmVersionHandler extends DefaultModuleVersionHandler {
        String imagesPattern = "/lmm-module/themes/classical/images/.*";
        String resourcesPattern = "/lmm-module/themes/classical/css/.*";
        String templatesPattern = "/lmm-module/templates/.*";
        String[] images = ClasspathResourcesUtil.findResources(imagesPattern);
        String[] resources = 
ClasspathResourcesUtil.findResources(resourcesPattern);
        

        class MyInstallResourcesIntoDMSTask extends InstallResourcesIntoDMSTask 
{
                @Override
                public void execute(InstallContext installContext)
                                throws TaskExecutionException {
                        super.execute(installContext);
                        System.out.println("[LMM Module] - Installing images : "
                                        + Arrays.deepToString(images));
                }

                public MyInstallResourcesIntoDMSTask(String pattern) {
                        super(pattern);
                }
        }

        @Override
        protected List<Task> getExtraInstallTasks(InstallContext 
installContext) {
                List<Task> installTasks = new ArrayList<Task>();
                installTasks.addAll(super.getExtraInstallTasks(installContext));
                installTasks.add(new WarnTask("Installation",
                                "Installing lmm module resources"));
                if (images.length > 0) {
                        installTasks.add(new 
MyInstallResourcesIntoDMSTask(imagesPattern));
                }
                if (resources.length > 0) {
                        installTasks.add(new 
InstallResourcesTask(resourcesPattern,
                                        "processedCss", 
STKResourceModel.class.getName()));
                }
                //TemplatesInstallTask()
                //new TemplatesInstallTask(
                //installTasks.add(new TemplatesInstallTask(templatesPattern, 
true));
                return installTasks;
        }

        @Override
        protected List<Task> getDefaultUpdateTasks(Version forVersion) {
                final List<Task> updateTasks = new ArrayList<Task>();
                updateTasks.addAll(super.getDefaultUpdateTasks(forVersion));
                updateTasks
                                .add(new WarnTask("Update", "Updating lmm 
module resources"));
                if (images.length > 0) {
                        updateTasks.add(new 
MyInstallResourcesIntoDMSTask(imagesPattern));
                }
                if (resources.length > 0) {
                        updateTasks.add(new 
InstallResourcesTask(resourcesPattern,
                                        "processedCss", 
STKResourceModel.class.getName()));
                }
                // ?
                // Install js
                // Install site, template, paragraph, dialog
                return updateTasks;
        }

        public LmmVersionHandler() {

        }
}

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=a145fb83-3b98-4dec-a268-9048820fef4d


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to