Examples of SourceProperty


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

        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

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

    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

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

    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

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

        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

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

        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

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

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

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

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

                xml = pre+property.getValue().toString()+post;
                StringReader reader = new StringReader(xml);

                Document doc = parser.parseDocument(new InputSource(reader));

                SourceProperty srcProperty = new SourceProperty(doc.getDocumentElement());

                sourceproperties.addElement(srcProperty);
            }
        } catch (Exception e) {
            throw new SourceException("Could not parse property "+xml, e);
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

            if (doc != null) {
                XPathProcessor processor = null;
                try {
                    processor = (XPathProcessor)manager.lookup(XPathProcessor.ROLE);
                    NodeList nodelist = processor.selectNodeList(doc.getDocumentElement(), m_xpath);
                    SourceProperty property = new SourceProperty(m_namespace, m_propertyname);
                    property.setValue(nodelist);
                    return property;
                } catch (ServiceException se) {
                    this.getLogger().error("Could not retrieve component", se);
                } finally {
                    if (processor != null) {
View Full Code Here

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

        }
        return null;
    }

    public SourceProperty[] getSourceProperties(Source source) throws SourceException {
        SourceProperty property = getSourceProperty(source, this.m_namespace, this.m_propertyname);
        if (property!=null)
            return new SourceProperty[]{property};
        return null;
    }
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.