Examples of Scope


Examples of org.apache.tapestry5.ioc.annotations.Scope

        // Set defaults for the other properties.

        eagerLoad = serviceImplementation.getAnnotation(EagerLoad.class) != null;
        serviceId = serviceInterface.getSimpleName();

        Scope scope = serviceImplementation.getAnnotation(Scope.class);

        this.scope = scope != null ? scope.value() : IOCConstants.DEFAULT_SCOPE;

        Marker marker = serviceImplementation.getAnnotation(Marker.class);

        if (marker != null)
        {
View Full Code Here

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

                Map<Scope, List<ContextFactory<Context>>> configurationsByScope = new EnumMap<Scope, List<ContextFactory<Context>>>(Scope.class);
                if (configurations != null) {
                    for (ContextFactory<Context> contextFactory : configurations.values()) {
                        // FIXME scopes are defined at the interface level
                        Scope sourceScope = contextFactory.getScope();
                        wireSource(contextFactory);
                        buildTarget(contextFactory);
                        scopeIndex.put(contextFactory.getName(), scopeContexts.get(sourceScope));
                        List<ContextFactory<Context>> list = configurationsByScope.get(sourceScope);
                        if (list == null) {
View Full Code Here

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

    /**
     * Iterates through references and delegates to the configuration context to wire them to their targets
     */
    protected void wireSource(ContextFactory<Context> source) {
        Scope sourceScope = source.getScope();
        if (source.getSourceWireFactories() != null) {
            for (SourceWireFactory<?> sourceFactory : source.getSourceWireFactories()) {
                WireConfiguration wireConfiguration = sourceFactory.getConfiguration();
                QualifiedName targetName = wireConfiguration.getTargetName();
                ContextFactory<?> target = configurations.get(targetName.getPartName());
View Full Code Here

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

        if (!implementationClass.isAssignableFrom(nonGenricComponent.getImplementation().getClass())) {
            return;
        }
        Component<T> component = (Component<T>) modelObject;
        List<Service> services = component.getImplementation().getComponentType().getServices();
        Scope previous = null;
        Scope scope = Scope.INSTANCE;
        for (Service service : services) {
            // calculate and validate the scope of the component; ensure that all service scopes are the same unless stateless
            Scope current = service.getServiceContract().getScope();
            if (previous != null && current != null && current != previous
                    && (current != Scope.INSTANCE && previous != Scope.INSTANCE)) {
                BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component");
                e.setIdentifier(component.getName());
                throw e;
View Full Code Here

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

    public ScopeProcessor() {
    }

    @Override
    public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException {
        Scope scope = null;
        org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
        if (annotation != null) {
            scope = ProcessorHelper.getScope(annotation);
        } else {
            Class<?> superClass = clazz.getSuperclass();
            if (superClass != null) {
                scope = recurseScope(superClass);
            }
        }
        if (scope == null) {
            scope = Scope.INSTANCE;
        }
        //FIXME hack for now - set scope to implementation scope
        //This will be clean up with spec change
        for (Service service : type.getServices()) {
            Scope serviceScope = service.getServiceContract().getScope();
            if (serviceScope == Scope.INSTANCE || serviceScope == null) {
                service.getServiceContract().setScope(scope);
            }
        }
View Full Code Here

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

            return;
        }
        Component component = (Component) modelObject;

        Class implClass;
        Scope scope;
        // Get the component implementation
        Implementation componentImplementation = component.getImplementation();
        if (componentImplementation instanceof SystemImplementation
                && component.getContextFactory() == null) {

            // The component is a system component, implemented by a Java class
            SystemImplementation implementation = (SystemImplementation) componentImplementation;
            if (componentImplementation.getComponentType().getServices() == null
                    || componentImplementation.getComponentType().getServices().size() < 1) {
                BuilderConfigException e = new BuilderConfigException("No service configured on component type");
                e.setIdentifier(component.getName());
                throw e;
            }
            implClass = implementation.getImplementationClass();
            Scope previous = null;
            scope = Scope.MODULE;
            List<Service> services = component.getImplementation().getComponentType().getServices();
            for (Service service : services) {
                // calculate and validate the scope of the component; ensure that all service scopes are the same unless
                // a scope is stateless
                Scope current = service.getServiceContract().getScope();
                if (previous != null && current != null && current != previous
                        && (current != Scope.INSTANCE && previous != Scope.INSTANCE)) {
                    BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component");
                    e.setIdentifier(component.getName());
                    throw e;
View Full Code Here

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

    private void addService(List<Service> services, Class<?> serviceClass) {
        //FIXME how do we support specifying remotable?
        JavaServiceContract javaInterface = factory.createJavaServiceContract();
        javaInterface.setInterface(serviceClass);
        org.osoa.sca.annotations.Scope scopeAnnotation = serviceClass.getAnnotation(org.osoa.sca.annotations.Scope.class);
        Scope scope;
        if (scopeAnnotation == null) {
            scope = Scope.INSTANCE;
        } else {
            scope = ProcessorHelper.getScope(scopeAnnotation);
        }
View Full Code Here

Examples of org.apache.tuscany.sca.core.scope.Scope

        }
       
        try {
            osgiAnnotations.processAnnotations();
       
            Scope scope = osgiAnnotations.getScope();
            if (scope.equals(Scope.SYSTEM) || scope.equals(Scope.COMPOSITE)) {
                // Nothing
            } else {

                if (runtimeComponent instanceof ScopedRuntimeComponent) {
View Full Code Here

Examples of org.apache.tuscany.sca.core.scope.Scope

                                                 dataBindingRegistry,
                                                 propertyValueObjectFactory,
                                                 componentContextFactory,
                                                 requestContextFactory);

            Scope scope = getScope();

            if (scope == Scope.SYSTEM || scope == Scope.COMPOSITE) {
                // Nothing
            } else {
                // Check for conversational contract if conversational scope
View Full Code Here

Examples of org.apache.tuscany.sca.core.scope.Scope

    public boolean supportsOneWayInvocation() {
        return false;
    }

    public Scope getScope() {
        return new Scope(implementation.getJavaScope().getScope());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.