private HibernateSessionResourceReference createSessionReference(String name, PersistenceContext annotation, InjectingComponentType componentType) { String unitName = annotation.unitName(); boolean multiThreaded = Scope.COMPOSITE == componentType.getScope(); return new HibernateSessionResourceReference(name, unitName, factoryServiceContract, multiThreaded); }
private HibernateSessionResourceReference createSessionReference(String name, PersistenceContext annotation, InjectingComponentType componentType) { String unitName = annotation.unitName(); boolean multiThreaded = Scope.COMPOSITE == componentType.getScope(); return new HibernateSessionResourceReference(name, unitName, factoryServiceContract, multiThreaded); }
private void validateScope(InjectingComponentType componentType, Class<?> implClass, IntrospectionContext context) { Scope scope = componentType.getScope(); if (componentType.isEagerInit() && Scope.COMPOSITE != scope && Scope.DOMAIN != scope) { EagerInitNotSupported warning = new EagerInitNotSupported(implClass, componentType); context.addWarning(warning); } }
@SuppressWarnings({"unchecked"}) public void generateWireTarget(JavaWireTarget target, LogicalService service) { LogicalComponent<JavaImplementation> component = (LogicalComponent<JavaImplementation>) service.getParent(); URI uri = URI.create(component.getUri().toString() + "#" + service.getUri().getFragment()); target.setUri(uri); // assume only wires to composite scope components can be optimized Component<JavaImplementation> componentDefinition = component.getDefinition(); JavaImplementation implementation = componentDefinition.getImplementation(); InjectingComponentType componentType = implementation.getComponentType(); Scope scope = componentType.getScope(); target.setOptimizable(scope.isSingleton()); }
private PersistenceContextResourceReference createReference(String name, Member member, PersistenceContext annotation, InjectingComponentType componentType, IntrospectionContext context) { String unitName = annotation.unitName(); PersistenceContextType type = annotation.type(); if (PersistenceContextType.EXTENDED == type) { InvalidPersistenceContextType error = new InvalidPersistenceContextType("Extended persistence contexts not supported: " + unitName, member, componentType); context.addError(error); } boolean multiThreaded = Scope.COMPOSITE == componentType.getScope(); return new PersistenceContextResourceReference(name, unitName, factoryServiceContract, multiThreaded); }
private PersistenceContextResourceReference createReference(String name, Member member, PersistenceContext annotation, InjectingComponentType componentType, IntrospectionContext context) { String unitName = annotation.unitName(); PersistenceContextType type = annotation.type(); if (PersistenceContextType.EXTENDED == type) { InvalidPersistenceContextType error = new InvalidPersistenceContextType("Extended persistence contexts not supported: " + unitName, member, componentType); context.addError(error); } boolean multiThreaded = Scope.COMPOSITE == componentType.getScope(); return new PersistenceContextResourceReference(name, unitName, factoryServiceContract, multiThreaded); }
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 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); }