Package org.apache.tuscany.spi.loader

Examples of org.apache.tuscany.spi.loader.LoaderException


                    return type.cast(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 LoaderException(e.getCause());
                }
            }
        } catch (NoSuchMethodException e) {
            // try something else
        }

        // does this type have a constructor that takes a String?
        try {
            Constructor<T> ctr = type.getConstructor(String.class);
            return 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 LoaderException("Property type cannot be instantiated: " + type.getName());
        } catch (InvocationTargetException e) {
            // FIXME we should throw something better
            throw new LoaderException(e.getCause());
        }

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

            }
        }

        // FIXME we should throw something better
        throw new LoaderException("Do not have a way to parse a String into a " + type.getName());

    }
View Full Code Here


                    return new SingletonObjectFactory<T>(type.cast(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 LoaderException(e.getCause());
                }
            }
        } catch (NoSuchMethodException e) {
            // try something else
        }

        // does this type have a constructor that takes a String?
        try {
            Constructor<T> ctr = type.getConstructor(String.class);
            return new SingletonObjectFactory<T>(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 LoaderException("Property type cannot be instantiated: " + type.getName());
        } catch (InvocationTargetException e) {
            // FIXME we should throw something better
            throw new LoaderException(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<T>((T) editor.getValue());
            } catch (IllegalArgumentException e) {
                // FIXME we should throw something better
                throw new LoaderException(e);

            }
        }

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

        String wsdlLocation = reader.getAttributeValue(null, "location");
        LoaderUtil.skipToEndElement(reader);
        try {
            return createBinding(uri, endpoint, wsdlLocation, deploymentContext);
        } catch (Exception e) {
            throw new LoaderException(e);
        }

    }
View Full Code Here

            }
            return new WebServiceBinding(definition, thePort, uri, endpoint, service);
        }
        // FIXME: Find the first port?
        throw new LoaderException("Web Service endpoint cannot be resolved: " + endpoint);

    }
View Full Code Here

            while ((count = reader.read(buffer)) > 0) {
                source.append(buffer, 0, count);
            }
            return source.toString();
        } catch (IOException e) {
            LoaderException le = new LoaderException(e);
            le.setIdentifier(resource);
            throw le;
        } finally {
            try {
                is.close();
            } catch (IOException e) {
View Full Code Here

        String wsdlLocation = reader.getAttributeValue(null, "location");
        try {
            return createBinding(uri, endpointAttribute, wsdlLocation, deploymentContext);
        } catch (Exception e) {

            throw new LoaderException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.loader.LoaderException

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.