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

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


            return;
        }
        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 : ct.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


            return;
        }
        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 : ct.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

                        }
                    }
                }

        } catch (Exception e) {
            throw new ObjectCreationException(e);
        } finally {
            exitMethod(startBundleEntryCount);
        }
        return osgiBundle;
    }
View Full Code Here

            }

            return osgiServiceReference;

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

                packageAdmin.resolveBundles(new Bundle[] {osgiBundle});
            }

        } catch (Exception e) {
            e.printStackTrace();
            throw new ObjectCreationException(e);
        }
    }
View Full Code Here

        public Object getInstance() throws ObjectCreationException {
            if (isSimpleType) {
                try {
                    return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
                } catch (NumberFormatException ex) {
                    throw new ObjectCreationException("Failed to create instance for property "
                            + property.getName() + " with value " + propertyValue, ex);
                } catch (IllegalArgumentException ex) {
                    throw new ObjectCreationException("Failed to create instance for property "
                            + property.getName() + " with value " + propertyValue, ex);
                }
            } else {
                return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
                // return null;
View Full Code Here

                List<Object> values = new ArrayList<Object>();
                for (String aValue : (List<String>)propertyValue) {
                    try {
                        values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
                    } catch (NumberFormatException ex) {
                        throw new ObjectCreationException("Failed to create instance for property "
                                + property.getName() + " with value " + aValue
                                + " from value list of " + propertyValue, ex);
                    } catch (IllegalArgumentException ex) {
                        throw new ObjectCreationException("Failed to create instance for property "
                                + property.getName() + " with value " + aValue
                                + " from value list of " + propertyValue, ex);
                    }
                }
                return values;
View Full Code Here

                Object values = Array.newInstance(javaType, ((List<Object>)propertyValue).size());
                for (String aValue : (List<String>)propertyValue) {
                    try {
                        Array.set(values, count++, simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
                    } catch (NumberFormatException ex) {
                        throw new ObjectCreationException("Failed to create instance for property "
                                + property.getName() + " with value " + aValue
                                + " from value list of " + propertyValue, ex);
                    } catch (IllegalArgumentException ex) {
                        throw new ObjectCreationException("Failed to create instance for property "
                                + property.getName() + " with value " + aValue
                                + " from value list of " + propertyValue, ex);
                    }
                }
                return values;
View Full Code Here

        public T getInstance() throws ObjectCreationException {
            try {
                return (T)scopeContainer.getWrapper(null).getInstance();
            } catch (TargetResolutionException e) {
                throw new ObjectCreationException(e);
            }
        }
View Full Code Here

            throw new AssertionError(message);
        } catch (InvocationTargetException e) {
            String name = ctr.getName();
            String message = logger.getResourceBundle().getString("ConstructorException");
            message = message.replace("{0}", name);
            throw new ObjectCreationException(message, e);
        }

        if (injectors != null) {
            for (Injector<T> injector : injectors) {
                //FIXME Injectors should never be null
                if (injector != null)
                    try {
                        injector.inject(instance);
                    } catch (Exception e) {
                        if (destroyInvoker != null) {
                            destroyInvoker.invokeEvent(instance);
                        }
                        String message = logger.getResourceBundle().getString("InjectorException");
                        message = message.replace("{0}", e.getMessage());
                        throw new ObjectCreationException(message, e);
                    }
            }
        }

        return new ReflectiveInstanceWrapper<T>(instance, initInvoker, destroyInvoker, callbackInjectors);
View Full Code Here

TOP

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