Package com.sun.tools.ws.wscompile

Examples of com.sun.tools.ws.wscompile.ErrorReceiverFilter


  private List<Service> services;
  private net.sf.minuteProject.configuration.bean.Model model;
 
  public WsdlModelMetro(WebServiceModel webServiceModel) {
    this.webServiceModel = webServiceModel;
    ErrorReceiverFilter receiver = new ErrorReceiverFilter();
    WsimportOptions options = new WsimportOptions();
    String location = webServiceModel.getWsdlLocation();
    File file = (location==null)?new File(""):new File(location);
    options.addWSDL(file);
    WSDLModeler wsdlModeler = new WSDLModeler(options, receiver);
View Full Code Here


            public void enableDebugging(){
                cer.enableDebugging();
            }
        }
        final Listener listener = new Listener();
        ErrorReceiverFilter receiver = new ErrorReceiverFilter(listener) {
            public void info(SAXParseException exception) {
                if (options.verbose)
                    super.info(exception);
            }

            public void warning(SAXParseException exception) {
                if (!options.quiet)
                    super.warning(exception);
            }

            @Override
            public void pollAbort() throws AbortException {
                if (listener.isCanceled())
                    throw new AbortException();
            }

            @Override
            public void debug(SAXParseException exception){
                if(options.debugMode){
                    listener.debug(exception);
                }
            }
        };

        for (String arg : args) {
            if (arg.equals("-version")) {
                listener.message(ToolVersion.VERSION.BUILD_VERSION);
                return true;
            }
        }
        try {
            options.parseArguments(args);
            options.validate();
            if(options.debugMode)
                listener.enableDebugging();
            options.parseBindings(receiver);

            try {
                if( !options.quiet )
                    listener.message(WscompileMessages.WSIMPORT_PARSING_WSDL());

                //set auth info
                //if(options.authFile != null)
                    Authenticator.setDefault(new DefaultAuthenticator(receiver, options.authFile));


                WSDLModeler wsdlModeler = new WSDLModeler(options, receiver);
                Model wsdlModel = wsdlModeler.buildModel();
                if (wsdlModel == null) {
                    listener.message(WsdlMessages.PARSING_PARSE_FAILED());
                    return false;
                }
            SchemaCompilerEx schemaCompilerEx = (SchemaCompilerEx) (options
                .getSchemaCompiler());
            Outline outline = schemaCompilerEx.getOutline();
            if (outline == null) {
                    listener.message(WsdlMessages.PARSING_PARSE_FAILED());
                    return false;
            }
           
            XjcErrorReceiverAdapter xjcErrorReceiver = new XjcErrorReceiverAdapter(receiver);
            CGModel jaxbCodeGenModel = ModelBuilder.buildCodeGenModel(outline, xjcErrorReceiver);
           
            SEIModelBuilder seiModelBuilder = new SEIModelBuilder(wsdlModel, receiver);
            WSCodeGenModel wsCodeGenModel = seiModelBuilder.buildSEIModel();
           
                CGConfig cgConfig = new CGConfig();
                cgConfig.picoPrefix = options.prefix;
                cgConfig.picoServiceGroup = wsCodeGenModel.getServiceEndpointInterfaces().get(0).getName();
                // demo only configs
                cgConfig.eBaySOAService = options.eBaySOAPService;
                cgConfig.eBayShoppingAPI = options.eBayShoppingAPI;
                cgConfig.eBayTradingAPI = options.eBayTradingAPI;
               
                // for nano binding
                cgConfig.nanoPrivateField = options.privateField;
           
                // use specific client module to generate code
                Set<FileInfo> targetFiles = new HashSet<FileInfo>();
                try {
                    // generate types first
                    ClientModule clientModule = ModuleFactory.getModule(options.module);
                    clientModule.setErrorReceiver(xjcErrorReceiver);// enable reporting
                    clientModule.init();
                   
          Set<FileInfo> typeFiles = clientModule.generate(jaxbCodeGenModel, cgConfig);
         
          // then generate ws client
          WSClientModule wsClientModule = WSModuleFactory.getModule(options.module);
          wsClientModule.setErrorReceiver(receiver);
          wsClientModule.init();
         
          Set<FileInfo> wsFiles = wsClientModule.generate(wsCodeGenModel, cgConfig);
         
          targetFiles.addAll(typeFiles);
          targetFiles.addAll(wsFiles);
        } catch (XjcModuleException e1) {
          receiver.error(e1);
          return false;
        } catch (WscModuleException e1) {
          receiver.error(e1);
          return false;
        }
               
               
                //generated code
                if( !options.quiet )
                    listener.message(WscompileMessages.WSIMPORT_GENERATING_CODE());
               
                try {
                    ICodeWriter cw = new FileCodeWriter(options.destDir, false);

                    if( !options.quiet ) {
                      XjcErrorListenerAdapter xjcErrorListenerAdapter = new XjcErrorListenerAdapter(listener);
                        cw = new ProgressCodeWriter(cw,xjcErrorListenerAdapter, targetFiles.size());
                    }
                   
                    // then print them out
                    CodeBuilder.build(targetFiles, cw);
                } catch (IOException e) {
                  //e.printStackTrace();
                    receiver.error(e);
                    return false;
                }
               
                listener.message("done.");
               
View Full Code Here

    protected MetadataFinder forest;


    public WSDLModelerBase(WsimportOptions options, ErrorReceiver receiver) {
        this.options = options;
        this.errReceiver = new ErrorReceiverFilter(receiver);;
    }
View Full Code Here

    protected MetadataFinder forest;


    public WSDLModelerBase(WsimportOptions options, ErrorReceiver receiver) {
        this.options = options;
        this.errReceiver = new ErrorReceiverFilter(receiver);;
    }
View Full Code Here

    protected MetadataFinder forest;


    public WSDLModelerBase(WsimportOptions options, ErrorReceiver receiver, MetadataFinder forest) {
        this.options = options;
        this.errReceiver = new ErrorReceiverFilter(receiver);
        this.forest = forest;
    }
View Full Code Here

TOP

Related Classes of com.sun.tools.ws.wscompile.ErrorReceiverFilter

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.