Package org.apache.tuscany.sca.core.factory

Examples of org.apache.tuscany.sca.core.factory.InstanceWrapper


        //
        // Return the backing implementation instance 
        //
        private InstanceWrapper getInstanceWrapper(Object contextId) {
            InstanceWrapper ctx = wrappers.get(contextId);
            return ctx;
        }
View Full Code Here


            InstanceWrapper ctx = wrappers.get(contextId);
            return ctx;
        }

        private void removeInstanceWrapper(Object contextId) throws TargetDestructionException {
            InstanceWrapper ctx = getInstanceWrapper(contextId);
            wrappers.remove(contextId);

            // find out if we are dealing with the original client conversation id
            // and reset accordingly
            if ( ( clientConversationId != null ) && ( clientConversationId.equals(contextId)) ) {
                clientConversationId = null;
            } else {
                // reset the conversationId in the conversation object if present
                // so that and ending callback causes the conversation in the originating
                // service reference in the client to be reset
                callbackConversations.remove(contextId);
            }

            // stop the component if this removes the last reference
            if (clientConversationId == null && callbackConversations.isEmpty()) {
                ctx.stop();
            }
        }
View Full Code Here

                ctx.stop();
            }
        }

        private void createInstance(Object contextId) throws TargetResolutionException {
            InstanceWrapper instanceWrapper = createInstanceWrapper();
            instanceWrapper.start();
            wrappers.put(contextId, instanceWrapper);
        }
View Full Code Here

    protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
//        Object key = workContext.getIdentifier(Scope.SESSION);
        // FIXME: Need to fix this
        Object key ="http-session-id";
        assert key != null : "HTTP session key not bound in work context";
        InstanceWrapper ctx = wrappers.get(key);
        if (ctx == null && !create) {
            return null;
        }
        if (ctx == null) {
            ctx = super.createInstanceWrapper();
            ctx.start();
            wrappers.put(key, ctx);
        }
        return ctx;
    }
View Full Code Here

    }

    @Override
    public  InstanceWrapper getWrapper(KEY contextId)
        throws TargetResolutionException {
        InstanceWrapper ctx = createInstanceWrapper();
        ctx.start();
        return ctx;
    }
View Full Code Here

        // }
        lifecycleState = STOPPED;
    }

    protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
        InstanceWrapper ctx = wrappers.get(Thread.currentThread());
        if (ctx == null && !create) {
            return null;
        }
        if (ctx == null) {
            ctx = super.createInstanceWrapper();
            ctx.start();
            wrappers.put(Thread.currentThread(), ctx);
        }
        return ctx;
    }
View Full Code Here

        */

        try {
            // The following call might create a new conversation, as a result, the msg.getConversationID() might
            // return a new value
            InstanceWrapper wrapper = scopeContainer.getWrapper(contextId);

            // detects whether the scope container has created a conversation Id. This will
            // happen in the case that the component has conversational scope but only the
            // callback interface is conversational. Or in the callback case if the service interface
            // is conversational and the callback interface isn't. If we are in this situation we need
            // to get the contextId of this component and remove it after we have invoked the method on
            // it. It is possible that the component instance will not go away when it is removed below
            // because a callback conversation will still be holding a reference to it
            /* TODO - EPR - not required for OASIS
            boolean removeTemporaryConversationalComponentAfterCall = false;
            if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
                contextId = parameters.getConversationID();
                removeTemporaryConversationalComponentAfterCall = true;
            }
            */

            Object instance = wrapper.getInstance();

            // If the method couldn't be computed statically, or the instance being
            // invoked is a user-specified callback object that doesn't implement
            // the service interface from which the reflective method was obtained,
            // compute the method object dynamically for this invocation.
View Full Code Here

    @Override
    public  InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
        if (lifecycleState != RUNNING) {
            throw new TargetResolutionException("scope container not running, lifecycleState=" + lifecycleState);
        }
        InstanceWrapper ctx = createInstanceWrapper();
        ctx.start();
        return ctx;
    }
View Full Code Here

        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
       
        try {
            // The following call might create a new conversation, as a result, the msg.getConversationID() might
            // return a new value
            InstanceWrapper wrapper = scopeContainer.getWrapper(null);

            Object instance = wrapper.getInstance();
          
            // Set the TCCL to the classloader used to load the implementation class
            Thread.currentThread().setContextClassLoader(instance.getClass().getClassLoader());
           
            // For an async server method, there is an extra input parameter, which is a DispatchResponse instance
View Full Code Here

        // Replace TCCL with the class loader used to load the java class as per SCA Spec
        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
       
        try {
            InstanceWrapper wrapper = scopeContainer.getWrapper(null);
            Object instance = wrapper.getInstance();
          
            // Set the TCCL to the classloader used to load the implementation class
            Thread.currentThread().setContextClassLoader(instance.getClass().getClassLoader());
           
            // For an async server method, there is an extra input parameter, which is a DispatchResponse instance
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.core.factory.InstanceWrapper

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.