Package org.apache.cocoon.components.source

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


        final Configuration[] configurations = configuration.getChildren("sourceinspector");
        for(int i=0; i<configurations.length; i++) {
            String className = configurations[i].getAttribute( "class", "" );

            SourceInspector inspector = null;

            try {
                final Class inspectorClass = classloader.loadClass(className);
                inspector = (SourceInspector)inspectorClass.newInstance();
            } catch (InstantiationException ie) {
View Full Code Here


     *
     * @throws Exception if an error occurs
     */
    public void initialize() throws Exception {

        SourceInspector inspector;
        for(int i=0; i<this.inspectors.size(); i++) {
            inspector = (SourceInspector)this.inspectors.get(i);

            if (inspector instanceof LogEnabled)
                ((LogEnabled)inspector).enableLogging(getLogger());
View Full Code Here

     * This method will be called after Startable.stop() method (if implemented
     * by component). Components use this method to release and destroy any
     * resources that the Component owns.
     */
    public void dispose() {
        SourceInspector inspector;
        for(int i=0; i<this.inspectors.size(); i++) {
            inspector = (SourceInspector)this.inspectors.get(i);
           
            if (inspector instanceof Disposable)
                ((Disposable)inspector).dispose();
View Full Code Here

    }

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

        SourceInspector inspector;
        SourceProperty property;
        for(int i=0; i<this.inspectors.size(); i++) {
            inspector = (SourceInspector)this.inspectors.get(i);
     
            property = inspector.getSourceProperty(source, namespace, name);
            if (property!=null)
                return property;
        }
        return null;
    }
View Full Code Here

    }

    public SourceProperty[] getSourceProperties(Source source) throws SourceException {
        ArrayList list = new ArrayList();

        SourceInspector inspector;
        SourceProperty[] properties;
        SourceProperty property;
        boolean propertyExists;
        for(int i=0; i<this.inspectors.size(); i++) {
            inspector = (SourceInspector)this.inspectors.get(i);

            try {
                properties = inspector.getSourceProperties(source);

                if (properties!=null)
                    for(int j=0; j<properties.length; j++) {
                        propertyExists = false;
                        for(int k=0; k<list.size() && !propertyExists; k++) {
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

        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

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.