Package org.andromda.core.common

Examples of org.andromda.core.common.ResourceWriter


        String cartridgeName = null;
        try
        {
            boolean lastModifiedCheck = true;
            long lastModified = 0;
            final ResourceWriter writer = ResourceWriter.instance();

            // - get the time from the model that has the latest modified time
            for (int ctr = 0; ctr < models.length; ctr++)
            {
                final Model model = models[ctr];
                writer.resetHistory(model.getUris()[0]);
                lastModifiedCheck = model.isLastModifiedCheck() && lastModifiedCheck;

                // - we go off the model that was most recently modified.
                if (model.getLastModified() > lastModified)
                {
                    lastModified = model.getLastModified();
                }
            }

            if (!lastModifiedCheck || writer.isHistoryBefore(lastModified))
            {
                final Collection cartridges = ComponentContainer.instance().findComponentsOfType(Cartridge.class);
                if (cartridges.isEmpty())
                {
                    AndroMDALogger.warn("WARNING! No cartridges found, check your classpath!");
                }
               
                final Map cartridgesByNamespace = this.loadCartridgesByNamespace(cartridges);
               
                // - we want to process by namespace so that the order within the configuration is kept
                final Collection namespaces = this.namespaces.getNamespaces();

                // - pre-load the models
                messages = this.loadIfNecessary(models);
                for (final Iterator iterator = namespaces.iterator(); iterator.hasNext();)
                {
                    final Namespace namespace = (Namespace)iterator.next();
                    final Cartridge cartridge = (Cartridge)cartridgesByNamespace.get(namespace.getName());
                    if (cartridge != null)
                    {
                        cartridgeName = cartridge.getNamespace();
                        if (this.shouldProcess(cartridgeName))
                        {
                            // - set the active namespace on the shared factory and profile instances
                            this.factory.setNamespace(cartridgeName);
                            cartridge.initialize();
   
                            // - process each model with the cartridge
                            for (int ctr = 0; ctr < models.length; ctr++)
                            {
                                final Model model = models[ctr];
   
                                // - set the namespace on the metafacades instance so we know the
                                //   correct facades to use
                                this.factory.setModel(
                                    this.repositories.getImplementation(repositoryName).getModel(),
                                    model.getType());
                                cartridge.processModelElements(this.factory);
                                writer.writeHistory();
                            }
                            cartridge.shutdown();
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.andromda.core.common.ResourceWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.