Package org.apache.lenya.cms.metadata

Examples of org.apache.lenya.cms.metadata.MetaData


    private Map namespace2metadata = new HashMap();

    public MetaData getMetaData(String namespaceUri) throws MetaDataException {

        MetaData meta = (MetaData) this.namespace2metadata.get(namespaceUri);
        if (meta == null) {
           
            MetaDataRegistry registry = null;
            try {
                registry = (MetaDataRegistry) this.manager.lookup(MetaDataRegistry.ROLE);
View Full Code Here


            document.setResourceType(documentType);
            document.setSourceExtension(extension);
            document.setMimeType(mimeType);

            // Write Lenya-internal meta-data
            MetaData lenyaMetaData = document.getMetaData(DocumentImpl.METADATA_NAMESPACE);
            lenyaMetaData.setValue(DocumentImpl.METADATA_CONTENT_TYPE, "xml");

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Create");
                getLogger().debug("    document:     [" + document + "]");
            }
View Full Code Here

     */
    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
            throws ConfigurationException {
        Object value;

        MetaData metaData = getCustomMetaData(objectModel);

        if (!metaData.isValidAttribute(name)) {
            throw new ConfigurationException("The attribute [" + name + "] is not supported!");
        }

        try {
            value = metaData.getFirstValue(name);
        } catch (MetaDataException e) {
            throw new ConfigurationException("Obtaining custom meta data value for [" + name
                    + "] failed: ", e);
        }

View Full Code Here

     *      org.apache.avalon.framework.configuration.Configuration, java.util.Map)
     */
    public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
            throws ConfigurationException {
        Object[] values;
        MetaData metaData = getCustomMetaData(objectModel);

        if (!metaData.isValidAttribute(name)) {
            throw new ConfigurationException("The attribute [" + name + "] is not supported!");
        }

        try {
            values = metaData.getValues(name);
        } catch (MetaDataException e) {
            throw new ConfigurationException("Obtaining custom meta data value for [" + name
                    + "] failed: ", e);
        }

View Full Code Here

        // FIXME: There seems to be no reason to pass the attribute name to get the page envelope.
        Document document = getEnvelope(objectModel, "").getDocument();
        if (document == null) {
            throw new ConfigurationException("There is no document for this page envelope!");
        }
        MetaData metaData = null;
        try {
            metaData = document.getMetaData(this.namespaceUri);
        } catch (MetaDataException e) {
            throw new ConfigurationException("Obtaining custom meta data value for ["
                    + document + "] failed: ", e);
View Full Code Here

            List keyList = new ArrayList();

            String[] namespaces = registry.getNamespaceUris();

            for (int nsIndex = 0; nsIndex < namespaces.length; nsIndex++) {
                MetaData meta = doc.getMetaData(namespaces[nsIndex]);
                String[] keys = meta.getPossibleKeys();
                for (int keyIndex = 0; keyIndex < keys.length; keyIndex++) {
                    String key = "ns" + nsIndex + "." + keys[keyIndex];
                    String[] values = meta.getValues(keys[keyIndex]);
                    Element element = meta.getElementSet().getElement(keys[keyIndex]);
                    setParameter(key, new MetaDataWrapper(element, values, canChange));
                    keyList.add(key);
                }
                numbers.add("" + nsIndex);
                num2namespace.put("" + nsIndex, namespaces[nsIndex]);
View Full Code Here

    protected void setMetaData(Document document) throws MetaDataException {

        if (document == null)
            throw new IllegalArgumentException("parameter document may not be null");

        MetaData dcMetaData = document.getMetaData(DublinCore.DC_NAMESPACE);
        String[] dcKeys = dcMetaData.getAvailableKeys();

        for (int i = 0; i < dcKeys.length; i++) {
            String param = getDublinCoreParameter(dcKeys[i]);
            if (param != null) {
                dcMetaData.setValue(dcKeys[i], param);
            }
        }

    }
View Full Code Here

        String value = getParameterAsString(PARAM_VALUE);
        Assert.notNull("value", value);
        String oldValue = getParameterAsString(PARAM_OLD_VALUE);
        Assert.notNull("old value", oldValue);
       
        MetaData meta = getSourceDocument().getMetaData(namespace);
       
        String currentValue = meta.getFirstValue(element);
        if (currentValue == null) {
            currentValue = "";
        }
       
        if (!oldValue.equals(currentValue)) {
View Full Code Here

        String value = getParameterAsString(PARAM_VALUE);
        Assert.notNull("value", value);
        String oldValue = getParameterAsString(PARAM_OLD_VALUE);
        Assert.notNull("old value", oldValue);
       
        MetaData meta = getSourceDocument().getMetaData(namespace);
        meta.setValue(element, value);
    }
View Full Code Here

                List returnValues = new ArrayList();
                try {
                    Area areaObj = pub.getArea(this.area);
                    if (areaObj.contains(uuid, lang)) {
                        Document document = areaObj.getDocument(uuid, lang);
                        MetaData metaData = document.getMetaData(ns);
                        returnValues.addAll(Arrays.asList(metaData.getValues(key)));
                    } else if (defaultValue != null) {
                        returnValues.add(defaultValue);
                    } else {
                        String doc = this.publicationId + ":" + this.area + ":" + uuid + ":" + lang;
                        throw new SAXException("The document [" + doc
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.metadata.MetaData

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.