Examples of SourceProperty


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

            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

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

            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

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

        while (properties.hasNext()) {
            String property = (String) properties.next();
            int index = property.indexOf('#');
            String namespace = property.substring(0,index);
            String name      = property.substring(index+1);
            SourceProperty sp = doGetSourceProperty(source,namespace,name);
            if (sp != null) {
                result.add(sp);
            }
        }
        return (SourceProperty[]) result.toArray(new SourceProperty[result.size()]);
View Full Code Here

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

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

        if (handlesProperty(namespace,name) && isImageMimeType(source) && isImageFileType(source)) {
            if (name.equals(IMAGE_WIDTH_PROPERTY_NAME))
                return new SourceProperty(PROPERTY_NS, IMAGE_WIDTH_PROPERTY_NAME,
                                          String.valueOf(getImageSize(source)[0]));
            if (name.equals(IMAGE_HEIGHT_PROPERTY_NAME))
                return new SourceProperty(PROPERTY_NS, IMAGE_HEIGHT_PROPERTY_NAME,
                                          String.valueOf(getImageSize(source)[1]));
        }
        return null;
    }
View Full Code Here

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

   
    public final SourceProperty[] getSourceProperties(Source source) throws SourceException {
        if (isImageMimeType(source) && isImageFileType(source)) {
            int[] size = getImageSize(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

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

    private void pushSourceProperties(InspectableSource source)
        throws SAXException, SourceException {
       
        SourceProperty[] properties = source.getSourceProperties();
        if (properties != null && properties.length > 0) {
            SourceProperty property;
            AttributesImpl attributes = new AttributesImpl();
            this.contentHandler.startElement(URI, PROPERTIES_NODE_NAME,
                                             PROPERTIES_NODE_QNAME, attributes);
            for (int i = 0; i < properties.length; i++) {
                property = properties[i];
                property.toSAX(this.contentHandler);
            }
            this.contentHandler.endElement(URI, PROPERTIES_NODE_NAME,
                                           PROPERTIES_NODE_QNAME);
        }
    }
View Full Code Here

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

            throw new SourceException("Could not parse property", e);
        } finally {
            this.m_manager.release(parser);
        }

        return new SourceProperty(doc.getDocumentElement());
    }
View Full Code Here

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

                String post = "</"+name+" >";
                xml = pre+property.getValue().toString()+post;
               
                StringReader reader = new StringReader(xml);
                Document doc = parser.parseDocument(new InputSource(reader));
                properties.add(new SourceProperty(doc.getDocumentElement()));
            }
        } catch (Exception e) {
            throw new SourceException("Could not parse property "+xml, e);
        } finally {
            m_manager.release(parser);
View Full Code Here

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

     * @param source Source.
     */
    private void pushLiveSourceProperties(InspectableSource source)
      throws SAXException, SourceException {
        SourceProperty[] properties = source.getSourceProperties();
        SourceProperty property;

        AttributesImpl attributes = new AttributesImpl();

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

        IncludeXMLConsumer consumer = new IncludeXMLConsumer(this.contentHandler);

        for (int i = 0; i<properties.length; i++) {
            property = properties[i];

            this.contentHandler.startPrefixMapping("",
                                                   property.getNamespace());
            property.toSAX(consumer);
            this.contentHandler.endPrefixMapping("");
        }

        this.contentHandler.endElement(SOURCE_NS, PROPERTIES_NODE_NAME,
                                       PROPERTIES_NODE_QNAME);
View Full Code Here

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
TOP
Copyright © 2018 www.massapi.com. 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.