Package org.apache.tuscany.sca.factory

Examples of org.apache.tuscany.sca.factory.ObjectCreationException


    @SuppressWarnings("unchecked")
    public T getInstance() throws ObjectCreationException {
        try {
            return (T) context.lookup(name);
        } catch (NamingException e) {
            throw new ObjectCreationException(e);
        }
    }
View Full Code Here


        try {
            method.invoke(instance, objectFactory.getInstance());
        } catch (IllegalAccessException e) {
            throw new AssertionError("Method is not accessible [" + method + "]");
        } catch (IllegalArgumentException e) {
            throw new ObjectCreationException("Exception thrown by setter: " + method.getName(), e);
        } catch (InvocationTargetException e) {
            throw new ObjectCreationException("Exception thrown by setter: " + method.getName(), e);
        }
    }
View Full Code Here

        try {
            ctr.setAccessible(true);
            return ctr.newInstance(initargs);
        } catch (IllegalArgumentException e) {
            String name = ctr.getName();
            throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
        } catch (InstantiationException e) {
            String name = ctr.getDeclaringClass().getName();
            throw new AssertionError("Class is not instantiable [" + name + "]");
        } catch (IllegalAccessException e) {
            String name = ctr.getName();
            throw new AssertionError("Constructor is not accessible [" + name + "]");
        } catch (InvocationTargetException e) {
            String name = ctr.getName();
            throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
        }
    }
View Full Code Here

   
    protected void init(RuntimeComponent rc, ComponentType ct, ScriptImplementation implementation, PropertyValueObjectFactory propertyFactory) {
        try {
            scriptEngine = getScriptEngineByExtension(implementation.getScriptLanguage());
            if (scriptEngine == null) {
                throw new ObjectCreationException("no script engine found for language: " + implementation.getScriptLanguage());
            }
            if (!(scriptEngine instanceof Invocable)) {
                throw new ObjectCreationException("script engine does not support Invocable: " + scriptEngine);
            }
           
            for (Reference reference : ct.getReferences()) {
                scriptEngine.put(reference.getName(), createReferenceProxy(reference.getName(), rc));
            }

            for (Property property : implementation.getProperties()) {
                ObjectFactory<?> propertyValueFactory = propertyFactory.createValueFactory(property);
                if ( propertyValueFactory != null) {
                    scriptEngine.put(property.getName(), propertyValueFactory.getInstance());
                }
            }
           
            scriptEngine.eval(new StringReader(implementation.getScriptSrc()));

        } catch (ScriptException e) {
            throw new ObjectCreationException(e);
        }

        // set the databinding and xmlhelper for wsdl interfaces
        for (Service service : rc.getServices()) {
            InterfaceContract ic = service.getInterfaceContract();
View Full Code Here

                    throw new ResourceNotFoundException("Resource not found: " + mappedName);
                }
            }
            return resource;
        } catch (ResourceResolutionException e) {
            throw new ObjectCreationException(e);
        }

    }
View Full Code Here

            String name = ctr.getName();
            throw new AssertionError("Constructor is not accessible [" + name + "]");
        } catch (
            InvocationTargetException e) {
            String name = ctr.getName();
            throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
        }

        if (injectors != null) {
            for (Injector<T> injector : injectors) {
                //FIXME Injectors should never be null
View Full Code Here

   
    public void start() {
        try {
            scriptEngine = getScriptEngineByExtension(implementation.getScriptLanguage());
            if (scriptEngine == null) {
                throw new ObjectCreationException("no script engine found for language: " + implementation.getScriptLanguage());
            }
            if (!(scriptEngine instanceof Invocable)) {
                throw new ObjectCreationException("script engine does not support Invocable: " + scriptEngine);
            }
           
            for (Reference reference : implementation.getReferences()) {
                scriptEngine.put(reference.getName(), createReferenceProxy(reference.getName(), component));
            }

            for (Property property : implementation.getProperties()) {
                ObjectFactory<?> propertyValueFactory = propertyFactory.createValueFactory(property);
                if ( propertyValueFactory != null) {
                    scriptEngine.put(property.getName(), propertyValueFactory.getInstance());
                }
            }
           
            scriptEngine.eval(new StringReader(implementation.getScriptSrc()));

        } catch (ScriptException e) {
            throw new ObjectCreationException(e);
        }
    }
View Full Code Here

            String name = ctr.getName();
            throw new AssertionError("Constructor is not accessible [" + name + "]");
        } catch (
            InvocationTargetException e) {
            String name = ctr.getName();
            throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
        }

        if (injectors != null) {
            for (Injector<T> injector : injectors) {
                //FIXME Injectors should never be null
View Full Code Here

    @SuppressWarnings("unchecked")
    public T getInstance() throws ObjectCreationException {
        try {
            return (T) context.lookup(name);
        } catch (NamingException e) {
            throw new ObjectCreationException(e);
        }
    }
View Full Code Here

                    throw new ResourceNotFoundException("Resource not found: " + mappedName);
                }
            }
            return resource;
        } catch (ResourceResolutionException e) {
            throw new ObjectCreationException(e);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.factory.ObjectCreationException

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.