public void applyHeuristics(InjectingComponentType componentType, Class<?> implClass, IntrospectionContext context) { // apply service heuristic serviceHeuristic.applyHeuristics(componentType, implClass, context); if (componentType.getConstructor() == null) { Constructor<?> ctor = findConstructor(implClass, componentType, context); componentType.setConstructor(ctor); } if (componentType.getProperties().isEmpty() && componentType.getReferences().isEmpty() && componentType.getResourceReferences().isEmpty()) { evaluateConstructor(componentType, implClass, context); evaluateSetters(componentType, implClass, context); evaluateFields(componentType, implClass, context); } Scope scope = componentType.getScope(); if (componentType.isManaged() && !scope.isSingleton()) { IllegalManagementAttribute warning = new IllegalManagementAttribute(implClass, componentType); context.addWarning(warning); } }
public PhysicalComponent generate(LogicalComponent<SystemImplementation> component) throws Fabric3Exception { Component<SystemImplementation> definition = component.getDefinition(); SystemImplementation implementation = definition.getImplementation(); InjectingComponentType type = implementation.getComponentType(); ImplementationManagerDefinition managerDefinition = new ImplementationManagerDefinition(); managerDefinition.setReinjectable(true); managerDefinition.setConstructor(type.getConstructor()); managerDefinition.setInitMethod(type.getInitMethod()); managerDefinition.setDestroyMethod(type.getDestroyMethod()); managerDefinition.setImplementationClass(implementation.getImplementationClass()); managerDefinition.setClassLoaderUri(definition.getContributionUri()); helper.processInjectionSites(type, managerDefinition); // create the physical component definition PhysicalSystemComponent physical = new PhysicalSystemComponent(); physical.setEagerInit(type.isEagerInit()); physical.setManaged(type.isManaged()); physical.setManagementInfo(type.getManagementInfo()); physical.setManagerDefinition(managerDefinition); helper.processPropertyValues(component, physical); return physical; }
public void generate(PhysicalJavaComponent physicalComponent, LogicalComponent<? extends JavaImplementation> component) { Component<? extends JavaImplementation> logical = component.getDefinition(); JavaImplementation implementation = logical.getImplementation(); InjectingComponentType type = implementation.getComponentType(); Scope scope = type.getScope(); // create the instance factory definition ImplementationManagerDefinition managerDefinition = new ImplementationManagerDefinition(); managerDefinition.setReinjectable(Scope.COMPOSITE == scope); managerDefinition.setConstructor(type.getConstructor()); managerDefinition.setInitMethod(type.getInitMethod()); managerDefinition.setDestroyMethod(type.getDestroyMethod()); managerDefinition.setImplementationClass(implementation.getImplementationClass()); managerDefinition.setClassLoaderUri(component.getDefinition().getContributionUri()); helper.processInjectionSites(type, managerDefinition); // create the physical component definition physicalComponent.setScope(scope); physicalComponent.setEagerInit(type.isEagerInit()); physicalComponent.setManagerDefinition(managerDefinition); physicalComponent.setManaged(type.isManaged()); physicalComponent.setManagementInfo(type.getManagementInfo()); helper.processPropertyValues(component, physicalComponent); }