public void resolve(WebImplementation implementation, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { // Resolve the component type String uri = implementation.getURI(); if (uri != null) { ComponentType componentType = assemblyFactory.createComponentType(); componentType.setURI("web.componentType"); componentType = resolver.resolveModel(ComponentType.class, componentType, context); if (!componentType.isUnresolved()) { // Initialize the implementation's services, references and properties implementation.getServices().addAll(componentType.getServices()); implementation.getReferences().addAll(componentType.getReferences()); implementation.getProperties().addAll(componentType.getProperties()); } } implementation.setUnresolved(false); }
public void addModel(Object resolved, ProcessorContext context) { ComponentType componentType = (ComponentType)resolved; map.put(componentType.getURI(), componentType); }
private ComponentType getComponentType(ModelResolver resolver, JavaImplementation impl, ProcessorContext context) { String className = impl.getJavaClass().getName(); String componentTypeURI = className.replace('.', '/') + ".componentType"; ComponentType componentType = assemblyFactory.createComponentType(); componentType.setUnresolved(true); componentType.setURI(componentTypeURI); componentType = resolver.resolveModel(ComponentType.class, componentType, context); if (!componentType.isUnresolved()) { return componentType; } return null; }
public void resolve(ComponentType componentType, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { // Resolve component type services and references resolveContracts(componentType.getServices(), resolver, context); resolveContracts(componentType.getReferences(), resolver, context); }
componentType.getServices().addAll(javaImplementation.getServices()); componentType.getReferences().addAll(javaImplementation.getReferences()); componentType.getProperties().addAll(javaImplementation.getProperties());
componentType.setUnresolved(true); impl.setComponentType(componentType); String scaName = pLink.getSCAName(); if (pLink.querySCAType().equals("reference")) { componentType.getReferences().add(generateReference(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces(), monitor)); } else { componentType.getServices().add(generateService(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces(), monitor)); componentType.getProperties().add(property);
@Override public List<Reference> getReferences() { if (componentType != null){ return componentType.getReferences(); } else { return null; } }
@Override public List<Service> getServices() { if (componentType != null){ return componentType.getServices(); } else { return null; } }
componentType.setURI("OSGI-INF/sca/" + bundle.getSymbolicName() + "/bundle.componentType"); componentType.setUnresolved(true); componentType = resolver.resolveModel(ComponentType.class, componentType, context); if (componentType.isUnresolved()) { componentType.setURI(BUNDLE_COMPONENT_TYPE); componentType = resolver.resolveModel(ComponentType.class, componentType, context); if (componentType.isUnresolved()) { error(monitor, "MissingComponentTypeFile", impl, componentType.getURI());
/** * Use preProcess to validate and map the references and properties dynamically */ public void build(Component component) { for (Reference reference : component.getReferences()) { if (unresolvedBeanRef.containsKey(reference.getName())) { Reference ref = unresolvedBeanRef.get(reference.getName()); componentType.getReferences().add(createReference(reference, ref.getInterfaceContract())); unresolvedBeanRef.remove(reference.getName()); } } for (Property property : component.getProperties()) { if (unresolvedBeanRef.containsKey(property.getName())) { componentType.getProperties().add(createProperty(property)); this.setPropertyClass(property.getName(), property.getClass()); unresolvedBeanRef.remove(property.getName()); } } }
public <T> T resolveModel(Class<T> modelClass, T unresolved, ProcessorContext context) { String uri = ((ComponentType)unresolved).getURI(); if (uri == null) { return (T)unresolved; if (!resolved.isUnresolved()) { return modelClass.cast(resolved);
@Override public List<Property> getProperties() { return componentType.getProperties(); }
private void processComponentType(SpringImplementation springImplementation) { // Create a ComponentType and mark it unresolved ComponentType componentType = assemblyFactory.createComponentType(); componentType.setUnresolved(true); springImplementation.setComponentType(componentType); } // end processComponentType
/** * Base method which loads the component type from the application-context attached to the * Spring implementation * */ public void load(SpringImplementation implementation, ModelResolver resolver, ProcessorContext context) throws ContributionReadException { //System.out.println("Spring TypeLoader - load method start"); ComponentType componentType = implementation.getComponentType(); /* Check that there is a component type object already set */ if (componentType == null) { throw new ContributionReadException("SpringXMLLoader load: implementation has no ComponentType object"); } if (componentType.isUnresolved()) { /* Fetch the location of the application-context file from the implementation */ loadFromXML(implementation, resolver, context); if (!componentType.isUnresolved()) implementation.setUnresolved(false); } // end if //System.out.println("Spring TypeLoader - load method complete"); } // end method load
componentType.setURI(uri.toString());
javaInterface.setName(interfaceName); interfaceContract.setInterface(javaInterface); componentType.getReferences().add(ref); } else if ("provide".equals(name.getLocalPart())) { Service service = factory.createService(); javaInterface.setName(interfaceName); interfaceContract.setInterface(javaInterface); componentType.getServices().add(service); } else if ("property".equals(name.getLocalPart())) { String propName = reader.getAttributeValue(null, "name"); property.setName(propName); property.setValue(prop); componentType.getProperties().add(property);
componentType.setUnresolved(true); impl.setComponentType(componentType); String scaName = pLink.getSCAName(); if (pLink.querySCAType().equals("reference")) { componentType.getReferences().add(generateReference(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces(), monitor)); } else { componentType.getServices().add(generateService(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces(), monitor)); componentType.getProperties().add(property);
public void resolve(ComponentType componentType, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { // Resolve component type services and references resolveContracts(componentType.getServices(), resolver, context); resolveContracts(componentType.getReferences(), resolver, context); }
@Override public List<Reference> getReferences() { return componentType.getReferences(); }
@Override public List<Service> getServices() { if (componentType != null){ return componentType.getServices(); } else { return null; } }