Package org.apache.tuscany.model.assembly

Examples of org.apache.tuscany.model.assembly.AssemblyInitializationException


            return;
        super.initialize(modelContext);

        // Initialize the implementation
        if (implementation == null) {
            throw new AssemblyInitializationException("No implementation for component [" + getName() + ']');
        }
        implementation.initialize(modelContext);

        // Derive the configured services from the component implementation
        ComponentType componentType=implementation.getComponentType();
        AssemblyFactory factory = modelContext.getAssemblyFactory();
        for (Service service : componentType.getServices()) {
            ConfiguredService configuredService = factory.createConfiguredService();
            configuredService.setPort(service);
            configuredServices.add(configuredService);
            configuredService.initialize(modelContext);
        }

        // Derive the configured references from the references on the component info
        for (Reference reference : componentType.getReferences()) {
            ConfiguredReference configuredReference = configuredReferencesMap.get(reference.getName());
            if (configuredReference==null) {
                configuredReference=factory.createConfiguredReference();
                configuredReference.setPort(reference);
                configuredReferences.add(configuredReference);
                configuredReference.initialize(modelContext);
            } else {
                configuredReference.setPort(reference);
                configuredReference.initialize(modelContext);
            }
        }
        for (ConfiguredReference configuredReference : configuredReferences) {
            if (configuredReference.getPort()==null) {
                throw new AssemblyInitializationException("Undefined reference ["+configuredReference.getName()+"]");
            }
        }

        // Derive the configured properties from the properties on the component info
        for (Property property : componentType.getProperties()) {
            ConfiguredProperty configuredProperty = configuredPropertiesMap.get(property.getName());
            if (configuredProperty != null) {
                configuredProperty.setProperty(property);
                configuredProperty.initialize(modelContext);
            }
        }
        for (ConfiguredProperty configuredProperty : configuredProperties) {
            if (configuredProperty.getProperty()==null) {
                throw new AssemblyInitializationException("Undefined property ["+configuredProperty.getName()+"]");
            }
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.model.assembly.AssemblyInitializationException

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.