Package org.apache.tuscany.sca.extensibility

Examples of org.apache.tuscany.sca.extensibility.ServiceDeclaration.loadClass()


        Class<? extends ModelResolver > resolver = resolvers.get(modelType);
        if (resolver == null) {
            ServiceDeclaration resolverClass = loadedResolvers.get(modelType.getName());
            if (resolverClass != null) {
                try {
                    return (Class<? extends ModelResolver>)resolverClass.loadClass();
                } catch (ClassNotFoundException e) {
                    throw new IllegalArgumentException(e);
                }
            }
        }
View Full Code Here


            Class<? extends ModelResolver> resolver = resolvers.get(c);
            if (resolver == null) {
                ServiceDeclaration resolverClass = loadedResolvers.get(c.getName());
                if (resolverClass != null) {
                    try {
                        return (Class<? extends ModelResolver>)resolverClass.loadClass();
                    } catch (ClassNotFoundException e) {
                        throw new IllegalArgumentException(e);
                    }
                }
            } else {
View Full Code Here

        Class<? extends ModelResolver > resolver = resolvers.get(modelType);
        if (resolver == null) {
            ServiceDeclaration resolverClass = loadedResolvers.get(modelType.getName());
            if (resolverClass != null) {
                try {
                    return (Class<? extends ModelResolver>)resolverClass.loadClass();
                } catch (ClassNotFoundException e) {
                    throw new IllegalArgumentException(e);
                }
            }
        }
View Full Code Here

            // Dynamically load a factory class declared under META-INF/services
            try {
                ServiceDeclaration factoryDeclaration = ServiceDiscovery.getInstance().getServiceDeclaration(factoryInterface.getName());
                if (factoryDeclaration != null) {
                    Class<?> factoryClass = factoryDeclaration.loadClass();
           
                    // Default empty constructor
                    Constructor<?> constructor = factoryClass.getConstructor(ExtensionPointRegistry.class);
                    factory = constructor.newInstance(registry);
           
View Full Code Here

            // Dynamically load a utility class declared under META-INF/services/"utilityType"
            try {
                ServiceDeclaration utilityDeclaration =
                    ServiceDiscovery.getInstance().getServiceDeclaration(utilityType.getName());
                if (utilityDeclaration != null) {
                    Class<?> utilityClass = utilityDeclaration.loadClass();

                    // Construct the utility
                    Constructor<?>[] constructors = utilityClass.getConstructors();
                    Constructor<?> constructor = getConstructor(constructors, ExtensionPointRegistry.class, Map.class);
                    if (constructor != null) {
View Full Code Here

            // Dynamically load a factory class declared under META-INF/services
            try {
                ServiceDeclaration factoryDeclaration =
                    ServiceDiscovery.getInstance().getServiceDeclaration(factoryInterface.getName());
                if (factoryDeclaration != null) {
                    Class<?> factoryClass = factoryDeclaration.loadClass();
                    try {
                       
                        // Default empty constructor
                        Constructor<?> constructor = factoryClass.getConstructor();
                        factory = constructor.newInstance();
View Full Code Here

            // Dynamically load an extension point class declared under META-INF/services
            try {
                ServiceDeclaration extensionPointDeclaration =
                    ServiceDiscovery.getInstance().getServiceDeclaration(extensionPointType.getName());
                if (extensionPointDeclaration != null) {
                    Class<?> extensionPointClass = extensionPointDeclaration.loadClass();

                    // Construct the extension point
                    Constructor<?>[] constructors = extensionPointClass.getConstructors();
                    Constructor<?> constructor =
                        getConstructor(constructors, new Class<?>[] {ExtensionPointRegistry.class});
View Full Code Here

     * @throws Exception
     */
    private <T> T getFactory(Class<T> factory) throws Exception {
        ServiceDeclaration sd = ServiceDiscovery.getInstance().getServiceDeclaration(factory.getName());
        if (sd != null) {
            return factory.cast(sd.loadClass().newInstance());
        } else {
            return factory.cast(factory.getMethod("newInstance").invoke(null));
        }
    }

View Full Code Here

            Class<? extends ModelResolver> resolver = resolvers.get(c);
            if (resolver == null) {
                ServiceDeclaration resolverClass = loadedResolvers.get(c.getName());
                if (resolverClass != null) {
                    try {
                        return (Class<? extends ModelResolver>)resolverClass.loadClass();
                    } catch (ClassNotFoundException e) {
                        throw new IllegalArgumentException(e);
                    }
                }
            } else {
View Full Code Here

        Class<? extends ModelResolver > resolver = resolvers.get(modelType);
        if (resolver == null) {
            ServiceDeclaration resolverClass = loadedResolvers.get(modelType.getName());
            if (resolverClass != null) {
                try {
                    return (Class<? extends ModelResolver>)resolverClass.loadClass();
                } catch (ClassNotFoundException e) {
                    throw new IllegalArgumentException(e);
                }
            }
        }
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.