Package org.andromda.core.configuration

Examples of org.andromda.core.configuration.Namespaces


    private void addPropertyReferencesToContext(final Map templateContext)
    {
        final String[] propertyReferences = this.getPropertyReferences();
        if (propertyReferences != null && propertyReferences.length > 0)
        {
            final Namespaces namespaces = Namespaces.instance();
            for (int ctr = 0; ctr < propertyReferences.length; ctr++)
            {
                final String reference = propertyReferences[ctr];
                templateContext.put(
                    reference,
                    namespaces.getPropertyValue(
                        this.getNamespace(),
                        reference));
            }
        }
    }
View Full Code Here


                        metafacadeClasses);
                }
                metafacadeClasses.clear();
                try
                {
                    final Namespaces namespacesConfiguration = Namespaces.instance();
                    for (final Iterator iterator = namespacesConfiguration.getNamespaceRegistries().iterator();
                        iterator.hasNext();)
                    {
                        final NamespaceRegistry namespaceRegistry = (NamespaceRegistry)iterator.next();
                        final String namespaceRegistryName = namespaceRegistry.getName();
                        if (!modelNamespaces.contains(namespaceRegistryName))
View Full Code Here

    public void initialize()
    {
        // - find and open any repositories
        if (this.repositories.isEmpty())
        {
            final Namespaces namespaces = Namespaces.instance();
            final Collection repositories = ComponentContainer.instance().findComponentsOfType(Repository.class);
            for (final Iterator iterator = repositories.iterator(); iterator.hasNext();)
            {
                final Repository repository = (Repository)iterator.next();
                final RepositoryFacade repositoryImplementation = repository.getImplementation();
                final String namespace = repository.getNamespace();
                final PropertyDefinition[] properties = namespaces.getPropertyDefinitions(namespace);
                if (properties != null && properties.length > 0)
                {
                    final int numberOfProperties = properties.length;
                    for (int ctr = 0; ctr < numberOfProperties; ctr++)
                    {
                        final PropertyDefinition property = properties[ctr];
                        final String propertyName = property.getName();
                        if (Introspector.instance().isWritable(repositoryImplementation, propertyName))
                        {
                            Introspector.instance().setProperty(
                                repositoryImplementation,
                                property.getName(),
                                namespaces.getPropertyValue(
                                    namespace,
                                    property.getName()));
                        }
                    }
                }
View Full Code Here

     * Registers all namespace properties in the shared {@link MetafacadeFactory} instance.
     */
    final void registerAllProperties()
    {
        // - register all namespace property references defined in the descriptors
        final Namespaces namespaces = Namespaces.instance();
        for (final Iterator iterator = namespaces.getNamespaces().iterator(); iterator.hasNext();)
        {
            final String mappingsNamespace = ((Namespace)iterator.next()).getName();

            // - add the default mappings
            final Collection mappings = new ArrayList(this.mappings);
View Full Code Here

        }

        final List modelNamespaces = new ArrayList(Arrays.asList(metafacadeModelNamespaces));
        try
        {
            final Namespaces namespaces = Namespaces.instance();
            final int numberOfModelTypes = metafacadeModelNamespaces.length;
            for (int ctr = 0; ctr < numberOfModelTypes; ctr++)
            {
                final String modelNamespace = metafacadeModelNamespaces[ctr];
                if (modelNamespace != null)
                {
                    // - remove the current model type so that we don't keep out the namespace
                    //   that stores the metafacade model
                    modelNamespaces.remove(modelNamespace);

                    MetafacadeMappings modelMetafacadeMappings =
                        (MetafacadeMappings)this.modelMetafacadeMappings.get(modelNamespace);
                    if (modelMetafacadeMappings == null)
                    {
                        modelMetafacadeMappings = MetafacadeMappings.newInstance();

                        // - set the namespace
                        modelMetafacadeMappings.setNamespace(modelNamespace);
                        this.modelMetafacadeMappings.put(
                            modelNamespace,
                            modelMetafacadeMappings);
                    }

                    for (final Iterator iterator = metafacades.iterator(); iterator.hasNext();)
                    {
                        final MetafacadeMappings mappings = (MetafacadeMappings)iterator.next();
                        final String namespace = mappings.getNamespace();

                        if (!modelNamespaces.contains(namespace))
                        {
                            // - if we have 'shared' mappings or only a single set available, they are copied
                            //   to this mappings instance.
                            if (namespaces.isShared(namespace) || metafacades.size() == 1)
                            {
                                // - copy over any 'shared' mappings to this root instance
                                modelMetafacadeMappings.copyMappings(mappings);

                                // - set the metaclass pattern from the 'shared' or single
View Full Code Here

            final String registryName = registry.getName();

            // - only register if we haven't yet registered the namespace resource
            if (!this.registeredNamespaceResources.contains(resource))
            {
                final Namespaces namespaces = Namespaces.instance();
                final String namespace = registry.isShared() ? Namespaces.DEFAULT : registry.getName();

                // - first merge on the namespace registry descriptor (if needed)
                final Merger merger = Merger.instance();
                boolean requiresMerge = merger.requiresMerge(namespace);
                if (requiresMerge)
                {
                    registry =
                        (NamespaceRegistry)registryFactory.getObject(
                            merger.getMergedString(
                                ResourceUtils.getContents(resource),
                                namespace), resource);
                }

                // - add the resource root
                registry.addResourceRoot(this.getNamespaceResourceRoot(resource));
               
                // - only log the fact we've found the namespace registry, if we haven't done it yet
                if (!this.registeredRegistries.contains(registryName))
                {
                    AndroMDALogger.info("found namespace --> '" + registryName + "'");
                    this.registeredRegistries.add(registryName);
                }

                final NamespaceRegistry existingRegistry = namespaces.getRegistry(registryName);
                if (existingRegistry != null)
                {
                    // - if we already have an existing registry with the same name, copy
                    //   over any resources.
                    registry.copy(existingRegistry);
                }

                // - add the registry to the namespaces instance
                namespaces.addRegistry(registry);
                final String[] components = registry.getRegisteredComponents();
                final int componentNumber = components.length;
                for (int componentCtr = 0; componentCtr < componentNumber; componentCtr++)
                {
                    final String componentName = components[componentCtr];
View Full Code Here

TOP

Related Classes of org.andromda.core.configuration.Namespaces

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.