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

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


                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

    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

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

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

                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

        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

    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

   
    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

        SourceProperty[] properties = source.getSourceProperties();
        if (properties != null && properties.length > 0) {
            this.contentHandler.startElement(URI, PROPERTIES_NODE_NAME,
                                             PROPERTIES_NODE_QNAME, XMLUtils.EMPTY_ATTRIBUTES);
            for (int i = 0; i < properties.length; i++) {
                SourceProperty property = properties[i];
                property.toSAX(this.contentHandler);
            }
            this.contentHandler.endElement(URI, PROPERTIES_NODE_NAME,
                                           PROPERTIES_NODE_QNAME);
        }
    }
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.