Package org.apache.tuscany.sca.implementation.java.impl

Examples of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl


        //setUpPolicyHandlers();
    }

    void addResourceFactory(String name, ObjectFactory<?> factory) {
        JavaResourceImpl resource = instanceFactoryProvider.getImplementation().getResources().get(name);

        if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
            instanceFactoryProvider.getInjectionSites().add(resource.getElement());
        }

        instanceFactoryProvider.setObjectFactory(resource.getElement(), factory);
    }
View Full Code Here


        }
        String name = JavaIntrospectionHelper.toPropertyName(method.getName());
        JavaElementImpl element = new JavaElementImpl(method, 0);
        element.setName(name);
        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
        JavaResourceImpl resource = new JavaResourceImpl(element);
        type.getResources().put(resource.getName(), resource);
    }
View Full Code Here

        if (field.getAnnotation(ConversationID.class) == null) {
            return;
        }
        JavaElementImpl element = new JavaElementImpl(field);
        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
        JavaResourceImpl resource = new JavaResourceImpl(element);
        type.getResources().put(resource.getName(), resource);
    }
View Full Code Here

        String name = JavaIntrospectionHelper.toPropertyName(method.getName());
        if (String.class.equals(paramType)) {
            JavaElementImpl element = new JavaElementImpl(method, 0);
            element.setName(name);
            element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
            JavaResourceImpl resource = new JavaResourceImpl(element);
            type.getResources().put(resource.getName(), resource);
        } else {
            throw new UnknownContextTypeException(paramType.getName());
        }
    }
View Full Code Here

        }
        Class<?> paramType = field.getType();
        if (String.class.equals(paramType)) {
            JavaElementImpl element = new JavaElementImpl(field);
            element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
            JavaResourceImpl resource = new JavaResourceImpl(element);
            type.getResources().put(resource.getName(), resource);
        } else {
            throw new UnknownContextTypeException(paramType.getName());
        }
    }
View Full Code Here

            }
        }
    }

    void addResourceFactory(String name, ObjectFactory<?> factory) {
        JavaResourceImpl resource = instanceFactoryProvider.getImplementation()
            .getResources().get(name);

        if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
            instanceFactoryProvider.getInjectionSites().add(resource.getElement());
        }

        instanceFactoryProvider.setObjectFactory(resource.getElement(), factory);
    }
View Full Code Here

        }
        for (Method m : FooImpl.class.getMethods()) {
            processor.visitMethod(m, componentType);
        }

        JavaResourceImpl r1 = (JavaResourceImpl)componentType.getResources().get("context");
        assertNotNull(r1);
        JavaResourceImpl r2 = (JavaResourceImpl)componentType.getResources().get("context2");
        assertNotNull(r2);
//        HelperContext c1 = (HelperContext)r1.getObjectFactory().getInstance();
//        HelperContext c2 = (HelperContext)r2.getObjectFactory().getInstance();
//        assertSame(c1, c2);
    }
View Full Code Here

            throw new IllegalArgumentException("HelperContext setter must have one parameter: " + method);
        }
        Class<?> paramType = method.getParameterTypes()[0];
        if (HelperContext.class == paramType) {
            String name = toPropertyName(method.getName());
            JavaResourceImpl resource = new JavaResourceImpl(new JavaElementImpl(method, 0));
//            resource.setObjectFactory(new HelperContextFactory(context.getComponentId()));
            type.getResources().put(name, resource);
        }
    }
View Full Code Here

            return;
        }
        Class<?> paramType = field.getType();
        if (HelperContext.class == paramType) {
            String name = field.getName();
            JavaResourceImpl resource = new JavaResourceImpl(new JavaElementImpl(field));
//            resource.setObjectFactory(new HelperContextFactory(context.getComponentId()));
            type.getResources().put(name, resource);
        }
    }
View Full Code Here

        if (type.getResources().get(name) != null) {
            throw new DuplicateResourceException(name);
        }

        String mappedName = annotation.mappedName();
        JavaResourceImpl resource = createResource(name, new JavaElementImpl(method, 0));
        resource.setOptional(annotation.optional());
        if (mappedName.length() > 0) {
            resource.setMappedName(mappedName);
        }
        type.getResources().put(resource.getName(), resource);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl

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.