Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java Wed Jul 29 10:21:11 2009 @@ -16,6 +16,7 @@ */ package org.apache.chemistry.impl.simple; +import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -35,163 +36,180 @@ public class SimpleType implements Type { public static final SimplePropertyDefinition PROP_ID = new SimplePropertyDefinition( - Property.ID, "def:id", "Id", "", false, PropertyType.ID, false, - null, false, true, null, Updatability.READ_ONLY, true, true, 0, - null, null, -1, null); + Property.ID, "def:id", null, Property.ID, "Id", "", false, + PropertyType.ID, false, null, false, true, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_URI = new SimplePropertyDefinition( - Property.URI, "def:uri", "URI", "", false, PropertyType.URI, false, - null, false, false, null, Updatability.READ_ONLY, true, true, 0, - null, null, -1, null); + Property.URI, "def:uri", null, Property.URI, "URI", "", false, + PropertyType.URI, false, null, false, false, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_TYPE_ID = new SimplePropertyDefinition( - Property.TYPE_ID, "def:typeid", "Type ID", "", false, - PropertyType.ID, false, null, false, true, null, + Property.TYPE_ID, "def:typeid", null, Property.TYPE_ID, "Type ID", + "", false, PropertyType.ID, false, null, false, true, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_BASE_TYPE_ID = new SimplePropertyDefinition( - Property.BASE_TYPE_ID, "def:basetypeid", "Base Type ID", "", false, - PropertyType.ID, false, null, false, true, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + Property.BASE_TYPE_ID, "def:basetypeid", null, + Property.BASE_TYPE_ID, "Base Type ID", "", false, PropertyType.ID, + false, null, false, true, null, Updatability.READ_ONLY, true, true, + 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_CREATED_BY = new SimplePropertyDefinition( - Property.CREATED_BY, "def:createdby", "Created By", "", false, - PropertyType.STRING, false, null, false, true, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + Property.CREATED_BY, "def:createdby", null, Property.CREATED_BY, + "Created By", "", false, PropertyType.STRING, false, null, false, + true, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, + null); public static final SimplePropertyDefinition PROP_CREATION_DATE = new SimplePropertyDefinition( - Property.CREATION_DATE, "def:creationdate", "Creation Date", "", - false, PropertyType.DATETIME, false, null, false, true, null, + Property.CREATION_DATE, "def:creationdate", null, + Property.CREATION_DATE, "Creation Date", "", false, + PropertyType.DATETIME, false, null, false, true, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_LAST_MODIFIED_BY = new SimplePropertyDefinition( - Property.LAST_MODIFIED_BY, "def:lastmodifiedby", - "Last Modified By", "", false, PropertyType.STRING, false, null, - false, true, null, Updatability.READ_ONLY, true, true, 0, null, - null, -1, null); + Property.LAST_MODIFIED_BY, "def:lastmodifiedby", null, + Property.LAST_MODIFIED_BY, "Last Modified By", "", false, + PropertyType.STRING, false, null, false, true, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_LAST_MODIFICATION_DATE = new SimplePropertyDefinition( - Property.LAST_MODIFICATION_DATE, "def:lastmodificationdate", - "Last Modification Date", "", false, PropertyType.DATETIME, false, - null, false, true, null, Updatability.READ_ONLY, true, true, 0, - null, null, -1, null); + Property.LAST_MODIFICATION_DATE, "def:lastmodificationdate", null, + Property.LAST_MODIFICATION_DATE, "Last Modification Date", "", + false, PropertyType.DATETIME, false, null, false, true, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_CHANGE_TOKEN = new SimplePropertyDefinition( - Property.CHANGE_TOKEN, "def:changetoken", "Change Token", "", - false, PropertyType.STRING, false, null, false, false, null, + Property.CHANGE_TOKEN, "def:changetoken", null, + Property.CHANGE_TOKEN, "Change Token", "", false, + PropertyType.STRING, false, null, false, false, null, Updatability.READ_WRITE, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_NAME = new SimplePropertyDefinition( - Property.NAME, "def:name", "Name", "", false, PropertyType.STRING, - false, null, false, true, null, Updatability.READ_WRITE, true, - true, 0, null, null, -1, null); + Property.NAME, "def:name", null, Property.NAME, "Name", "", false, + PropertyType.STRING, false, null, false, true, null, + Updatability.READ_WRITE, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_IS_LATEST_VERSION = new SimplePropertyDefinition( - Property.IS_LATEST_VERSION, "def:islatestversion", - "Is Latest Version", "", false, PropertyType.BOOLEAN, false, null, - false, true, null, Updatability.READ_ONLY, true, true, 0, null, - null, -1, null); + Property.IS_LATEST_VERSION, "def:islatestversion", null, + Property.IS_LATEST_VERSION, "Is Latest Version", "", false, + PropertyType.BOOLEAN, false, null, false, true, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_IS_MAJOR_VERSION = new SimplePropertyDefinition( - Property.IS_MAJOR_VERSION, "def:ismajorversion", - "Is Major Version", "", false, PropertyType.BOOLEAN, false, null, - false, false, null, Updatability.READ_ONLY, true, true, 0, null, - null, -1, null); + Property.IS_MAJOR_VERSION, "def:ismajorversion", null, + Property.IS_MAJOR_VERSION, "Is Major Version", "", false, + PropertyType.BOOLEAN, false, null, false, false, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_IS_LATEST_MAJOR_VERSION = new SimplePropertyDefinition( - Property.IS_LATEST_MAJOR_VERSION, "def:islatestmajorversion", - "Is Latest Major Version", "", false, PropertyType.BOOLEAN, false, - null, false, true, null, Updatability.READ_ONLY, true, true, 0, - null, null, -1, null); + Property.IS_LATEST_MAJOR_VERSION, "def:islatestmajorversion", null, + Property.IS_LATEST_MAJOR_VERSION, "Is Latest Major Version", "", + false, PropertyType.BOOLEAN, false, null, false, true, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_VERSION_LABEL = new SimplePropertyDefinition( - Property.VERSION_LABEL, "def:versionlabel", "Version Label", "", - false, PropertyType.STRING, false, null, false, true, null, + Property.VERSION_LABEL, "def:versionlabel", null, + Property.VERSION_LABEL, "Version Label", "", false, + PropertyType.STRING, false, null, false, true, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_VERSION_SERIES_ID = new SimplePropertyDefinition( - Property.VERSION_SERIES_ID, "def:versionseriesid", - "Version Series ID", "", false, PropertyType.ID, false, null, - false, true, null, Updatability.READ_ONLY, true, true, 0, null, - null, -1, null); + Property.VERSION_SERIES_ID, "def:versionseriesid", null, + Property.VERSION_SERIES_ID, "Version Series ID", "", false, + PropertyType.ID, false, null, false, true, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_IS_VERSION_SERIES_CHECKED_OUT = new SimplePropertyDefinition( Property.IS_VERSION_SERIES_CHECKED_OUT, - "def:isversionseriescheckedout", "Is Version Series Checked Out", - "", false, PropertyType.BOOLEAN, false, null, false, true, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + "def:isversionseriescheckedout", null, + Property.IS_VERSION_SERIES_CHECKED_OUT, + "Is Version Series Checked Out", "", false, PropertyType.BOOLEAN, + false, null, false, true, null, Updatability.READ_ONLY, true, true, + 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_VERSION_SERIES_CHECKED_OUT_BY = new SimplePropertyDefinition( Property.VERSION_SERIES_CHECKED_OUT_BY, - "def:versionseriescheckedoutby", "Version Series Checked Out By", - "", false, PropertyType.STRING, false, null, false, false, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + "def:versionseriescheckedoutby", null, + Property.VERSION_SERIES_CHECKED_OUT_BY, + "Version Series Checked Out By", "", false, PropertyType.STRING, + false, null, false, false, null, Updatability.READ_ONLY, true, + true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_VERSION_SERIES_CHECKED_OUT_ID = new SimplePropertyDefinition( Property.VERSION_SERIES_CHECKED_OUT_ID, - "def:versionseriescheckedoutid", "Version Series Checked Out Id", - "", false, PropertyType.ID, false, null, false, false, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + "def:versionseriescheckedoutid", null, + Property.VERSION_SERIES_CHECKED_OUT_ID, + "Version Series Checked Out Id", "", false, PropertyType.ID, false, + null, false, false, null, Updatability.READ_ONLY, true, true, 0, + null, null, -1, null); public static final SimplePropertyDefinition PROP_CHECKIN_COMMENT = new SimplePropertyDefinition( - Property.CHECKIN_COMMENT, "def:checkincomment", "Checkin Comment", - "", false, PropertyType.STRING, false, null, false, false, null, + Property.CHECKIN_COMMENT, "def:checkincomment", null, + Property.CHECKIN_COMMENT, "Checkin Comment", "", false, + PropertyType.STRING, false, null, false, false, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_CONTENT_STREAM_LENGTH = new SimplePropertyDefinition( - Property.CONTENT_STREAM_LENGTH, "def:contentstreamlength", - "Content Stream Length", "", false, PropertyType.INTEGER, false, - null, false, false, null, Updatability.READ_ONLY, true, true, 0, - null, null, -1, null); + Property.CONTENT_STREAM_LENGTH, "def:contentstreamlength", null, + Property.CONTENT_STREAM_LENGTH, "Content Stream Length", "", false, + PropertyType.INTEGER, false, null, false, false, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_CONTENT_STREAM_MIME_TYPE = new SimplePropertyDefinition( Property.CONTENT_STREAM_MIME_TYPE, "def:contentstreammimetype", + null, Property.CONTENT_STREAM_MIME_TYPE, "Content Stream MIME Type", "", false, PropertyType.STRING, false, null, false, false, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_CONTENT_STREAM_FILENAME = new SimplePropertyDefinition( Property.CONTENT_STREAM_FILENAME, "def:contentstreamfilename", - "Content Stream Filename", "", false, PropertyType.STRING, false, - null, false, false, null, Updatability.READ_WRITE, true, true, 0, - null, null, -1, null); + null, Property.CONTENT_STREAM_FILENAME, "Content Stream Filename", + "", false, PropertyType.STRING, false, null, false, false, null, + Updatability.READ_WRITE, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_CONTENT_STREAM_URI = new SimplePropertyDefinition( - Property.CONTENT_STREAM_URI, "def:contentstreamuri", - "Content Stream URI", "", false, PropertyType.URI, false, null, - false, false, null, Updatability.READ_ONLY, true, true, 0, null, - null, -1, null); + Property.CONTENT_STREAM_URI, "def:contentstreamuri", null, + Property.CONTENT_STREAM_URI, "Content Stream URI", "", false, + PropertyType.URI, false, null, false, false, null, + Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_PARENT_ID = new SimplePropertyDefinition( - Property.PARENT_ID, "def:parentid", "Parent Id", "", false, - PropertyType.ID, false, null, false, true, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + Property.PARENT_ID, "def:parentid", null, Property.PARENT_ID, + "Parent Id", "", false, PropertyType.ID, false, null, false, true, + null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS = new SimplePropertyDefinition( Property.ALLOWED_CHILD_OBJECT_TYPE_IDS, - "def:allowedchildobjecttypeids", "Allowed Child Object Type Ids", - "", false, PropertyType.ID, true, null, false, false, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + "def:allowedchildobjecttypeids", null, + Property.ALLOWED_CHILD_OBJECT_TYPE_IDS, + "Allowed Child Object Type Ids", "", false, PropertyType.ID, true, + null, false, false, null, Updatability.READ_ONLY, true, true, 0, + null, null, -1, null); public static final SimplePropertyDefinition PROP_SOURCE_ID = new SimplePropertyDefinition( - Property.SOURCE_ID, "def:sourceid", "Source Id", "", false, - PropertyType.ID, false, null, false, true, null, - Updatability.READ_WRITE, true, true, 0, null, null, -1, null); + Property.SOURCE_ID, "def:sourceid", null, Property.SOURCE_ID, + "Source Id", "", false, PropertyType.ID, false, null, false, true, + null, Updatability.READ_WRITE, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_TARGET_ID = new SimplePropertyDefinition( - Property.TARGET_ID, "def:targetid", "Target Id", "", false, - PropertyType.ID, false, null, false, true, null, - Updatability.READ_WRITE, true, true, 0, null, null, -1, null); + Property.TARGET_ID, "def:targetid", null, Property.TARGET_ID, + "Target Id", "", false, PropertyType.ID, false, null, false, true, + null, Updatability.READ_WRITE, true, true, 0, null, null, -1, null); public static final SimplePropertyDefinition PROP_POLICY_NAME = new SimplePropertyDefinition( - Property.POLICY_NAME, "def:policyname", "Policy Name", "", false, - PropertyType.STRING, false, null, false, true, null, - Updatability.READ_ONLY, true, true, 0, null, null, -1, null); + Property.POLICY_NAME, "def:policyname", null, Property.POLICY_NAME, + "Policy Name", "", false, PropertyType.STRING, false, null, false, + true, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, + null); public static final SimplePropertyDefinition PROP_POLICY_TEXT = new SimplePropertyDefinition( - Property.POLICY_TEXT, "def:policytext", "Policy Text", "", false, - PropertyType.STRING, false, null, false, true, null, - Updatability.READ_WRITE, true, true, 0, null, null, -1, null); + Property.POLICY_TEXT, "def:policytext", null, Property.POLICY_TEXT, + "Policy Text", "", false, PropertyType.STRING, false, null, false, + true, null, Updatability.READ_WRITE, true, true, 0, null, null, -1, + null); private static final PropertyDefinition[] PROPS_COMMON = { PROP_ID, // PROP_URI, // @@ -243,12 +261,16 @@ private final String id; - private final String parentId; + private final String localName; + + private final URI localNamespace; private final String queryName; private final String displayName; + private final String parentId; + private final BaseType baseType; private final String description; @@ -273,29 +295,33 @@ private final Map<String, PropertyDefinition> propertyDefinitions; - public SimpleType(String id, String parentId, String queryName, - String displayName, BaseType baseType, String description, - boolean creatable, boolean queryable, boolean controllable, + public SimpleType(String id, String parentId, String localName, + URI localNamespace, String queryName, String displayName, + BaseType baseType, String description, boolean creatable, + boolean queryable, boolean controllable, boolean includedInSuperTypeQuery, boolean fileable, boolean versionable, ContentStreamPresence contentStreamAllowed, String[] allowedSourceTypes, String[] allowedTargetTypes, Collection<PropertyDefinition> propertyDefinitions) { - this(id, parentId, queryName, displayName, baseType, description, - creatable, queryable, controllable, includedInSuperTypeQuery, - fileable, versionable, contentStreamAllowed, - allowedSourceTypes, allowedTargetTypes); + this(id, parentId, localName, localNamespace, queryName, displayName, + baseType, description, creatable, queryable, controllable, + includedInSuperTypeQuery, fileable, versionable, + contentStreamAllowed, allowedSourceTypes, allowedTargetTypes); addPropertyDefinitions(getBasePropertyDefinitions(baseType)); addPropertyDefinitions(propertyDefinitions); } - public SimpleType(String id, String parentId, String queryName, - String displayName, BaseType baseType, String description, - boolean creatable, boolean queryable, boolean controllable, + public SimpleType(String id, String parentId, String localName, + URI localNamespace, String queryName, String displayName, + BaseType baseType, String description, boolean creatable, + boolean queryable, boolean controllable, boolean includedInSuperTypeQuery, boolean fileable, boolean versionable, ContentStreamPresence contentStreamAllowed, String[] allowedSourceTypes, String[] allowedTargetTypes) { this.id = id; this.parentId = parentId; + this.localName = localName; + this.localNamespace = localNamespace; this.queryName = queryName; this.displayName = displayName; this.baseType = baseType; @@ -314,12 +340,12 @@ protected void addPropertyDefinitions(Collection<PropertyDefinition> defs) { for (PropertyDefinition def : defs) { - String name = def.getName(); - if (propertyDefinitions.containsKey(name)) { + String id = def.getId(); + if (propertyDefinitions.containsKey(id)) { throw new RuntimeException( - "Property already defined for name: " + name); + "Property already defined for name: " + id); } - propertyDefinitions.put(name, def); + propertyDefinitions.put(id, def); } } @@ -343,6 +369,14 @@ return id; } + public String getLocalName() { + return localName; + } + + public URI getLocalNamespace() { + return localNamespace; + } + public String getQueryName() { return queryName; } @@ -403,8 +437,8 @@ return Collections.unmodifiableCollection(propertyDefinitions.values()); } - public PropertyDefinition getPropertyDefinition(String name) { - return propertyDefinitions.get(name); + public PropertyDefinition getPropertyDefinition(String id) { + return propertyDefinitions.get(id); } }
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java Wed Jul 29 10:21:11 2009 @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -31,7 +32,8 @@ public class SimpleTypeManager implements TypeManager { - protected final Map<String, Type> types = new HashMap<String, Type>(); + // linked so that values() returns things in a parent-before-children order + protected final Map<String, Type> types = new LinkedHashMap<String, Type>(); protected final Map<String, Collection<Type>> typesChildren = new HashMap<String, Collection<Type>>(); Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java Wed Jul 29 10:21:11 2009 @@ -50,29 +50,30 @@ protected void setUp() throws Exception { super.setUp(); PropertyDefinition d1 = new SimplePropertyDefinition("title", - "def:title", "Title", "", false, PropertyType.STRING, false, - null, false, false, "", Updatability.READ_WRITE, true, true, 0, - null, null, -1, null); - PropertyDefinition d2 = new SimplePropertyDefinition("description", - "def:description", "Description", "", false, + "def:title", null, "title", "Title", "", false, PropertyType.STRING, false, null, false, false, "", Updatability.READ_WRITE, true, true, 0, null, null, -1, null); + PropertyDefinition d2 = new SimplePropertyDefinition("description", + "def:description", null, "description", "Description", "", + false, PropertyType.STRING, false, null, false, false, "", + Updatability.READ_WRITE, true, true, 0, null, null, -1, null); PropertyDefinition d3 = new SimplePropertyDefinition("date", - "def:date", "Date", "", false, PropertyType.DATETIME, false, - null, false, false, null, Updatability.READ_WRITE, true, true, - 0, null, null, -1, null); + "def:date", null, "date", "Date", "", false, + PropertyType.DATETIME, false, null, false, false, null, + Updatability.READ_WRITE, true, true, 0, null, null, -1, null); SimpleType mt1 = new SimpleType("doc", BaseType.DOCUMENT.getId(), - "Doc", "My Doc Type", BaseType.DOCUMENT, "", true, true, true, - true, true, true, ContentStreamPresence.ALLOWED, null, null, - Arrays.asList(d1, d2, d3)); + "doc", null, "Doc", "My Doc Type", BaseType.DOCUMENT, "", true, + true, true, true, true, true, ContentStreamPresence.ALLOWED, + null, null, Arrays.asList(d1, d2, d3)); SimpleType mt2 = new SimpleType("fold", BaseType.FOLDER.getId(), - "Fold", "My Folder Type", BaseType.FOLDER, "", true, true, - true, true, false, false, ContentStreamPresence.NOT_ALLOWED, - null, null, Arrays.asList(d1, d2)); - SimpleType mt3 = new SimpleType("subdoc", "doc", "SubDoc", - "My SubDoc Type", BaseType.DOCUMENT, "", true, true, true, - true, true, true, ContentStreamPresence.ALLOWED, null, null, - Arrays.asList(d1, d2, d3)); + "fold", null, "Fold", "My Folder Type", BaseType.FOLDER, "", + true, true, true, true, false, false, + ContentStreamPresence.NOT_ALLOWED, null, null, Arrays.asList( + d1, d2)); + SimpleType mt3 = new SimpleType("subdoc", "doc", "subdoc", null, + "SubDoc", "My SubDoc Type", BaseType.DOCUMENT, "", true, true, + true, true, true, true, ContentStreamPresence.ALLOWED, null, + null, Arrays.asList(d1, d2, d3)); repo = new SimpleRepository("test", Arrays.asList(mt1, mt2, mt3), null); } Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java Wed Jul 29 10:21:11 2009 @@ -78,11 +78,11 @@ } @Override - public String getString(String name) { - if (name.equals(Property.CONTENT_STREAM_MIME_TYPE)) { + public String getString(String id) { + if (id.equals(Property.CONTENT_STREAM_MIME_TYPE)) { return getContentStream().getMimeType(); } - return super.getString(name); + return super.getString(id); } public void setContentStream(ContentStream contentStream) @@ -95,11 +95,11 @@ throw new UnsupportedOperationException(); } - public void setName(String name) { + public void setName(String value) { throw new UnsupportedOperationException(); } - public void setValue(String name, Serializable value) { + public void setValue(String id, Serializable value) { throw new UnsupportedOperationException(); } Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java Wed Jul 29 10:21:11 2009 @@ -99,11 +99,11 @@ throw new UnsupportedOperationException(); } - public void setName(String name) { + public void setName(String id) { throw new UnsupportedOperationException(); } - public void setValue(String name, Serializable value) { + public void setValue(String id, Serializable value) { throw new UnsupportedOperationException(); } Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java Wed Jul 29 10:21:11 2009 @@ -191,19 +191,19 @@ } @Override - public void setName(String name) { + public void setName(String value) { if (saved) { throw new UnsupportedOperationException(); } - this.name = name; + this.name = value; } @Override - public void setValue(String name, Serializable value) { + public void setValue(String id, Serializable value) { if (saved) { throw new UnsupportedOperationException(); } - values.put(name, value); + values.put(id, value); } @Override Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java Wed Jul 29 10:21:11 2009 @@ -143,19 +143,19 @@ } @Override - public void setName(String name) { + public void setName(String value) { if (saved) { throw new UnsupportedOperationException(); } - this.name = name; + this.name = value; } @Override - public void setValue(String name, Serializable value) { + public void setValue(String id, Serializable value) { if (saved) { throw new UnsupportedOperationException(); } - values.put(name, value); + values.put(id, value); } @Override Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java Wed Jul 29 10:21:11 2009 @@ -50,6 +50,7 @@ public abstract class JcrObjectEntry implements ObjectEntry { public static final String MIX_UNSTRUCTURED = "mix:unstructured"; + private static final Log log = LogFactory.getLog(JcrObjectEntry.class); protected Node node; @@ -58,27 +59,28 @@ this.node = node; } - public JcrObjectEntry() {} + public JcrObjectEntry() { + } public Collection<String> getAllowableActions() { throw new UnsupportedOperationException(); } - public Boolean getBoolean(String name) { + public Boolean getBoolean(String id) { try { - return Boolean.valueOf(node.getProperty(name).getBoolean()); + return Boolean.valueOf(node.getProperty(id).getBoolean()); } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get boolean value: " + name; + String msg = "Unable to get boolean value: " + id; log.error(msg, e); } return null; } - public Boolean[] getBooleans(String name) { + public Boolean[] getBooleans(String id) { try { - Value[] values = node.getProperty(name).getValues(); + Value[] values = node.getProperty(id).getValues(); Boolean[] result = new Boolean[values.length]; for (int i = 0; i < values.length; i++) { result[i] = Boolean.valueOf(values[i].getBoolean()); @@ -87,7 +89,7 @@ } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get boolean values: " + name; + String msg = "Unable to get boolean values: " + id; log.error(msg, e); } return null; @@ -109,21 +111,21 @@ return getDateTime(Property.CREATION_DATE); } - public Calendar getDateTime(String name) { + public Calendar getDateTime(String id) { try { - return node.getProperty(name).getDate(); + return node.getProperty(id).getDate(); } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get date time value: " + name; + String msg = "Unable to get date time value: " + id; log.error(msg, e); } return null; } - public Calendar[] getDateTimes(String name) { + public Calendar[] getDateTimes(String id) { try { - Value[] values = node.getProperty(name).getValues(); + Value[] values = node.getProperty(id).getValues(); Calendar[] result = new Calendar[values.length]; for (int i = 0; i < values.length; i++) { result[i] = values[i].getDate(); @@ -132,27 +134,27 @@ } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get date time values: " + name; + String msg = "Unable to get date time values: " + id; log.error(msg, e); } return null; } - public BigDecimal getDecimal(String name) { + public BigDecimal getDecimal(String id) { try { - return new BigDecimal(node.getProperty(name).getDouble()); + return new BigDecimal(node.getProperty(id).getDouble()); } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get decimal value: " + name; + String msg = "Unable to get decimal value: " + id; log.error(msg, e); } return null; } - public BigDecimal[] getDecimals(String name) { + public BigDecimal[] getDecimals(String id) { try { - Value[] values = node.getProperty(name).getValues(); + Value[] values = node.getProperty(id).getValues(); BigDecimal[] result = new BigDecimal[values.length]; for (int i = 0; i < values.length; i++) { result[i] = new BigDecimal(values[i].getDouble()); @@ -161,7 +163,7 @@ } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get decimal values: " + name; + String msg = "Unable to get decimal values: " + id; log.error(msg, e); } return null; @@ -175,22 +177,22 @@ throw new UnsupportedOperationException(); } - public String getHTML(String name) { - return (String) getValue(name); + public String getHTML(String id) { + return (String) getValue(id); } - public String[] getHTMLs(String name) { - return (String[]) getValue(name); + public String[] getHTMLs(String id) { + return (String[]) getValue(id); } - public String getId(String name) { + public String getId(String id) { try { - javax.jcr.Property prop = node.getProperty(name); + javax.jcr.Property prop = node.getProperty(id); return getItemId(prop); } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get item path: " + name; + String msg = "Unable to get item path: " + id; log.error(msg, e); } return null; @@ -206,25 +208,25 @@ return null; } - public String[] getIds(String name) { - return (String[]) getValue(name); + public String[] getIds(String id) { + return (String[]) getValue(id); } - public Integer getInteger(String name) { + public Integer getInteger(String id) { try { - return Integer.valueOf((int) node.getProperty(name).getLong()); + return Integer.valueOf((int) node.getProperty(id).getLong()); } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get integer value: " + name; + String msg = "Unable to get integer value: " + id; log.error(msg, e); } return null; } - public Integer[] getIntegers(String name) { + public Integer[] getIntegers(String id) { try { - Value[] values = node.getProperty(name).getValues(); + Value[] values = node.getProperty(id).getValues(); Integer[] result = new Integer[values.length]; for (int i = 0; i < values.length; i++) { result[i] = Integer.valueOf((int) values[i].getLong()); @@ -233,7 +235,7 @@ } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get integer values: " + name; + String msg = "Unable to get integer values: " + id; log.error(msg, e); } return null; @@ -263,15 +265,15 @@ // TODO use the definition inside SimpleType private static final SimplePropertyDefinition PROP_TYPE_ID = new SimplePropertyDefinition( - Property.TYPE_ID, "def:typeid", "Type ID", "", false, - PropertyType.ID, false, null, false, true, null, + Property.TYPE_ID, "def:typeid", null, Property.TYPE_ID, "Type ID", + "", false, PropertyType.ID, false, null, false, true, null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null); public Map<String, Property> getProperties() { Map<String, Property> properties = new HashMap<String, Property>(); for (PropertyDefinition pd : getType().getPropertyDefinitions()) { - String name = pd.getName(); - properties.put(name, getProperty(name)); + String id = pd.getId(); + properties.put(id, getProperty(id)); } // TODO return other virtual properties and provide helper class properties.put(Property.TYPE_ID, new Property() { @@ -290,13 +292,13 @@ return properties; } - public Property getProperty(String name) { + public Property getProperty(String id) { try { - return new JcrProperty(node.getProperty(name)); + return new JcrProperty(node.getProperty(id)); } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get property: " + name; + String msg = "Unable to get property: " + id; log.error(msg, e); } return null; @@ -310,21 +312,21 @@ return Collections.emptyList(); } - public String getString(String name) { + public String getString(String id) { try { - return node.getProperty(name).getString(); + return node.getProperty(id).getString(); } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get string value: " + name; + String msg = "Unable to get string value: " + id; log.error(msg, e); } return null; } - public String[] getStrings(String name) { + public String[] getStrings(String id) { try { - Value[] values = node.getProperty(name).getValues(); + Value[] values = node.getProperty(id).getValues(); String[] result = new String[values.length]; for (int i = 0; i < values.length; i++) { result[i] = values[i].getString(); @@ -333,7 +335,7 @@ } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get string values: " + name; + String msg = "Unable to get string values: " + id; log.error(msg, e); } return null; @@ -353,22 +355,22 @@ return getType().getId(); } - public URI getURI(String name) { - return (URI) getValue(name); + public URI getURI(String id) { + return (URI) getValue(id); } public URI getURI() { return getURI(Property.URI); } - public URI[] getURIs(String name) { - return (URI[]) getValue(name); + public URI[] getURIs(String id) { + return (URI[]) getValue(id); } - public Serializable getValue(String name) { + public Serializable getValue(String id) { try { - if (node.hasProperty(name)) { - Value value = node.getProperty(name).getValue(); + if (node.hasProperty(id)) { + Value value = node.getProperty(id).getValue(); if (value instanceof Serializable) { return (Serializable) value; } @@ -376,7 +378,7 @@ } catch (PathNotFoundException e) { /* property does not exist */ } catch (RepositoryException e) { - String msg = "Unable to get value: " + name; + String msg = "Unable to get value: " + id; log.error(msg, e); } return null; @@ -385,8 +387,8 @@ public Map<String, Serializable> getValues() { Map<String, Serializable> values = new HashMap<String, Serializable>(); for (PropertyDefinition def : getType().getPropertyDefinitions()) { - String name = def.getName(); - values.put(name, getValue(name)); + String id = def.getId(); + values.put(id, getValue(id)); } return values; } @@ -411,12 +413,12 @@ return null; } - public String getXML(String name) { - return (String) getValue(name); + public String getXML(String id) { + return (String) getValue(id); } - public String[] getXMLs(String name) { - return (String[]) getValue(name); + public String[] getXMLs(String id) { + return (String[]) getValue(id); } public boolean hasContentStream() { Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrPropertyDefinition.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrPropertyDefinition.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrPropertyDefinition.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrPropertyDefinition.java Wed Jul 29 10:21:11 2009 @@ -55,6 +55,14 @@ return propDef.getName(); } + public String getLocalName() { + return propDef.getName(); // TODO + } + + public URI getLocalNamespace() { + return null; // TODO + } + public int getMaxLength() { // TODO Auto-generated method stub return 0; @@ -70,7 +78,7 @@ return null; } - public String getName() { + public String getQueryName() { return propDef.getName(); } Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrType.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrType.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrType.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrType.java Wed Jul 29 10:21:11 2009 @@ -16,6 +16,7 @@ */ package org.apache.chemistry.jcr; +import java.net.URI; import java.util.Collection; import java.util.Collections; @@ -74,7 +75,15 @@ return null; } - public PropertyDefinition getPropertyDefinition(String name) { + public String getLocalName() { + return nodeType.getName(); + } + + public URI getLocalNamespace() { + return null; + } + + public PropertyDefinition getPropertyDefinition(String id) { // TODO Auto-generated method stub return null; } Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java?rev=798836&r1=798835&r2=798836&view=diff ============================================================================== --- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java (original) +++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java Wed Jul 29 10:21:11 2009 @@ -48,25 +48,26 @@ public static Repository makeRepository(String rootId) throws IOException { PropertyDefinition p1 = new SimplePropertyDefinition("title", - "def:title", "Title", "", false, PropertyType.STRING, false, - null, false, false, "(no title)", Updatability.READ_WRITE, - true, true, 0, null, null, -1, null); + "def:title", null, "title", "Title", "", false, + PropertyType.STRING, false, null, false, false, "(no title)", + Updatability.READ_WRITE, true, true, 0, null, null, -1, null); PropertyDefinition p2 = new SimplePropertyDefinition("description", - "def:description", "Description", "", false, - PropertyType.STRING, false, null, false, false, "", + "def:description", null, "description", "Description", "", + false, PropertyType.STRING, false, null, false, false, "", Updatability.READ_WRITE, true, true, 0, null, null, -1, null); PropertyDefinition p3 = new SimplePropertyDefinition("date", - "def:date", "Date", "", false, PropertyType.DATETIME, false, - null, false, false, null, Updatability.READ_WRITE, true, true, - 0, null, null, -1, null); - SimpleType dt = new SimpleType("doc", BaseType.DOCUMENT.getId(), - "Doc", "My Doc Type", BaseType.DOCUMENT, "", true, true, true, - true, true, true, ContentStreamPresence.ALLOWED, null, null, - Arrays.asList(p1, p2, p3)); - SimpleType ft = new SimpleType("fold", BaseType.FOLDER.getId(), - "Fold", "My Folder Type", BaseType.FOLDER, "", true, true, - true, true, false, false, ContentStreamPresence.NOT_ALLOWED, - null, null, Arrays.asList(p1, p2)); + "def:date", null, "date", "Date", "", false, + PropertyType.DATETIME, false, null, false, false, null, + Updatability.READ_WRITE, true, true, 0, null, null, -1, null); + SimpleType dt = new SimpleType("doc", BaseType.DOCUMENT.getId(), "doc", + null, "Doc", "My Doc Type", BaseType.DOCUMENT, "", true, true, + true, true, true, true, ContentStreamPresence.ALLOWED, null, + null, Arrays.asList(p1, p2, p3)); + SimpleType ft = new SimpleType("fold", BaseType.FOLDER.getId(), "fold", + null, "Fold", "My Folder Type", BaseType.FOLDER, "", true, + true, true, true, false, false, + ContentStreamPresence.NOT_ALLOWED, null, null, Arrays.asList( + p1, p2)); SimpleRepository repo = new SimpleRepository("test", Arrays.asList(dt, ft), rootId); Connection conn = repo.getConnection(null);
