You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/07/20 16:23:29 UTC
svn commit: r423945 - in /lenya/trunk/src:
impl/java/org/apache/lenya/cms/publication/
java/org/apache/lenya/cms/metadata/ java/org/apache/lenya/cms/publication/
java/org/apache/lenya/cms/workflow/
modules-core/sitemanagement/java/src/org/apache/lenya/...
Author: andreas
Date: Thu Jul 20 07:23:28 2006
New Revision: 423945
URL: http://svn.apache.org/viewvc?rev=423945&view=rev
Log:
Moving toward configurable meta data
Added:
lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java (contents, props changed)
- copied, changed from r423813, lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java
Removed:
lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java
Modified:
lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
lenya/trunk/src/java/org/apache/lenya/cms/metadata/LenyaMetaData.java
lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java
lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java
lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/LenyaRepository.java
lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/metadata/JCRMetaDataManager.java
lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/migration/Migrate14.java
lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/LenyaElements.java
lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoLenyaMetaData.java
lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
Copied: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java (from r423813, lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java)
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java?p2=lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java&p1=lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java&r1=423813&r2=423945&rev=423945&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java Thu Jul 20 07:23:28 2006
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
@@ -35,13 +34,11 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
-
import org.apache.cocoon.servlet.multipart.Part;
import org.apache.excalibur.source.ModifiableSource;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceResolver;
import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.metadata.LenyaMetaData;
import org.apache.lenya.cms.metadata.MetaData;
import org.apache.lenya.cms.repository.Node;
@@ -112,6 +109,11 @@
public void addResource(Document document, Part part, Map metadata) throws Exception {
addResource(document,part,metadata,null);
}
+
+ protected static final String METADATA_IMAGE_WIDTH = "width";
+ protected static final String METADATA_IMAGE_HEIGHT = "height";
+ protected static final String METADATA_MEDIA_NAMESPACE = "http://apache.org/lenya/metadata/media/1.0";
+
/**
* @see org.apache.lenya.cms.publication.ResourcesManager#addResource(org.apache.lenya.cms.publication.Document,
* org.apache.cocoon.servlet.multipart.Part, java.util.Map)
@@ -141,29 +143,23 @@
/*
* complement and create the meta description for the resource.
*/
- metadata.put("format", mimeType);
- metadata.put("extent", Integer.toString(fileSize));
- if(customMeta!=null){
- customMeta.addValue("media-filename", fileName);
- customMeta.addValue("media-format", mimeType);
- customMeta.addValue("media-extent", Integer.toString(fileSize));
- }
- Map lenyaMetaData = new HashMap(1);
- lenyaMetaData.put(LenyaMetaData.ELEMENT_CONTENT_TYPE, "asset");
+
+ MetaData mediaMetaData = resource.getMetaData(METADATA_MEDIA_NAMESPACE);
+
+ mediaMetaData.setValue("filename", fileName);
+ mediaMetaData.setValue("format", mimeType);
+ mediaMetaData.setValue("extent", Integer.toString(fileSize));
+
+ MetaData lenyaMetaData = resource.getMetaData(DocumentImpl.METADATA_NAMESPACE);
+ lenyaMetaData.setValue(DocumentImpl.METADATA_CONTENT_TYPE, "asset");
if (canReadMimeType(mimeType)) {
BufferedImage input = ImageIO.read(part.getInputStream());
String width = Integer.toString(input.getWidth());
String height = Integer.toString(input.getHeight());
- lenyaMetaData.put(LenyaMetaData.ELEMENT_WIDTH, width);
- lenyaMetaData.put(LenyaMetaData.ELEMENTE_HEIGHT, height);
- if(customMeta!=null){
- customMeta.addValue("media-"+LenyaMetaData.ELEMENTE_HEIGHT, height);
- customMeta.addValue("media-"+LenyaMetaData.ELEMENT_WIDTH, width);
- }
+ mediaMetaData.setValue(METADATA_IMAGE_WIDTH, width);
+ mediaMetaData.setValue(METADATA_IMAGE_HEIGHT, height);
}
-
- resource.getMetaDataManager().setMetaData(metadata, lenyaMetaData, null);
saveResource(resource, part);
} catch (final DocumentException e) {
Propchange: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java Thu Jul 20 07:23:28 2006
@@ -30,7 +30,6 @@
import org.apache.excalibur.source.SourceResolver;
import org.apache.lenya.cms.cocoon.source.RepositorySource;
import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.metadata.LenyaMetaData;
import org.apache.lenya.cms.metadata.MetaData;
import org.apache.lenya.cms.metadata.MetaDataManager;
import org.apache.lenya.cms.publication.util.DocumentVisitor;
@@ -50,6 +49,39 @@
private MetaDataManager metaDataManager;
/**
+ * The meta data namespace.
+ */
+ public static final String METADATA_NAMESPACE = "http://apache.org/lenya/metadata/document/1.0";
+
+ /**
+ * The name of the resource type attribute. An XML resource has a resource type; this
+ * information can be used e.g. for different rendering of different types.
+ */
+ public static final String METADATA_RESOURCE_TYPE = "resourceType";
+
+ /**
+ * The name of the content type attribute. Any content managed by Lenya has a type; this
+ * information can be used e.g. to provide an appropriate management interface.
+ */
+ public static final String METADATA_CONTENT_TYPE = "contentType";
+
+ /**
+ * The number of seconds from the request that a document can be cached before it expires
+ */
+ public static final String METADATA_EXPIRES = "expires";
+
+ /**
+ * The extension to use for the document source.
+ */
+ public static final String METADATA_EXTENSION = "extension";
+
+ /**
+ * Determines if the document is just a placeholder in the trash and archive areas.
+ * @see org.apache.lenya.cms.site.usecases.MoveSubsite
+ */
+ public static final String METADATA_PLACEHOLDER = "placeholder";
+
+ /**
* Creates a new instance of DefaultDocument.
* @param manager The service manager.
* @param map The identity map the document belongs to.
@@ -88,7 +120,7 @@
public Date getExpires() throws DocumentException {
Date expires = null;
long secs = 0;
-
+
MetaData metaData = null;
String expiresMeta = null;
try {
@@ -113,7 +145,7 @@
return expires;
}
-
+
/**
* @see org.apache.lenya.cms.publication.Document#getId()
*/
@@ -279,9 +311,8 @@
public String getSourceExtension() {
String sourceExtension;
try {
- sourceExtension = getMetaDataManager().getLenyaMetaData()
- .getFirstValue(LenyaMetaData.ELEMENT_EXTENSION);
- } catch (DocumentException e) {
+ sourceExtension = getMetaData(METADATA_NAMESPACE).getFirstValue(METADATA_EXTENSION);
+ } catch (Exception e) {
throw new RuntimeException(e);
}
if (sourceExtension == null) {
@@ -517,13 +548,13 @@
*/
public ResourceType getResourceType() throws DocumentException {
if (this.resourceType == null) {
- String name = getMetaDataManager().getLenyaMetaData()
- .getFirstValue(LenyaMetaData.ELEMENT_RESOURCE_TYPE);
- if (name == null) {
- throw new DocumentException("No resource type defined for document [" + this + "]!");
- }
ServiceSelector selector = null;
try {
+ String name = getMetaData(METADATA_NAMESPACE).getFirstValue(METADATA_RESOURCE_TYPE);
+ if (name == null) {
+ throw new DocumentException("No resource type defined for document [" + this
+ + "]!");
+ }
selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
this.resourceType = (ResourceType) selector.select(name);
} catch (Exception e) {
@@ -539,6 +570,30 @@
public String[] getMetaDataNamespaceUris() throws RepositoryException {
return getRepositoryNode().getMetaDataNamespaceUris();
+ }
+
+ public boolean isPlaceholder() {
+ try {
+ MetaData meta = getMetaData(METADATA_NAMESPACE);
+ String value = meta.getFirstValue(METADATA_PLACEHOLDER);
+ if (value == null) {
+ return false;
+ }
+ else {
+ return Boolean.valueOf(value).booleanValue();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void setPlaceholder() {
+ try {
+ MetaData meta = getMetaData(METADATA_NAMESPACE);
+ meta.setValue(METADATA_PLACEHOLDER, "true");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
}
Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java Thu Jul 20 07:23:28 2006
@@ -29,7 +29,7 @@
import org.apache.avalon.framework.service.Serviceable;
import org.apache.excalibur.source.SourceResolver;
import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.metadata.LenyaMetaData;
+import org.apache.lenya.cms.metadata.MetaData;
import org.apache.lenya.cms.publication.util.DocumentSet;
import org.apache.lenya.cms.publication.util.DocumentVisitor;
import org.apache.lenya.cms.repository.Node;
@@ -112,11 +112,11 @@
node.lock();
// Write Lenya-internal meta-data
- Map lenyaMetaData = new HashMap();
- lenyaMetaData.put(LenyaMetaData.ELEMENT_RESOURCE_TYPE, documentType.getName());
- lenyaMetaData.put(LenyaMetaData.ELEMENT_CONTENT_TYPE, "xml");
- lenyaMetaData.put(LenyaMetaData.ELEMENT_EXTENSION, extension);
- document.getMetaDataManager().setLenyaMetaData(lenyaMetaData);
+ MetaData lenyaMetaData = document.getMetaData(DocumentImpl.METADATA_NAMESPACE);
+
+ lenyaMetaData.setValue(DocumentImpl.METADATA_RESOURCE_TYPE, documentType.getName());
+ lenyaMetaData.setValue(DocumentImpl.METADATA_CONTENT_TYPE, "xml");
+ lenyaMetaData.setValue(DocumentImpl.METADATA_EXTENSION, extension);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Create");
Modified: lenya/trunk/src/java/org/apache/lenya/cms/metadata/LenyaMetaData.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/metadata/LenyaMetaData.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/metadata/LenyaMetaData.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/metadata/LenyaMetaData.java Thu Jul 20 07:23:28 2006
@@ -39,41 +39,41 @@
* An XML resource has a resource type; this information can be
* used e.g. for different rendering of different types.
*/
- public static final String ELEMENT_RESOURCE_TYPE = "resourceType";
+ private static final String ELEMENT_RESOURCE_TYPE = "resourceType";
/**
* The name of the content type attribute.
* Any content managed by Lenya has a type; this information can
* be used e.g. to provide an appropriate management interface.
*/
- public static final String ELEMENT_CONTENT_TYPE = "contentType";
+ private static final String ELEMENT_CONTENT_TYPE = "contentType";
/**
* The number of seconds from the request that a document can be cached before it expires
*/
- public static final String ELEMENT_EXPIRES = "expires";
+ private static final String ELEMENT_EXPIRES = "expires";
/**
* The extension to use for the document source.
*/
- public static final String ELEMENT_EXTENSION = "extension";
+ private static final String ELEMENT_EXTENSION = "extension";
/**
* A workflow version.
* @see org.apache.lenya.cms.workflow.DocumentWorkflowable
*/
- public static final String ELEMENT_WORKFLOW_VERSION = "workflowVersion";
+ private static final String ELEMENT_WORKFLOW_VERSION = "workflowVersion";
/**
* Determines if the document is just a placeholder in the trash and archive areas.
* @see org.apache.lenya.cms.site.usecases.MoveSubsite
*/
- public static final String ELEMENT_PLACEHOLDER = "placeholder";
+ private static final String ELEMENT_PLACEHOLDER = "placeholder";
- public static final String ELEMENTE_HEIGHT = "height";
- public static final String ELEMENT_WIDTH = "width";
+ private static final String ELEMENTE_HEIGHT = "height";
+ private static final String ELEMENT_WIDTH = "width";
- public static final String[] ELEMENTS = {
+ private static final String[] ELEMENTS = {
ELEMENT_RESOURCE_TYPE,
ELEMENT_CONTENT_TYPE,
ELEMENT_WORKFLOW_VERSION,
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java Thu Jul 20 07:23:28 2006
@@ -54,6 +54,7 @@
/**
* Returns the date at which point the requested document is considered expired
* @return a string in RFC 1123 date format
+ * @throws DocumentException if an error occurs.
*/
Date getExpires() throws DocumentException;
@@ -208,4 +209,14 @@
* @return The source extension used by this document.
*/
String getSourceExtension();
+
+ /**
+ * @return if this is placeholder document (in trash / archive areas).
+ */
+ boolean isPlaceholder();
+
+ /**
+ * Set if this is placeholder document (in trash / archive areas).
+ */
+ void setPlaceholder();
}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java Thu Jul 20 07:23:28 2006
@@ -21,18 +21,16 @@
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import java.util.Locale;
+import java.util.Map;
import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.lenya.ac.Identity;
-import org.apache.lenya.cms.metadata.LenyaMetaData;
import org.apache.lenya.cms.metadata.MetaData;
import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
import org.apache.lenya.cms.publication.ResourceType;
import org.apache.lenya.cms.repository.Session;
import org.apache.lenya.workflow.Version;
@@ -104,15 +102,18 @@
private Version[] versions = null;
private long lastModified = 0;
+
+ protected static final String METADATA_NAMESPACE = "http://apache.org/lenya/metadata/workflow/1.0";
+ protected static final String METADATA_VERSION = "workflowVersion";
/**
* @see org.apache.lenya.workflow.Workflowable#getVersions()
*/
public Version[] getVersions() {
try {
- MetaData meta = this.document.getMetaDataManager().getLenyaMetaData();
+ MetaData meta = this.document.getMetaData(METADATA_NAMESPACE);
if (this.versions == null || meta.getLastModified() > this.lastModified) {
- String[] versionStrings = meta.getValues(LenyaMetaData.ELEMENT_WORKFLOW_VERSION);
+ String[] versionStrings = meta.getValues(METADATA_VERSION);
this.versions = new Version[versionStrings.length];
for (int i = 0; i < versionStrings.length; i++) {
String string = versionStrings[i];
@@ -125,7 +126,7 @@
}
this.lastModified = meta.getLastModified();
}
- } catch (DocumentException e) {
+ } catch (Exception e) {
throw new RuntimeException();
}
return this.versions;
@@ -158,9 +159,9 @@
String string = number + " " + encodeVersion(workflow, version);
try {
- MetaData meta = this.document.getMetaDataManager().getLenyaMetaData();
- meta.addValue(LenyaMetaData.ELEMENT_WORKFLOW_VERSION, string);
- } catch (DocumentException e) {
+ MetaData meta = this.document.getMetaData(METADATA_NAMESPACE);
+ meta.addValue(METADATA_VERSION, string);
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
Modified: lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java (original)
+++ lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java Thu Jul 20 07:23:28 2006
@@ -23,8 +23,6 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.metadata.LenyaMetaData;
-import org.apache.lenya.cms.metadata.MetaData;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentBuildException;
import org.apache.lenya.cms.publication.DocumentException;
@@ -181,8 +179,7 @@
Document targetDoc = map.getAreaVersion(existingSourceDoc, getTargetArea());
documentManager.copyDocument(existingSourceDoc, targetDoc);
if (!targetDoc.getArea().equals(Publication.AUTHORING_AREA)) {
- MetaData meta = targetDoc.getMetaDataManager().getLenyaMetaData();
- meta.setValue(LenyaMetaData.ELEMENT_PLACEHOLDER, "true");
+ targetDoc.setPlaceholder();
}
}
@@ -289,7 +286,7 @@
String[] languages = requiredDoc.getLanguages();
for (int l = 0; l < languages.length; l++) {
Document langVersion = map.getLanguageVersion(requiredDoc, languages[l]);
- if (!sources.contains(langVersion) && !isPlaceholder(langVersion)) {
+ if (!sources.contains(langVersion) && !langVersion.isPlaceholder()) {
delete = false;
}
}
@@ -302,7 +299,7 @@
languages = reqDoc.getLanguages();
for (int l = 0; l < languages.length; l++) {
Document langVersion = map.getLanguageVersion(reqDoc, languages[l]);
- if (!sources.contains(langVersion) && !isPlaceholder(langVersion)) {
+ if (!sources.contains(langVersion) && !langVersion.isPlaceholder()) {
delete = false;
}
}
@@ -333,18 +330,4 @@
return docsToDelete;
}
- /**
- * Checks if a document is a placeholder.
- * @param document
- * @return
- * @throws DocumentException
- */
- protected boolean isPlaceholder(Document document) throws DocumentException {
- MetaData meta = document.getMetaDataManager().getLenyaMetaData();
- String placeholder = meta.getFirstValue(LenyaMetaData.ELEMENT_PLACEHOLDER);
- if (placeholder == null || !placeholder.equals("true")) {
- return false;
- }
- return true;
- }
}
Modified: lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/LenyaRepository.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/LenyaRepository.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/LenyaRepository.java (original)
+++ lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/LenyaRepository.java Thu Jul 20 07:23:28 2006
@@ -133,12 +133,12 @@
List propDefs = new ArrayList();
Map key2namespace = new HashMap();
-
+/*
String[] lenyaKeys = LenyaMetaData.ELEMENTS;
for (int i = 0; i < lenyaKeys.length; i++) {
key2namespace.put(lenyaKeys[i], LenyaMetaData.NAMESPACE);
}
-
+*/
List dcKeyList = DublinCoreImpl.getAttributeNames();
String[] dcKeys = (String[]) dcKeyList.toArray(new String[dcKeyList.size()]);
for (int i = 0; i < dcKeys.length; i++) {
Modified: lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/metadata/JCRMetaDataManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/metadata/JCRMetaDataManager.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/metadata/JCRMetaDataManager.java (original)
+++ lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/metadata/JCRMetaDataManager.java Thu Jul 20 07:23:28 2006
@@ -73,7 +73,7 @@
getSourceURI(),
this.serviceManager,
getLogger());
- this.lenyaMetaData.setPossibleKeys(LenyaMetaData.ELEMENTS);
+// this.lenyaMetaData.setPossibleKeys(LenyaMetaData.ELEMENTS);
}
return this.lenyaMetaData;
}
Modified: lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/migration/Migrate14.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/migration/Migrate14.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/migration/Migrate14.java (original)
+++ lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/migration/Migrate14.java Thu Jul 20 07:23:28 2006
@@ -224,8 +224,7 @@
NamespaceHelper helper = new NamespaceHelper(LenyaMetaData.NAMESPACE, "", xmlDoc);
Element metaElement = helper.getFirstChild(xmlDoc.getDocumentElement(), "meta");
Element internalElement = helper.getFirstChild(metaElement, "internal");
- Element resourceTypeElement = helper.getFirstChild(internalElement,
- LenyaMetaData.ELEMENT_RESOURCE_TYPE);
+ Element resourceTypeElement = helper.getFirstChild(internalElement, "resourceType");
String resourceType = DocumentHelper.getSimpleElementText(resourceTypeElement);
AssetType doctype;
@@ -340,12 +339,11 @@
if (!registry.isRegistered(elementSetName)) {
registry.register(elementSetName, elements);
}
-
+
MetaData meta = trans.getMetaData(elementSetName);
if (meta.getElementSet().getElement(key).isMultiple()) {
meta.addValue(key, value);
- }
- else {
+ } else {
meta.setValue(key, value);
}
}
Modified: lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/LenyaElements.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/LenyaElements.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/LenyaElements.java (original)
+++ lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/LenyaElements.java Thu Jul 20 07:23:28 2006
@@ -24,11 +24,11 @@
String ELEMENT_SET = LenyaElements.class.getName();
- Element[] ELEMENTS = { new ElementImpl(LenyaMetaData.ELEMENT_RESOURCE_TYPE, false),
- new ElementImpl(LenyaMetaData.ELEMENT_CONTENT_TYPE, false),
- new ElementImpl(LenyaMetaData.ELEMENT_WORKFLOW_VERSION, true),
- new ElementImpl(LenyaMetaData.ELEMENT_PLACEHOLDER, false),
- new ElementImpl(LenyaMetaData.ELEMENTE_HEIGHT, false),
- new ElementImpl(LenyaMetaData.ELEMENT_WIDTH, false) };
+ Element[] ELEMENTS = { new ElementImpl("resourceType", false),
+ new ElementImpl("contentType", false),
+ new ElementImpl("workflowVersion", true),
+ new ElementImpl("placeholder", false),
+ new ElementImpl("height", false),
+ new ElementImpl("width", false) };
}
Modified: lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoLenyaMetaData.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoLenyaMetaData.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoLenyaMetaData.java (original)
+++ lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoLenyaMetaData.java Thu Jul 20 07:23:28 2006
@@ -32,7 +32,7 @@
}
public String getFirstValue(String key) throws DocumentException {
- if (key.equals(LenyaMetaData.ELEMENT_RESOURCE_TYPE)) {
+ if (key.equals("resourceType")) {
try {
return translation.getAsset().getAssetType().getName();
} catch (RepositoryException e) {
@@ -43,7 +43,7 @@
}
public String[] getValues(String key) throws DocumentException {
- if (key.equals(LenyaMetaData.ELEMENT_RESOURCE_TYPE)) {
+ if (key.equals("resourceType")) {
try {
return new String[] { translation.getAsset().getAssetType().getName() };
} catch (RepositoryException e) {
Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java?rev=423945&r1=423944&r2=423945&view=diff
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java Thu Jul 20 07:23:28 2006
@@ -791,8 +791,14 @@
for (int i = 0; i < internalElements.length; i++) {
String value = DocumentHelper.getSimpleElementText(internalElements[i]);
String key = internalElements[i].getLocalName();
- List values = getValueList(LenyaMetaData.NAMESPACE, key);
- values.add(value);
+
+ if (key.equals("workflowVersion")) {
+ List values = getValueList("http://apache.org/lenya/metadata/workflow/1.0", key);
+ values.add(value);
+ } else {
+ List values = getValueList("http://apache.org/lenya/metadata/document/1.0", key);
+ values.add(value);
+ }
}
NamespaceHelper dcHelper = new NamespaceHelper(DublinCore.DC_NAMESPACE, "", xml);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org