Package org.apache.cocoon.components.source.helpers

Examples of org.apache.cocoon.components.source.helpers.SourceProperty


            stmt = connection.prepareStatement(STMT_SELECT_ALL);
            stmt.setString(1,source.getURI());
            ResultSet result = stmt.executeQuery();
            List properties = new ArrayList();
            while (result.next()) {
                SourceProperty property = new SourceProperty(
                    result.getString(1),result.getString(2),result.getString(3));
                if (handlesProperty(property.getNamespace(),property.getName())) {
                    properties.add(property);
                }
            }
            result.close();
            stmt.close();
View Full Code Here


            stmt = connection.prepareStatement(STMT_SELECT_SINGLE);
            stmt.setString(1,source.getURI());
            stmt.setString(2,namespace);
            stmt.setString(3,name);
            ResultSet result = stmt.executeQuery();
            SourceProperty property = null;
            if (result.next()) {
                property = new SourceProperty(
                    namespace,
                    name,
                    result.getString(1));
            }
            result.close();
View Full Code Here

                try {
                    processor = (XPathProcessor)manager.lookup(XPathProcessor.ROLE);

                    NodeList nodelist = processor.selectNodeList(doc.getDocumentElement(), this.xpath);

                    SourceProperty property = new SourceProperty(this.propertynamespace, this.propertyname);
                    property.setValue(nodelist);

                    return property;
                } catch (ComponentException ce) {
                    this.getLogger().error("Could not retrieve component", ce);
                } finally {
View Full Code Here

        return null
    }

    public SourceProperty[] getSourceProperties(Source source) throws SourceException {

        SourceProperty property = getSourceProperty(source, this.propertynamespace, this.propertyname);
        if (property!=null)
            return new SourceProperty[]{property};
        return null;
    }
View Full Code Here

        if ((namespace.equals(PROPERTY_NS)) &&
            ((name.equals(IMAGE_WIDTH_PROPERTY_NAME)) || (name.equals(IMAGE_HEIGHT_PROPERTY_NAME))) &&
            (source.getURI().endsWith(".jpg")) && (isJPEGFile(source))) {

            if (name.equals(IMAGE_WIDTH_PROPERTY_NAME))
                return new SourceProperty(PROPERTY_NS, IMAGE_WIDTH_PROPERTY_NAME,
                                          String.valueOf(getJpegSize(source)[0]));
            if (name.equals(IMAGE_HEIGHT_PROPERTY_NAME))
                return new SourceProperty(PROPERTY_NS, IMAGE_HEIGHT_PROPERTY_NAME,
                                          String.valueOf(getJpegSize(source)[1]));
        }
        return null
    }
View Full Code Here

        if ((source.getURI().endsWith(".jpg")) &&
            (isJPEGFile(source))) {
            int[] size = getJpegSize(source);
            return new SourceProperty[] {
                new SourceProperty(PROPERTY_NS, IMAGE_WIDTH_PROPERTY_NAME, String.valueOf(size[0])),
                new SourceProperty(PROPERTY_NS, IMAGE_HEIGHT_PROPERTY_NAME, String.valueOf(size[1]))
            };
        }
        return null;
    }
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)
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++) {
                            property = (SourceProperty)list.get(k);
                            if ((property.getNamespace().equals(properties[j].getNamespace())) &&
                                (property.getName().equals(properties[j].getName())))
                                propertyExists = true;
                    }
                    if (!propertyExists)
                        list.add(properties[j]);
                }
View Full Code Here

        if ((namespace.equals(PROPERTY_NS)) &&
            ((name.equals(IMAGE_WIDTH_PROPERTY_NAME)) || (name.equals(IMAGE_HEIGHT_PROPERTY_NAME))) &&
            (source.getURI().endsWith(".gif")) && (isGIFFile(source))) {

            if (name.equals(IMAGE_WIDTH_PROPERTY_NAME))
                return new SourceProperty(PROPERTY_NS, IMAGE_WIDTH_PROPERTY_NAME,
                                          String.valueOf(getGifSize(source)[0]));
            if (name.equals(IMAGE_HEIGHT_PROPERTY_NAME))
                return new SourceProperty(PROPERTY_NS, IMAGE_HEIGHT_PROPERTY_NAME,
                                          String.valueOf(getGifSize(source)[1]));
        }
        return null
    }
View Full Code Here

        if ((source.getURI().endsWith(".gif")) &&
            (isGIFFile(source))) {

            int[] size = getGifSize(source);
            return new SourceProperty[] {
                new SourceProperty(PROPERTY_NS, IMAGE_WIDTH_PROPERTY_NAME, String.valueOf(size[0])),
                new SourceProperty(PROPERTY_NS, IMAGE_HEIGHT_PROPERTY_NAME, String.valueOf(size[1]))
            };
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.source.helpers.SourceProperty

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.