Package org.objectweb.celtix.tools.common

Examples of org.objectweb.celtix.tools.common.ToolException


                    jm.setSoapAction(soapAction);
                    if (getSoapStyle(soapStyle) == null && this.bindingObj == null) {
                        org.objectweb.celtix.common.i18n.Message msg =
                            new org.objectweb.celtix.common.i18n.Message("BINDING_STYLE_NOT_DEFINED",
                                                                          LOG);
                        throw new ToolException(msg);
                    }
                    if (getSoapStyle(soapStyle) == null) {
                        jm.setSoapStyle(jf.getSOAPStyle());
                    } else {
                        jm.setSoapStyle(getSoapStyle(soapStyle));
View Full Code Here


            }
            return XML_INPUT_FACTORY.createXMLStreamReader(source.getSystemId(),
                                                         new URL(source.getSystemId()).openStream());
        } catch (Exception e) {
            Message msg = new Message("FAIL_TO_CREATE_STAX", LOG);
            throw new ToolException(msg, e);
        }
    }
View Full Code Here

        String location = (String)env.get(ToolConstants.CFG_WSDLURL);
        try {
            location = ProcessorUtil.getAbsolutePath(location);
        } catch (IOException ioe) {
            Message msg = new Message("CANNOT_FIND_WSDL", LOG, env.get(ToolConstants.CFG_WSDLURL));
            throw new ToolException(msg, ioe);
        }
        String serviceName = portType.getQName().getLocalPart();
        intf.setWebServiceName(serviceName);
        intf.setName(ProcessorUtil.mangleNameToClassName(serviceName));
        intf.setNamespace(namespace);
View Full Code Here

        URLClassLoader classLoader = new URLClassLoader(urls, parent);
        try {
            clazz = classLoader.loadClass(className);
        } catch (Exception e) {
            Message msg = new Message("FAIL_TO_LOAD_CLASS", LOG, className);
            throw new ToolException(msg, e);
        }
        return clazz;
    }
View Full Code Here

        String outdir = (String)env.get(ToolConstants.CFG_OUTPUTDIR);
        if (outdir != null) {
            File dir = new File(outdir);
            if (!dir.exists()) {
                Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, outdir);
                throw new ToolException(msg);
            }
            if (!dir.isDirectory()) {
                Message msg = new Message("NOT_A_DIRECTORY", LOG, outdir);
                throw new ToolException(msg);
            }
        }       
    }
View Full Code Here

        if (!doc.hasParameter("xsdurl")) {
            errors.add(new ErrorVisitor.UserError("XSD URL has to be specified"));
        }
        if (errors.getErrors().size() > 0) {
            Message msg = new Message("PARAMETER_MISSING", LOG);
            throw new ToolException(msg, new BadUsageException(getUsage(), errors));
        }
    }
View Full Code Here

        Message msg = new Message("GENERATE_TYPES_ERROR", LOG);
        try {
            wmodel.createJAXBContext();
        } catch (Exception e) {
            LOG.log(Level.SEVERE, "Create jaxbContext error");
            throw new ToolException(msg, e);
        }
       
        SchemaOutputResolver resolver = new WSDLOutputResolver(env, wmodel);

        try {
            wmodel.getJaxbContext().generateSchema(resolver);
        } catch (Exception e2) {
            throw new ToolException(msg, e2);
        }

        Types types = definition.createTypes();

        try {
            Schema schema;

            schema = (Schema)extensionRegistry.createExtension(Types.class,
                                                               new QName("http://www.w3.org/2001/XMLSchema",
                                                                         "schema"));

            DocumentBuilder docBuilder;
            docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = docBuilder.newDocument();
            Element element = doc.createElement("xsd:schema");
            Map<String, String> schemafileMap = wmodel.getSchemaNSFileMap();

            Set<Map.Entry<String, String>> entryset = schemafileMap.entrySet();
            Iterator<Map.Entry<String, String>> ite = entryset.iterator();
            while (ite.hasNext()) {
                Map.Entry<String, String> entry = (Map.Entry<String, String>)ite.next();
                Element importelement = doc.createElement("xsd:import");
                importelement.setAttribute("namespace", entry.getKey());
                importelement.setAttribute("schemaLocation", entry.getValue());
                element.appendChild(importelement);
            }
            schema.setElement(element);
            types.addExtensibilityElement(schema);
            definition.setTypes(types);
        } catch (Exception e) {
            throw new ToolException(msg, e);
        }

        definition.setTargetNamespace(wmodel.getTargetNameSpace());

        definition.addNamespace(WSDLConstants.WSDL_PREFIX, WSDLConstants.NS_WSDL);
View Full Code Here

        try {
            soapAddress = (SOAPAddress)extensionRegistry
                .createExtension(Port.class, new QName(WSDLConstants.SOAP11_NAMESPACE, "address"));
            soapAddress.setLocationURI(ADDRESS_URI);
        } catch (WSDLException e) {
            throw new ToolException(e.getMessage(), e);
        }
        port.addExtensibilityElement(soapAddress);
        service.addPort(port);
        definition.addService(service);
    }
View Full Code Here

        String outdir = (String)env.get(ToolConstants.CFG_OUTPUTDIR);
        if (outdir != null) {
            File dir = new File(outdir);
            if (!dir.exists()) {
                Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, outdir);
                throw new ToolException(msg);
            }
            if (!dir.isDirectory()) {
                Message msg = new Message("NOT_A_DIRECTORY", LOG, outdir);
                throw new ToolException(msg);
            }
        }

        if (env.containsKey(ToolConstants.CFG_BINDING)) {
            String[] bindings = (String[])env.get(ToolConstants.CFG_BINDING);
            for (int i = 0; i < bindings.length; i++) {
                File binding = new File(bindings[i]);
                if (!binding.exists()) {
                    Message msg = new Message("FILE_NOT_EXIST", LOG, binding);
                    throw new ToolException(msg);
                } else if (binding.isDirectory()) {
                    Message msg = new Message("NOT_A_FILE", LOG, binding);
                    throw new ToolException(msg);
                }
            }
        }
       
        if (!env.optionSet(ToolConstants.CFG_EXTRA_SOAPHEADER)) {
            env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "false");
        }
       
        if (env.optionSet(ToolConstants.CFG_COMPILE)) {
            String clsdir = (String)env.get(ToolConstants.CFG_CLASSDIR);
            if (clsdir != null) {
                File dir = new File(clsdir);
                if (!dir.exists()) {
                    Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, clsdir);
                    throw new ToolException(msg);
                }
            }
        }
    }
View Full Code Here

        if (!doc.hasParameter("wsdlurl")) {
            errors.add(new ErrorVisitor.UserError("WSDL/SCHEMA URL has to be specified"));
        }
        if (errors.getErrors().size() > 0) {
            Message msg = new Message("PARAMETER_MISSING", LOG);
            throw new ToolException(msg, new BadUsageException(getUsage(), errors));
        }
    }
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.tools.common.ToolException

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.