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

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


           
            if (isSimpleType) {
                try {
                    result = 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 {
                result = mediator.mediate(propertyValue, sourceDataType, targetDataType, 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);
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);
View Full Code Here

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

    }
View Full Code Here

   
    public void inject(T instance, Object value) {
        try {
            field.set(instance, value);
        } catch (IllegalAccessException e) {
            throw new ObjectCreationException("Field is not accessible [" + field + "]", e);
        }
    }
View Full Code Here

   
    private void inject(T instance, Object value) {
        try {
            method.invoke(instance, value);
        } catch (IllegalAccessException e) {
            throw new ObjectCreationException("Method is not accessible [" + method + "]", e);
        } 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

            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
                if (injector != null)
                    try {
                        injector.inject(instance);
                    } catch (Exception e) {
                        if (destroyInvoker != null) {
                            destroyInvoker.invokeEvent(instance);
                        }
                        throw new ObjectCreationException("Exception invoking injector - " + e.getMessage(), e);
                    }
            }
        }

        return new ReflectiveInstanceWrapper<T>(instance, initInvoker, destroyInvoker, callbackInjectors);
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

            injector.inject(wrapper.getInstance());
          } else {
            injector.injectNull(wrapper.getInstance());
          }
        } catch (Exception e) {                    
          throw new ObjectCreationException("Exception invoking injector - " + e.getMessage(), 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

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.