Examples of LoaderException


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

            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

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

                } catch (IOException e) {
                    // ignore
                }
            }
        } catch (IOException e) {
            LoaderException sfe = new LoaderException(e);
            sfe.setResourceURI(url.toString());
            throw sfe;
        } catch (XMLStreamException e) {
            LoaderException sfe = new LoaderException(e);
            sfe.setResourceURI(url.toString());
            throw sfe;
        }
    }
View Full Code Here

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

            try {
                DocumentBuilder documentBuilder = DOMHelper.newDocumentBuilder();
                Document value = StAXUtil.createPropertyValue(reader, property.getXmlType(), documentBuilder);
                propertyValue = new PropertyValue<Type>(name, value);
            } catch (ParserConfigurationException e) {
                throw new LoaderException(e);
            }
        }
        ObjectFactory<Type> objectFactory = propertyFactory.createObjectFactory(property, propertyValue);
        // propertyValue.setValueFactory(new SimplePropertyObjectFactory(property, propertyValue.getValue()));
        propertyValue.setValueFactory(objectFactory);
View Full Code Here

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

        JavaScriptComponentType componentType;
        if (resource == null) {
            try {
                componentType = loadByIntrospection(parent, implementation, deploymentContext);
            } catch (InvalidServiceContractException e) {
                throw new LoaderException("Invalid service contract", e);
            }
        } else {
            componentType = loadFromSidefile(resource, deploymentContext);
        }
View Full Code Here

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

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

                    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

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

        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

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

            }
            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

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

            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

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

        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
Copyright © 2018 www.massapi.com. 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.