Package org.apache.tuscany.sca.scope

Examples of org.apache.tuscany.sca.scope.InstanceWrapper


    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


        super(Scope.STATELESS, component);
    }

    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

        }

        public void onEvent(Event event) {
            if (event instanceof StoreExpirationEvent) {
                StoreExpirationEvent expiration = (StoreExpirationEvent)event;
                InstanceWrapper wrapper = (InstanceWrapper)expiration.getInstance();
                try {
                    wrapper.stop();
                } catch (TargetDestructionException e) {
                    // monitor.destructionError(e);
                }
            }
        }
View Full Code Here

        throws InvocationTargetException {

        // FIXME: How to deal with other scopes
        Object contextId = ThreadMessageContext.getMessageContext().getConversationID();
        try {
            InstanceWrapper wrapper = getInstance(sequence, contextId);
            Object instance = wrapper.getInstance();
            Object ret;
            if (payload != null && !payload.getClass().isArray()) {
                ret = operation.invoke(instance, payload);
            } else {
                ret = operation.invoke(instance, (Object[])payload);
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

        super(Scope.STATELESS, component);
    }

    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

        throws InvocationTargetException {

        // FIXME: How to deal with other scopes
        Object contextId = ThreadMessageContext.getMessageContext().getConversationID();
        try {
            InstanceWrapper wrapper = getInstance(sequence, contextId);
            Object instance = wrapper.getInstance();
            Object ret;
            if (payload != null && !payload.getClass().isArray()) {
                ret = operation.invoke(instance, payload);
            } else {
                ret = operation.invoke(instance, (Object[])payload);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.scope.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.