Package org.apache.tuscany.core.config

Examples of org.apache.tuscany.core.config.ConfigurationLoadException


        Destroy destroy = method.getAnnotation(Destroy.class);
        if (destroy == null) {
            return;
        }
        if (method.getParameterTypes().length != 0) {
            throw new ConfigurationLoadException("Destroy methods cannot take parameters");
        }
        type.getExtensibilityElements().add(new DestroyInvokerExtensibilityElement(method));
    }
View Full Code Here


        String text = reader.getElementText();
        try {
            Context context = new InitialContext();
            return new JNDIObjectFactory(context, text);
        } catch (NamingException e) {
            throw new ConfigurationLoadException(e);
        }
    }
View Full Code Here

                    QName qname = reader.getName();
                    if (AssemblyConstants.WIRE_SOURCE.equals(qname)) {
                        String uri = reader.getElementText();
                        int pos = uri.indexOf('/');
                        if (pos < 1) {
                            throw new ConfigurationLoadException("Invalid source wire");
                        }
                        String partName = uri.substring(0, pos);
                        String portName = uri.substring(pos + 1);
                        wire.setSource(factory.createServiceURI(null, partName, portName));
                    } else if (AssemblyConstants.WIRE_TARGET.equals(qname)) {
View Full Code Here

    public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
        QName name = reader.getName();
        monitor.elementLoad(name);
        StAXElementLoader<? extends AssemblyObject> loader = loaders.get(name);
        if (loader == null) {
            ConfigurationLoadException e = new ConfigurationLoadException("Unrecognized element");
            e.setIdentifier(name.toString());
            throw e;
        } else {
            return loader.load(reader, loaderContext);
        }
    }
View Full Code Here

        } else {
            try {
                Class<?> type = loaderContext.getResourceLoader().loadClass(typeName);
                property.setType(type);
            } catch (ClassNotFoundException e) {
                throw new ConfigurationLoadException(e);
            }
        }
        property.setMany(Boolean.parseBoolean(reader.getAttributeValue(null, "many")));
        property.setDefaultValue(reader.getAttributeValue(null, "default"));
        String required = reader.getAttributeValue(null, "required");
View Full Code Here

                    return new SingletonObjectFactory(valueOf.invoke(null, text));
                } catch (IllegalAccessException e) {
                    throw new AssertionError("getMethod returned an inaccessible method");
                } catch (InvocationTargetException e) {
                    // FIXME we should throw something better
                    throw new ConfigurationLoadException(e.getCause());
                }
            }
        } catch (NoSuchMethodException e) {
            // try something else
        }

        // does this type have a constructor that takes a String?
        try {
            Constructor<?> ctr = type.getConstructor(String.class);
            return new SingletonObjectFactory(ctr.newInstance(text));
        } catch (NoSuchMethodException e) {
            // try something else
        } catch (IllegalAccessException e) {
            throw new AssertionError("getConstructor returned an inaccessible method");
        } catch (InstantiationException e) {
            throw new ConfigurationLoadException("Property type cannot be instantiated: " + type.getName());
        } catch (InvocationTargetException e) {
            // FIXME we should throw something better
            throw new ConfigurationLoadException(e.getCause());
        }

        // do we have a property editor for it?
        PropertyEditor editor = PropertyEditorManager.findEditor(type);
        if (editor != null) {
            try {
                editor.setAsText(text);
                return new SingletonObjectFactory(editor.getValue());
            } catch (IllegalArgumentException e) {
                // FIXME we should throw something better
                throw new ConfigurationLoadException(e);

            }
        }

        // FIXME we should throw something better
        throw new ConfigurationLoadException("Do not have a way to parse a String into a " + type.getName());
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.config.ConfigurationLoadException

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.