Package org.apache.cocoon.components.source

Examples of org.apache.cocoon.components.source.SourceInspector


        final ClassLoader classloader = Thread.currentThread().getContextClassLoader();
        final Configuration[] children = m_configuration.getChildren();
       
        for (int i = 0; i < children.length; i++) {
            String className = children[i].getAttribute("class","");
            SourceInspector inspector;
            try {
                final Class inspectorClass = classloader.loadClass(className);
                inspector = (SourceInspector) inspectorClass.newInstance();
            } catch (InstantiationException ie) {
                throw new ConfigurationException(
View Full Code Here


    public SourceProperty getSourceProperty(Source source, String namespace, String name)
            throws SourceException {

        final Iterator inspectors = m_inspectors.iterator();
        while (inspectors.hasNext()) {
            SourceInspector inspector = (SourceInspector) inspectors.next();
            SourceProperty property = inspector.getSourceProperty(source,namespace,name);
            if (property != null) {
                return property;
            }
        }
        return null;
View Full Code Here

    /**
     * Aggregate all properties of all registered inspectors.
     */
    public SourceProperty[] getSourceProperties(Source source) throws SourceException {
        final Set result = new HashSet();
        SourceInspector inspector;
        SourceProperty[] properties;
        final Iterator inspectors = m_inspectors.iterator();
        while (inspectors.hasNext()) {
            inspector = (SourceInspector) inspectors.next();
            properties = inspector.getSourceProperties(source);
            if (properties != null) {
                result.addAll(Arrays.asList(properties));
            }
        }
        return (SourceProperty[]) result.toArray(new SourceProperty[result.size()]);
View Full Code Here

    /**
     * Check if there is an inspector that handles properties of
     * the given type.
     */
    public boolean handlesProperty(String namespace, String name) {
        SourceInspector inspector;
        final Iterator inspectors = m_inspectors.iterator();
        while(inspectors.hasNext()) {
            inspector = (SourceInspector) inspectors.next();
            if (inspector.handlesProperty(namespace,name)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

   
    /**
     * Loops over the registered descriptors and delegates the call.
     */
    public void removeSourceProperty(Source source, String ns, String name) throws SourceException {
        SourceInspector inspector;
        final Iterator inspectors = m_inspectors.iterator();
        while (inspectors.hasNext()) {
            inspector = (SourceInspector) inspectors.next();
            if (inspector instanceof SourceDescriptor) {
                ((SourceDescriptor) inspector).removeSourceProperty(source,ns,name);
View Full Code Here

   
    /**
     * Loops over the registered descriptors and calls delegates the call.
     */
    public void setSourceProperty(Source source, SourceProperty property) throws SourceException {
        SourceInspector inspector;
        final Iterator inspectors = m_inspectors.iterator();
        while (inspectors.hasNext()) {
            inspector = (SourceInspector) inspectors.next();
            if (inspector instanceof SourceDescriptor) {
                ((SourceDescriptor) inspector).setSourceProperty(source,property);
View Full Code Here

    /**
     * Returns an aggregate validity describing the validity of all the properties.
     */
    public SourceValidity getValidity(Source source) {
        AggregatedValidity validity = new AggregatedValidity();
        SourceInspector inspector;
        final Iterator inspectors = m_inspectors.iterator();
        while (inspectors.hasNext()) {
            inspector = (SourceInspector) inspectors.next();
            SourceValidity sv = inspector.getValidity(source);
            if (sv == null) {
                return null;
            }
            validity.add(sv);
        }
View Full Code Here

        attributes.addAttribute("", PROPERTY_TYPE_ATTR_NAME,
                                PROPERTY_TYPE_ATTR_NAME, "CDATA", "computed");
        this.contentHandler.startElement(SOURCE_NS, PROPERTIES_NODE_NAME,
                                         PROPERTIES_NODE_QNAME, attributes);

        SourceInspector inspector = null;

        try {
            inspector = (SourceInspector) this.manager.lookup(SourceInspector.ROLE);

            SourceProperty[] properties = inspector.getSourceProperties(source);
            IncludeXMLConsumer consumer = new IncludeXMLConsumer(this.contentHandler);

            for (int i = 0; i<properties.length; i++) {
                this.contentHandler.startPrefixMapping("", properties[i].getNamespace());
                properties[i].toSAX(consumer);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.source.SourceInspector

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.