Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.Source


    public final Document load(String source) {

        SourceResolver resolver = null;
        SAXParser parser = null;
        Source assertionsource = null;

        Document assertiondocument = null;
        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            assertNotNull("Test lookup of source resolver", resolver);

            parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
            assertNotNull("Test lookup of parser", parser);

            assertNotNull("Test if assertion document is not null",
                          source);
            assertionsource = resolver.resolveURI(source);
            assertNotNull("Test lookup of assertion source",
                          assertionsource);

            DOMBuilder builder = new DOMBuilder();
            assertNotNull("Test if inputstream of the assertion source is not null",
                          assertionsource.getInputStream());

            parser.parse(new InputSource(assertionsource.getInputStream()),
                         new WhitespaceFilter(builder),
                         builder);

            assertiondocument = builder.getDocument();
            assertNotNull("Test if assertion document exists", assertiondocument);
View Full Code Here


        if (descriptor == null) {
            throw new ConfigurationException("The form descriptor is not set!");
        }

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

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

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

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

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

                        BundleFactory.ConfigurationKeys.ROOT_DIRECTORY,
                        "location"
                );

        debug("catalog location:" + location);
        Source source = null;
        try {
            source = sourceResolver.resolveURI(location);
            String systemId = source.getURI();
            debug("catalog directory:" + systemId);
            dirConf.setValue(systemId);
            configuration.addChild(dirConf);
        } finally {
            if (source != null)
View Full Code Here

         */
        public synchronized Document getDocument(ComponentManager manager,
                                                 SourceResolver resolver,
                                                 Logger logger) throws Exception {

            Source src = null;
            SourceValidity valid = null;
            Document dom = null;

            if (this.document == null) {
                if (logger.isDebugEnabled())
                    logger.debug("document not cached... reloading uri "+this.uri);
                src = resolver.resolveURI(this.uri);
                this.srcVal = src.getValidity();
                this.document = SourceUtil.toDOM(src);
                dom = this.document;
                resolver.release(src);
            } else {
                if (this.reloadable) {
                    if (logger.isDebugEnabled())
                        logger.debug("document cached... checking validity of uri "+this.uri);
                    src = resolver.resolveURI(this.uri);
                    valid = src.getValidity();
                    if (srcVal != null && this.srcVal.isValid(valid) != 1) {
                        if (logger.isDebugEnabled())
                            logger.debug("reloading document... uri "+this.uri);
                        this.srcVal = valid;
                        this.document = SourceUtil.toDOM(src);
View Full Code Here

                                  String markupLanguageName,
                                  String programmingLanguageName,
                                  SourceResolver resolver)
        throws Exception {

        final Source source = resolver.resolveURI(fileName);
        return load(newManager, source, markupLanguageName, programmingLanguageName, resolver);
    }
View Full Code Here

        final String  logfilename = parameters.getParameter("logfile", null);

        // Check for null, use System.out if logfile is not specified.
        this.logfile = null;
        if ( null != logfilename ) {
            Source source = null;
            try {
                source = resolver.resolveURI( logfilename );
                final String systemId = source.getURI();
                if ( systemId.startsWith("file:") ) {
                    this.logfile = new FileWriter(systemId.substring(5), append );
                } else {
                    throw new ProcessingException("The logfile parameter must point to a file: " + logfilename);
                }
View Full Code Here

            for (int i = 0, size = execList.size(); i < size; i++) {
                String sourceURI = (String)execList.get(i);
                ScriptSourceEntry entry =
                    (ScriptSourceEntry)compiledScripts.get(sourceURI);
                if (entry == null) {
                    Source src = environment.resolveURI(sourceURI);
                    entry = new ScriptSourceEntry(src);
                    compiledScripts.put(sourceURI, entry);
                }
                // Compile the script if necessary
                entry.getScript(context, this.scope, needsRefresh);
View Full Code Here

     */

    public Script compileScript(Context cx,
                                Environment environment,
                                String fileName) throws Exception {
        Source src = environment.resolveURI(fileName);
        if (src == null) {
            throw new ResourceNotFoundException(fileName + ": not found");
        }
        synchronized (compiledScripts) {
            ScriptSourceEntry entry =
                (ScriptSourceEntry)compiledScripts.get(src.getURI());
            Script compiledScript = null;
            if (entry == null) {
                compiledScripts.put(src.getURI(),
                                    entry = new ScriptSourceEntry(src));
            }
            compiledScript = entry.getScript(cx, this.scope, false);
            return compiledScript;
        }
View Full Code Here

                this.loadList.remove(0);
                synchronized (object[3]) {
                    ((List)object[3]).remove(uri);
                }
               
                Source source = null;
                XMLSerializer serializer = null;

                try {
                    if (logger.isDebugEnabled()) {
                        logger.debug("PreemptiveLoader: Loading " + uri);
View Full Code Here

                                DocumentFragment frag,
                                SourceResolver resolver,
                                String serializerName)
    throws ProcessingException {

        Source source = null;

        try {
            source = SourceUtil.getSource(location, typeParameters,
                                          parameters, resolver);
            if (source instanceof ModifiableSource) {
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.