Package org.geotools.xml

Examples of org.geotools.xml.Configuration


        .getResource("/test-data/mappedPolygons.oasis.xml"));
    AppSchemaConfiguration configuration = new AppSchemaConfiguration(
        "http://www.opengis.net/swe/2.0",
        "http://schemas.opengis.net/sweCommon/2.0/swe.xsd",
        new SchemaResolver(catalog));
    Configuration gmlConfiguration = EmfAppSchemaReader
        .findGmlConfiguration(configuration);
    // Null should be returned, not exception
    // Warning message should be in the log
    Assert.assertNull(gmlConfiguration);
  }
View Full Code Here


    }

    private WFSCapabilitiesType parseCapabilities(InputStream capabilitiesReader)
            throws IOException {

        final Configuration wsConfig = strategy.getWsConfiguration();
        final Parser parser = new Parser(wsConfig);
        final Object parsed;
        try {
            parsed = parser.parse(capabilitiesReader);
        } catch (SAXException e) {
View Full Code Here

        if (root == null) {
            throw new IllegalStateException("Document has no root element");
        }

        Configuration config = createConfiguration();

        if (type != null) {
            config.getContext().registerComponentInstance("http://geotools.org/typeDefinition", type);
        }

        //register additional namespaces
        registerNamespaces(root);
        for ( Iterator e = namespaceMappings.entrySet().iterator(); e.hasNext(); ) {
            Map.Entry mapping = (Map.Entry) e.next();
            String prefix = (String) mapping.getKey();
            String uri = (String) mapping.getValue();
           
            root.setAttribute("xmlns:" + prefix, uri );
        }
       
        //process the schemaLocation, replace any schema locations that we know about
        if (root.hasAttribute("xsi:schemaLocation")) {
            XSD xsd = config.getXSD();
            List<XSD> deps = xsd.getAllDependencies();
            deps.add(xsd);
           
            String[] locations = root.getAttribute("xsi:schemaLocation").split(" +");
            for (int i = 0; i < locations.length; i += 2) {
                String uri = locations[i];
                for (XSD dep : deps) {
                    if (dep.getNamespaceURI().equals(uri)) {
                        locations[i+1] = dep.getSchemaLocation();
                    }
                }
            }
           
            StringBuffer joined = new StringBuffer();
            for (String s : locations) {
                joined.append(s).append(" ");
            }
            joined.setLength(joined.length()-1);
            root.setAttribute("xsi:schemaLocation", joined.toString());
        }
        else {
            //no schemaLocation attribute, add one for the schema for this config
            root.setAttribute("xsi:schemaLocation",
                config.getNamespaceURI() + " " + config.getSchemaFileURL());
        }
       

        DOMParser parser = new DOMParser(config, document);
View Full Code Here

     * @return The object encoded.
     * @throws Exception
     */
    protected Document encode(Object object, QName element, QName type)
        throws Exception {
        Configuration configuration = createConfiguration();

        if (type != null) {
            //set the hint
            configuration.getContext()
                         .registerComponentInstance("http://geotools.org/typeDefinition", type);
        }

        XSDSchema schema = configuration.getXSD().getSchema();

        Encoder encoder = new Encoder(configuration, schema);
       
        //additional namespaces
        for ( Iterator e = namespaceMappings.entrySet().iterator(); e.hasNext(); ) {
View Full Code Here

     * binding "binds" to, the key of the binding in the container.
     *
     * @return The binding.
     */
    protected Binding binding(QName name) {
        Configuration configuration = createConfiguration();

        //create the context
        MutablePicoContainer context = new DefaultPicoContainer();
        context = configuration.setupContext(context);

        //create the binding container
        Map bindings = configuration.setupBindings();
        BindingLoader bindingLoader = new BindingLoader(bindings);
//        MutablePicoContainer container = bindingLoader.getContainer();
//        container = configuration.setupBindings(container);
//        bindingLoader.setContainer(container);

        //register cmponents available to bindings at runtime
        context.registerComponentInstance(new BindingFactoryImpl(bindingLoader));

        //binding walker support
        context.registerComponentInstance(new BindingWalkerFactoryImpl(bindingLoader, context));

        //logger
        context.registerComponentInstance(logger);

        //setup the namespace support
        NamespaceSupport namespaces = new NamespaceSupport();
        HashMap mappings = new HashMap();

        try {
            for (Iterator d = configuration.getXSD().getDependencies().iterator(); d.hasNext();) {
                XSD xsd = (XSD) d.next();
                XSDSchema schema = xsd.getSchema();

                mappings.putAll(schema.getQNamePrefixToNamespaceMap());
            }

            mappings.putAll(configuration.getXSD().getSchema().getQNamePrefixToNamespaceMap());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        for (Iterator m = mappings.entrySet().iterator(); m.hasNext();) {
            Map.Entry mapping = (Map.Entry) m.next();
            String key = (String) mapping.getKey();

            if (key == null) {
                key = "";
            }

            namespaces.declarePrefix(key, (String) mapping.getValue());
        }

        context.registerComponentInstance(namespaces);
        context.registerComponentInstance(new NamespaceSupportWrapper(namespaces));
       
        SchemaIndex index = new SchemaIndexImpl( new XSDSchema[]{configuration.schema()} );
        context.registerComponentInstance(index);
       
        context.registerComponentInstance(configuration);
       
        return bindingLoader.loadBinding(name, context);
View Full Code Here

    Parser parser;

    protected void setUp() throws Exception {
        super.setUp();

        Configuration configuration = new OGCConfiguration();
        parser = new Parser(configuration);
    }
View Full Code Here

        {
            inputStream = httpResponse.getResponseStream();

            // Map hints = new HashMap();
            // hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WPSSchema.getInstance());
            Configuration config = new WPSConfiguration();
            Parser parser = new Parser(config);

            Object object;
            excepResponse = null;
            processDescs = null;
View Full Code Here

    }

    private void parseDocumentResponse(InputStream inputStream) throws IOException {
        // Map hints = new HashMap();
        // hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WPSSchema.getInstance());
        Configuration config = new WPSConfiguration();
        Parser parser = new Parser(config);

        Object object;
        excepResponse = null;
        exeResponse = null;
View Full Code Here

            inputStream = httpResponse.getResponseStream();

            // Map hints = new HashMap();
            // hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WPSSchema.getInstance());
            // hints.put(DocumentFactory.VALIDATION_HINT, Boolean.FALSE);
            Configuration config = new WPSConfiguration();
            Parser parser = new Parser(config);

            Object object;
            excepResponse = null;
            capabilities = null;
View Full Code Here

    @Override
    public void performPostOutput(OutputStream outputStream) throws IOException
    {
        // Encode the request into GML2 with the schema provided in the
        // describeprocess
        Configuration config = new WPSConfiguration();
        Encoder encoder = new Encoder(config);
        encoder.setIndenting(true);

        // http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd
        ExecuteType request = createExecuteType();
View Full Code Here

TOP

Related Classes of org.geotools.xml.Configuration

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.