Examples of LSInputImpl


Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                    //ignore - baseURI not a valid URI
                } catch (MalformedURLException e) {
                    //ignore - baseURI or systemId not a URL either
                }
            }
            LSInputImpl impl = null;
            if (done.contains(newId + ":" + namespaceURI)) {
                return null;
            }
           
            if (schemas.containsKey(newId + ":" + namespaceURI)) {
                byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                impl = createInput(newId, ds);              
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && schemas.containsKey(newId + ":null")) {
                byte[] ds = schemas.get(newId + ":null");
                impl = createInput(newId, ds);              
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && bus != null && systemId != null) {
                ResourceManager rm = bus.getExtension(ResourceManager.class);
                URL url = rm == null ? null : rm.resolveResource(systemId, URL.class);
                if (url != null) {
                    newId = url.toString();
                    if (done.contains(newId + ":" + namespaceURI)) {
                        return null;
                    }
                    if (schemas.containsKey(newId + ":" + namespaceURI)) {
                        byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                        impl = createInput(newId, ds);
                        done.add(newId + ":" + namespaceURI);
                    }
                }
            }
            if (impl == null) {
                for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                    if (ent.getKey().endsWith(systemId + ":" + namespaceURI)) {
                        schemas.remove(ent.getKey());
                        impl = createInput(newId, ent.getValue());
                        done.add(newId + ":" + namespaceURI);
                        return impl;
                    }
                }
                // there can be multiple includes on the same namespace. This scenario is not envisioned yet.
                // hence the filename part is included as well.
                if (systemId != null) {
                    String systemIdFileName = systemId.substring(systemId.lastIndexOf('/') + 1);
                    for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                        if (ent.getKey().endsWith(systemIdFileName + ":" + namespaceURI)) {
                            schemas.remove(ent.getKey());
                            impl = createInput(newId, ent.getValue());
                            done.add(newId + ":" + namespaceURI);
                            return impl;
                        }
                    }
                }
                // handle case where given systemId is null (so that
                // direct key lookup fails) by scanning through map
                // searching for a namespace match
                if (namespaceURI != null) {
                    for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                        if (ent.getKey().endsWith(":" + namespaceURI)) {
                            schemas.remove(ent.getKey());
                            impl = createInput(newId, ent.getValue());
                            done.add(newId + ":" + namespaceURI);
                            return impl;
                        }
                    }
                }
                   
                //REVIST - we need to get catalogs in here somehow  :-(
                if (systemId == null) {
                    systemId = publicId;
                }
                if (systemId != null) {
                    InputSource source = resolver.resolve(systemId, baseURI);
                    if (source != null) {
                        impl = new LSInputImpl();
                        impl.setByteStream(source.getByteStream());
                        impl.setSystemId(source.getSystemId());
                        impl.setPublicId(source.getPublicId());
                    }
                }
                LOG.warning("Could not resolve Schema for " + systemId);
            }
            return impl;
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                LOG.warning("Could not resolve Schema for " + systemId);
            }
            return impl;
        }
        private LSInputImpl createInput(String newId, byte[] value) {
            LSInputImpl impl = new LSInputImpl();
            impl.setSystemId(newId);
            impl.setBaseURI(newId);
            impl.setCharacterStream(
                new InputStreamReader(
                    new ByteArrayInputStream(value)));
            return impl;
        }
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                                    }
                                    if (resolvedLocation != null) {
                                        InputStream resourceStream =
                                            ResourceUtils.getResourceStream(resolvedLocation, bus);
                                        if (resourceStream != null) {
                                            return new LSInputImpl(publicId, systemId, resourceStream);
                                        }
                                    }
                                } catch (Exception ex) {
                                    // ignore
                                }
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                                    }
                                    if (resolvedLocation != null) {
                                        InputStream resourceStream =
                                            ResourceUtils.getResourceStream(resolvedLocation, bus);
                                        if (resourceStream != null) {
                                            return new LSInputImpl(publicId, systemId, resourceStream);
                                        }
                                    }
                                } catch (Exception ex) {
                                    // ignore
                                }
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                }
            }
            if (done.contains(newId + ":" + namespaceURI)) {
                return null;
            }
            LSInputImpl impl = null;
           
            if (schemas.containsKey(newId + ":" + namespaceURI)) {
                byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                impl = new LSInputImpl();
                impl.setSystemId(newId);
                impl.setBaseURI(newId);
                impl.setByteStream(new ByteArrayInputStream(ds));
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && schemas.containsKey(newId + ":null")) {
                byte[] ds = schemas.get(newId + ":null");
                impl = new LSInputImpl();
                impl.setSystemId(newId);
                impl.setBaseURI(newId);
                impl.setByteStream(new ByteArrayInputStream(ds));
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && bus != null && systemId != null) {
                ResourceManager rm = bus.getExtension(ResourceManager.class);
                URL url = rm == null ? null : rm.resolveResource(systemId, URL.class);
                if (url != null) {
                    newId = url.toString();
                    if (done.contains(newId + ":" + namespaceURI)) {
                        return null;
                    }
                    if (schemas.containsKey(newId + ":" + namespaceURI)) {
                        byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                        impl = new LSInputImpl();
                        impl.setSystemId(newId);
                        impl.setBaseURI(newId);
                        impl.setByteStream(new ByteArrayInputStream(ds));
                        done.add(newId + ":" + namespaceURI);
                    }
                }
            }
            if (impl != null) {
                return impl;
            }
            for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                if (ent.getKey().endsWith(systemId + ":" + namespaceURI)) {
                    schemas.remove(ent.getKey());
                    impl = new LSInputImpl();
                    impl.setSystemId(newId);
                    impl.setBaseURI(newId);
                    impl.setCharacterStream(
                        new InputStreamReader(
                            new ByteArrayInputStream(ent.getValue())));
                    done.add(newId + ":" + namespaceURI);
                    return impl;
                }
            }
            // handle case where given systemId is null (so that
            // direct key lookup fails) by scanning through map
            // searching for a namespace match
            if (namespaceURI != null) {
                for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                    if (ent.getKey().endsWith(namespaceURI)) {
                        schemas.remove(ent.getKey());
                        impl = new LSInputImpl();
                        impl.setSystemId(newId);
                        impl.setBaseURI(newId);
                        impl.setCharacterStream(
                            new InputStreamReader(
                                new ByteArrayInputStream(ent.getValue())));
                        done.add(newId + ":" + namespaceURI);
                        return impl;
                    }
                }
            }
               
            //REVIST - we need to get catalogs in here somehow  :-(
            if (systemId == null) {
                systemId = publicId;
            }
            if (systemId != null) {
                InputSource source = resolver.resolve(systemId, baseURI);
                if (source != null) {
                    impl = new LSInputImpl();
                    impl.setByteStream(source.getByteStream());
                    impl.setSystemId(source.getSystemId());
                    impl.setPublicId(source.getPublicId());
                }
            }
            LOG.warning("Could not resolve Schema for " + systemId);
            return impl;
        }
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                    //ignore - baseURI not a valid URI
                } catch (MalformedURLException e) {
                    //ignore - baseURI or systemId not a URL either
                }
            }
            LSInputImpl impl = null;
            if (done.contains(newId + ":" + namespaceURI)) {
                return null;
            }
           
            if (schemas.containsKey(newId + ":" + namespaceURI)) {
                byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                impl = createInput(newId, ds);              
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && schemas.containsKey(newId + ":null")) {
                byte[] ds = schemas.get(newId + ":null");
                impl = createInput(newId, ds);              
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && bus != null && systemId != null) {
                ResourceManager rm = bus.getExtension(ResourceManager.class);
                URL url = rm == null ? null : rm.resolveResource(systemId, URL.class);
                if (url != null) {
                    newId = url.toString();
                    if (done.contains(newId + ":" + namespaceURI)) {
                        return null;
                    }
                    if (schemas.containsKey(newId + ":" + namespaceURI)) {
                        byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                        impl = createInput(newId, ds);
                        done.add(newId + ":" + namespaceURI);
                    }
                }
            }
            if (impl == null) {
                for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                    if (ent.getKey().endsWith(systemId + ":" + namespaceURI)) {
                        schemas.remove(ent.getKey());
                        impl = createInput(newId, ent.getValue());
                        done.add(newId + ":" + namespaceURI);
                        return impl;
                    }
                }
                // there can be multiple includes on the same namespace. This scenario is not envisioned yet.
                // hence the filename part is included as well.
                if (systemId != null) {
                    String systemIdFileName = systemId.substring(systemId.lastIndexOf('/') + 1);
                    for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                        if (ent.getKey().endsWith(systemIdFileName + ":" + namespaceURI)) {
                            schemas.remove(ent.getKey());
                            impl = createInput(newId, ent.getValue());
                            done.add(newId + ":" + namespaceURI);
                            return impl;
                        }
                    }
                }
                // handle case where given systemId is null (so that
                // direct key lookup fails) by scanning through map
                // searching for a namespace match
                if (namespaceURI != null) {
                    for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                        if (ent.getKey().endsWith(":" + namespaceURI)) {
                            schemas.remove(ent.getKey());
                            impl = createInput(newId, ent.getValue());
                            done.add(newId + ":" + namespaceURI);
                            return impl;
                        }
                    }
                }
                   
                //REVIST - we need to get catalogs in here somehow  :-(
                if (systemId == null) {
                    systemId = publicId;
                }
                if (systemId != null) {
                    InputSource source = resolver.resolve(systemId, baseURI);
                    if (source != null) {
                        impl = new LSInputImpl();
                        impl.setByteStream(source.getByteStream());
                        impl.setSystemId(source.getSystemId());
                        impl.setPublicId(source.getPublicId());
                    }
                }
                LOG.warning("Could not resolve Schema for " + systemId);
            }
            return impl;
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                LOG.warning("Could not resolve Schema for " + systemId);
            }
            return impl;
        }
        private LSInputImpl createInput(String newId, byte[] value) {
            LSInputImpl impl = new LSInputImpl();
            impl.setSystemId(newId);
            impl.setBaseURI(newId);
            impl.setCharacterStream(
                new InputStreamReader(
                    new ByteArrayInputStream(value)));
            return impl;
        }
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

    }

    private LSInput loadLSInput(String ns) {
        String path = ToolConstants.CXF_SCHEMAS_DIR_INJAR + NSFILEMAP.get(ns);
        URL url = getClass().getClassLoader().getResource(path);
        LSInput lsin = new LSInputImpl();
        lsin.setSystemId(url.toString());
        try {
            lsin.setByteStream(url.openStream());
        } catch (IOException e) {
            return null;
        }
        return lsin;
    }
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                URLConnection urlCon = null;
                try {
                    url = new URL(resURL);
                    urlCon = url.openConnection();
                    urlCon.setUseCaches(false);
                    lsin = new LSInputImpl();
                    lsin.setSystemId(resURL);
                    lsin.setByteStream(urlCon.getInputStream());
                    msg = new Message("RESOLVE_FROM_REMOTE", LOG, url);
                    LOG.log(Level.FINE, msg.toString());
                    return lsin;
                } catch (Exception e) {
                    e.printStackTrace();
                    return null;
                }
            }
        } else if (resURL != null && !resURL.startsWith("http:")) {
            localFile = resURL;
        else {
            return null;
        }


        URIResolver resolver;
        try {
            msg = new Message("RESOLVE_FROM_LOCAL", LOG, localFile);
            LOG.log(Level.FINE, msg.toString());

            resolver = new URIResolver(localFile);
            if (resolver.isResolved()) {
                lsin = new LSInputImpl();
                lsin.setSystemId(localFile);
                lsin.setByteStream(resolver.getInputStream());
            }
        } catch (IOException e) {
            return null;
View Full Code Here

Examples of org.apache.cxf.common.xmlschema.LSInputImpl

                }
            }
            if (done.contains(newId + ":" + namespaceURI)) {
                return null;
            }
            LSInputImpl impl = null;
           
            if (schemas.containsKey(newId + ":" + namespaceURI)) {
                byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                impl = new LSInputImpl();
                impl.setSystemId(newId);
                impl.setBaseURI(newId);
                impl.setByteStream(new ByteArrayInputStream(ds));
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && schemas.containsKey(newId + ":null")) {
                byte[] ds = schemas.get(newId + ":null");
                impl = new LSInputImpl();
                impl.setSystemId(newId);
                impl.setBaseURI(newId);
                impl.setByteStream(new ByteArrayInputStream(ds));
                done.add(newId + ":" + namespaceURI);
            }
            if (impl == null && bus != null && systemId != null) {
                ResourceManager rm = bus.getExtension(ResourceManager.class);
                URL url = rm == null ? null : rm.resolveResource(systemId, URL.class);
                if (url != null) {
                    newId = url.toString();
                    if (done.contains(newId + ":" + namespaceURI)) {
                        return null;
                    }
                    if (schemas.containsKey(newId + ":" + namespaceURI)) {
                        byte[] ds = schemas.remove(newId + ":" + namespaceURI);
                        impl = new LSInputImpl();
                        impl.setSystemId(newId);
                        impl.setBaseURI(newId);
                        impl.setByteStream(new ByteArrayInputStream(ds));
                        done.add(newId + ":" + namespaceURI);
                    }
                }
            }
            if (impl != null) {
                return impl;
            }
            for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                if (ent.getKey().endsWith(systemId + ":" + namespaceURI)) {
                    schemas.remove(ent.getKey());
                    impl = new LSInputImpl();
                    impl.setSystemId(newId);
                    impl.setBaseURI(newId);
                    impl.setCharacterStream(
                        new InputStreamReader(
                            new ByteArrayInputStream(ent.getValue())));
                    done.add(newId + ":" + namespaceURI);
                    return impl;
                }
            }
            // handle case where given systemId is null (so that
            // direct key lookup fails) by scanning through map
            // searching for a namespace match
            if (namespaceURI != null) {
                for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                    if (ent.getKey().endsWith(namespaceURI)) {
                        schemas.remove(ent.getKey());
                        impl = new LSInputImpl();
                        impl.setSystemId(newId);
                        impl.setBaseURI(newId);
                        impl.setCharacterStream(
                            new InputStreamReader(
                                new ByteArrayInputStream(ent.getValue())));
                        done.add(newId + ":" + namespaceURI);
                        return impl;
                    }
                }
            }
               
            //REVIST - we need to get catalogs in here somehow  :-(
            if (systemId == null) {
                systemId = publicId;
            }
            if (systemId != null) {
                InputSource source = resolver.resolve(systemId, baseURI);
                if (source != null) {
                    impl = new LSInputImpl();
                    impl.setByteStream(source.getByteStream());
                    impl.setSystemId(source.getSystemId());
                    impl.setPublicId(source.getPublicId());
                }
            }
            LOG.warning("Could not resolve Schema for " + systemId);
            return impl;
        }
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.