Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.Source


     * @return Map having an entry named as defined in <code>RESOURCE_EXISTS_PARAM_NAME</code> having
     *   value <code>"true"</code>, iff source is resolvable, else having value <code>"false"</code>.
     */
    public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
        String urlstring = parameters.getParameter("url", source);
        Source src = null;
       
        Map result = new HashMap();
       
        try {
            // try to resolve the source
            src = resolver.resolveURI(urlstring);
            src.getInputStream();
           
            // as no exception has been thrown assume that
            // the source exists, and is accessible
            result.put( RESOURCE_EXISTS_PARAM_NAME, "true" );

View Full Code Here


                        }
                    }
                    uri = buf.toString();
                   
                }
                Source input;
                try {
                    input = resolver.resolveURI(uri);
                } catch (Exception exc) {
                    throw new SAXParseException(exc.getMessage(),
                                                ev.location,
                                                exc);
                }
                long lastMod = input.getLastModified();
                StartDocument doc;
                synchronized (cache) {
                    doc = (StartDocument)cache.get(input.getURI());
                    if (doc != null) {
                        if (doc.compileTime < lastMod) {
                            doc = null; // recompile
                        }
                    }
                }
                if (doc == null) {
                    try {
                        Parser parser = new Parser(this);
                        this.resolver.toSAX(input, parser);
                        doc = parser.getStartEvent();
                        doc.compileTime = lastMod;
                    } catch (Exception exc) {
                        throw new SAXParseException(exc.getMessage(),
                                                    ev.location,
                                                    exc);
                    }
                    synchronized (cache) {
                        cache.put(input.getURI(), doc);
                    }
                }
                JXPathContext selectJXPath = jxpathContext;
                MyJexlContext selectJexl = jexlContext;
                if (startImport.select != null) {
View Full Code Here

        return context.getAttribute(name);
    }

    // Inclusion
    public static String getSourceContents(String url, SourceResolver resolver) throws IOException {
        Source source = resolver.resolveURI(url);
        try {
            return getContents(source.getInputStream());
        } finally {
            resolver.release(source);
        }
    }
View Full Code Here

    public Logicsheet(String systemId, ComponentManager manager, SourceResolver resolver)
        throws SAXException, IOException, SourceException, ProcessingException
    {
        this.resolver = resolver;
        this.manager = manager;
        Source source = null;
        try {
            source = this.resolver.resolveURI( systemId );
            this.systemId = source.getURI();
        } finally {
            this.resolver.release( source );
        }
    }
View Full Code Here

    public static String getSourceContents(String uri, String base, SourceResolver resolver) throws IOException {
        if (base != null && base.length() == 0) {
            base = null;
        }
        Source source = resolver.resolveURI(uri, base, null);
        try {
            return getContents(source.getInputStream());
        } finally {
            if (source != null) {
                resolver.release(source);
            }
        }
View Full Code Here

     * @return a <code>TransformerHandler</code> value
     */
    public TransformerHandler getTransformerHandler() throws ProcessingException
    {
        XSLTProcessor xsltProcessor = null;
        Source source = null;
        try {
            xsltProcessor = (XSLTProcessor)this.manager.lookup(XSLTProcessor.ROLE);
            source = this.resolver.resolveURI( this.systemId );

            // If the Source object is not changed, the
View Full Code Here

        throws RuntimeException {
       
        if (base != null && base.length() == 0) {
            base = null;
        }
        Source source = null;
        try {
            source = resolver.resolveURI(uri, base, null);
            resolver.toSAX(source, new IncludeXMLConsumer(contentHandler));
        } catch (Exception e) {
            throw new CascadingRuntimeException("Error including source " + base + " " + uri, e);
View Full Code Here

            throw new ConfigurationException("The form descriptor is not set!");
        }

        ConfigurationHelper conf = null;
        synchronized (XSPFormValidatorHelper.configurations) {
            Source source = null;
            try {
                source = resolver.resolveURI(descriptor);
                conf = (ConfigurationHelper) XSPFormValidatorHelper.configurations.get(source.getURI());
                if (conf == null || (reloadable && conf.lastModified != source.getLastModified())) {
                    logger.debug("(Re)Loading " + descriptor);

                    if (conf == null) {
                        conf = new ConfigurationHelper();
                    }

                    SAXConfigurationHandler builder = new SAXConfigurationHandler();
                    resolver.toSAX(source, builder);

                    conf.lastModified = source.getLastModified();
                    conf.configuration = builder.getConfiguration();

                    XSPFormValidatorHelper.cacheConfiguration(source.getURI(), conf);
                } else {
                    logger.debug("Using cached configuration for " + descriptor);
                }
            } catch (Exception e) {
                logger.error("Could not configure Database mapping environment", e);
                throw new ConfigurationException("Error trying to load configurations for resource: " + source.getURI());
            } finally {
                resolver.release(source);
            }
        }
View Full Code Here

        StringBuffer key = new StringBuffer();

        key.append("SDG(");

        Source source;

        for (Enumeration e = cachedsources.elements(); e.hasMoreElements(); ) {
            source = (Source) e.nextElement();

            key.append(source.getURI());
            if (e.hasMoreElements()) {
                key.append(";");
            }
        }
View Full Code Here

     */
    public SourceValidity getValidity() {

        AggregatedValidity validity = new AggregatedValidity();

        Source source;

        for (Enumeration e = cachedsources.elements(); e.hasMoreElements(); ) {
            source = (Source) e.nextElement();

            validity.add(source.getValidity());
        }

        return validity;
    }
View Full Code Here

TOP

Related Classes of org.apache.excalibur.source.Source

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.