Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.Source


            // New syntax: Element user-config contains URL
            configUrl = conf.getChild("user-config").getValue(null);
        }
       
        if (configUrl != null) {
            Source configSource = null;
            SourceResolver resolver = null;
            try {
                resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
                configSource = resolver.resolveURI(configUrl);
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Loading configuration from " + configSource.getURI());
                }
                SourceUtil.toSAX(configSource, new ConfigurationParser());
            } catch (Exception e) {
                getLogger().warn("Cannot load configuration from " + configUrl);
                throw new ConfigurationException("Cannot load configuration from " + configUrl, e);
View Full Code Here


            try {
                if (this.getLogger().isDebugEnabled()) {
                    this.getLogger().debug("start invoking auth resource");
                }
                Source source = null;
                try {
                    source = org.apache.cocoon.components.source.SourceUtil.getSource(authenticationResourceName,
                                                                                      null,
                                                                                      parameters,
                                                                                      this.resolver);
View Full Code Here

                                                   appHandler.getHandler().getName(),
                                                   path,
                                                   appHandler.getName());
                DocumentFragment fragment;

                Source source = null;
                try {
                    source = org.apache.cocoon.components.source.SourceUtil.getSource(loadResourceName,
                                                                                      null,
                                                                                      parameters,
                                                                                      this.resolver);
View Full Code Here

                // referenced by "src" attribute of "validate" element

                Configuration conf = null;
                Session session = null;
                try {
                    Source resource = this.resolver.resolveURI(source);
                    SAXConfigurationHandler saxBuilder = new SAXConfigurationHandler();
                    resolver.toSAX(resource, saxBuilder);

                    conf = saxBuilder.getConfiguration();
                    session = this.getSessionManager().getSession(true);
View Full Code Here

     * Invoke resource
     */
    private void invokeResource(String resource,
                                 SourceParameters parameters)
    throws IOException, ProcessingException, SAXException {
        Source source = null;
        try {
            source = SourceUtil.getSource(resource,
                                          null,
                                          parameters,
                                          this.resolver);
View Full Code Here

     * Load XML resource
     */
    private Document loadResource(String resource,
                                   SourceParameters parameters)
    throws IOException, ProcessingException, SAXException {
        Source source = null;
        try {
            source = SourceUtil.getSource(resource,
                                          null,
                                          parameters,
                                          this.resolver);
View Full Code Here

                sourceCache = (Map) this.resolverContext.get(CONTEXT_SOURCE_CACHE_KEY);
            } catch (ContextException ignore) {
                throw new org.apache.velocity.exception.ResourceNotFoundException("Runtime Cocoon source cache not specified in resource loader resolver context.");
            }

            Source source = (Source) sourceCache.get(systemId);
            if (source == null) {
                try {
                    SourceResolver resolver = (SourceResolver) this.resolverContext.get(CONTEXT_RESOLVER_KEY);
                    source = resolver.resolveURI(systemId);
                } catch (ContextException ex) {
View Full Code Here

            // so we create one without Avalon...
            org.apache.cocoon.serialization.LinkSerializer ls =
                new org.apache.cocoon.serialization.LinkSerializer();
            ls.setOutputStream(this.outputStream);

            Source redirectSource = null;
            try {
                redirectSource = this.resolveURI(newURL);
                this.toSAX(redirectSource, ls);
            } catch (SourceException se) {
                throw new CascadingIOException("SourceException: " + se, se);
            } catch (SAXException se) {
                throw new CascadingIOException("SAXException: " + se, se);
            } catch (ProcessingException pe) {
                throw new CascadingIOException("ProcessingException: " + pe, pe);
            } finally {
                this.release( redirectSource );
            }
        } else {
            Source redirectSource = null;
            try {
                redirectSource = this.resolveURI(newURL);
                InputStream is = redirectSource.getInputStream();
                byte[] buffer = new byte[8192];
                int length = -1;

                while ((length = is.read(buffer)) > -1) {
                    this.outputStream.write(buffer, 0, length);
View Full Code Here

            StringBuffer buffer = new StringBuffer();
            buffer.append("CA(")
                  .append(this.rootElement.prefix).append(':')
                  .append(this.rootElement.name).append('<')
                  .append(this.rootElement.namespace).append(">)");
            Source current;
            for (int i = 0; i < this.parts.size(); i++) {
                final Part part = (Part)this.parts.get(i);
                current = part.source;
                if (part.element == null) {
                    buffer.append("P=")
                          .append(part.stripRootElement).append(':')
                          .append(current.getURI()).append(';');
                } else {
                    buffer.append("P=")
                          .append(part.element.prefix).append(':')
                          .append(part.element.name)
                          .append('<').append(part.element.namespace).append(">:")
                          .append(part.stripRootElement).append(':')
                          .append(current.getURI()).append(';');
                }
            }
            return buffer.toString();
        } catch (Exception e) {
            getLogger().error("ContentAggregator: could not generateKey", e);
View Full Code Here

     *         component is currently not cacheable.
     */
    public SourceValidity getValidity() {
        try {
            AggregatedValidity v = new AggregatedValidity();
            Source current;
            for (int i = 0; i < this.parts.size(); i++) {
                current = ((Part)this.parts.get(i)).source;
                SourceValidity sv = current.getValidity();
                if (sv == null) {
                    return null;
                } else {
                    v.add(sv);
                }
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.