Package org.jibx.schema

Examples of org.jibx.schema.SchemaVisitor


     * @return <code>true</code> if successful, <code>false</code> if error
     */
    public boolean customizeSchemas() {
       
        // TODO: remove this once union handling fully implemented
        SchemaVisitor visitor = new SchemaVisitor() {
           
            public void exit(UnionElement node) {
                OpenAttrBase parent = node.getParent();
                int count = parent.getChildCount();
                for (int i = 0; i < count; i++) {
View Full Code Here


            TreeWalker wlkr = new TreeWalker(null, new SchemaContextTracker());
            for (Iterator iter = resolves.iterator(); iter.hasNext();) {
                SchemaElement schema = vctx.getSchemaById(((ISchemaResolver)iter.next()).getId());
                exists.add(schema);
                final SchemaHolder holder = new SchemaHolder(schema);
                SchemaVisitor visitor = new SchemaVisitor() {
                   
                    public boolean visit(SchemaBase node) {
                        return false;
                    }
                   
                    public boolean visit(ComplexTypeElement node) {
                        typeschemas.put(node.getQName(), holder);
                        return false;
                    }
                   
                    public boolean visit(ElementElement node) {
                        elemschemas.put(node.getQName(), holder);
                        return false;
                    }
                   
                };
                wlkr.walkChildren(schema, visitor);
            }
           
            // build set of binding definitions provided on command line
            final Set bindings = new HashSet();
            errors = ResourceMatcher.matchPaths(new File("."), null, parms.getUseBindings(),
                new ResourceMatcher.ReportMatch() {
                    public void foundMatch(String path, URL url) {
                        bindings.add(url);
                    }
                });
            if (errors.size() > 0) {
                for (Iterator iter = errors.iterator(); iter.hasNext();) {
                    System.err.println(iter.next());
                }
                System.exit(3);
            }
           
            // build maps of type and element mappings from bindings
            Map classelems = new HashMap();
            Map classtypes = new HashMap();
            for (Iterator iter = bindings.iterator(); iter.hasNext();) {
                URL url = (URL)iter.next();
                processPregeneratedBinding(url, classelems, classtypes);
            }
           
            // generate services, bindings, and WSDLs
            Jibx2Wsdl inst = new Jibx2Wsdl(parms);
            ArrayList extras = new ArrayList(parms.getExtraTypes());
            ArrayList classes = parms.getGlobal().getUnmarshalledClasses();
            for (int i = 0; i < classes.size(); i++) {
                ClassCustom clas = (ClassCustom)classes.get(i);
                if (clas.isForceMapping()) {
                    extras.add(clas.getName());
                }
            }
            List wsdls = inst.generate(parms.getExtraArgs(), extras, classelems, elemschemas, classtypes, typeschemas,
                exists);
            if (wsdls != null) {
               
                // write the schemas and WSDLS
                SchemaGen.writeSchemas(parms.getGeneratePath(), inst.m_uriSchemaMap.values());
                WsdlWriter writer = new WsdlWriter();
                for (Iterator iter = wsdls.iterator(); iter.hasNext();) {
                    Definitions def = (Definitions)iter.next();
                    File file = new File(parms.getGeneratePath(), def.getServiceName() + ".wsdl");
                    writer.writeWSDL(def, new FileOutputStream(file));
                }
               
                // find existing schemas referenced (directly or indirectly) from WSDL schemas
                final Set needschemas = new HashSet();
                SchemaVisitor visitor = new SchemaVisitor() {
                   
                    private int m_existsDepth;
                   
                    public void exit(SchemaElement node) {
                        if (exists.contains(node)) {
View Full Code Here

                }
            }
        }
       
        // flag extensions for facets to be removed from schema
        SchemaVisitor visitor = new FacetRemoverVisitor(this);
        for (Iterator iter = globals.iterator(); iter.hasNext();) {
            OpenAttrBase global = (OpenAttrBase)iter.next();
            ComponentExtension exten = (ComponentExtension)global.getExtension();
            if (exten != null && !exten.isRemoved()) {
                wlkr.walkElement(global, visitor);
View Full Code Here

     * @return <code>true</code> if successful, <code>false</code> if error
     */
    public boolean customizeSchemas(String pack, ProblemHandler handler) {
       
        // TODO: remove this once list and union handling fully implemented
        SchemaVisitor visitor = new SchemaVisitor() {
           
            private void replaceSimpleType(OpenAttrBase node) {
                OpenAttrBase parent = node.getParent();
                int count = parent.getChildCount();
                for (int i = 0; i < count; i++) {
View Full Code Here

TOP

Related Classes of org.jibx.schema.SchemaVisitor

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.