Package org.apache.cxf.tools.common

Examples of org.apache.cxf.tools.common.ToolException


                }
            }
        }

        Message msg = new Message("SERVICE_NOT_FOUND", LOG, new Object[] {serviceName});
        throw new ToolException(msg);
    }
View Full Code Here


        if (!isSuppressCodeGen()) {
            if (outdir != null) {
                File dir = new File(outdir);
                if (!dir.exists() && !dir.mkdirs()) {
                    Message msg = new Message("DIRECTORY_COULD_NOT_BE_CREATED", LOG, outdir);
                    throw new ToolException(msg);
                }
                if (!dir.isDirectory()) {
                    Message msg = new Message("NOT_A_DIRECTORY", LOG, outdir);
                    throw new ToolException(msg);
                }
            }
   
            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() && !dir.mkdirs()) {
                        Message msg = new Message("DIRECTORY_COULD_NOT_BE_CREATED", LOG, clsdir);
                        throw new ToolException(msg);
                    }
                }
            }
        }

        String wsdl = (String)env.get(ToolConstants.CFG_WSDLURL);
        if (StringUtils.isEmpty(wsdl)) {
            Message msg = new Message("NO_WSDL_URL", LOG);
            throw new ToolException(msg);
        }

        env.put(ToolConstants.CFG_WSDLURL, URIParserUtil.getAbsoluteURI(wsdl));
        if (!env.containsKey(ToolConstants.CFG_WSDLLOCATION)) {
            //make sure the "raw" form is used for the wsdlLocation
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

    public void generateTypes() throws ToolException {
        DataBindingProfile dataBindingProfile = context.get(DataBindingProfile.class);
        if (dataBindingProfile == null) {
            Message msg = new Message("FOUND_NO_DATABINDING", LOG);
            throw new ToolException(msg);
        }
        dataBindingProfile.initialize(context);
        if (passthrough()) {
            return;
        }
View Full Code Here

    public void validate(final ServiceInfo service) throws ToolException {
        for (ServiceValidator validator : getServiceValidators()) {
            service.setProperty(ToolContext.class.getName(), context);
            validator.setService(service);
            if (!validator.isValid()) {
                throw new ToolException(validator.getErrorMessage());
            }
        }
    }
View Full Code Here

            }              
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, "FAILED_TO_GEN_LOCAL_WSDL", ex);
            Message msg = new Message("FAILED_TO_GEN_LOCAL_WSDL", LOG);
            throw new ToolException(msg, ex);
        }
    }
View Full Code Here

                    if (!res.booleanValue()) {
                        return false;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    throw new ToolException(e);
                }
            }
        }
        return true;
View Full Code Here

            }
            return getDocument(wsdlURI.toURL());
        } catch (ToolException e) {
            throw e;
        } catch (Exception e) {
            throw new ToolException(e);
        }
    }
View Full Code Here

            input = url.openStream();
            StreamSource src = new StreamSource(input, url.toExternalForm());
            reader = StaxUtils.createXMLStreamReader(src);
            return StaxUtils.read(reader, true);
        } catch (Exception e) {
            throw new ToolException(e);
        } finally {
            StaxUtils.close(reader);
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {
                    // throw or change do nothing.
                    throw new ToolException(e);
                }
            }
        }
    }
View Full Code Here

        try {
            StreamSource source = new StreamSource(wsdl);
            reader = StaxUtils.createXMLStreamReader(source);
            return StaxUtils.read(reader, true);
        } catch (Exception e) {
            throw new ToolException(e);
        } finally {
            try {
                if (reader != null) {
                    try {
                        //on woodstox, calling closeCompletely will allow any
                        //cached things like dtds and such to be completely
                        //closed and cleaned up.
                        reader.getClass().getMethod("closeCompletely").invoke(reader);
                    } catch (Throwable t) {
                        //ignore
                    }
                    reader.close();
                }
            } catch (XMLStreamException e) {
                // throw or change do nothing.
                throw new ToolException(e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.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.