Author: fmui
Date: Tue Jul 6 12:46:48 2010
New Revision: 960888
URL: http://svn.apache.org/viewvc?rev=960888&view=rev
Log:
- Client API: added simple access to the main extension points
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/ExtensionLevel.java
(with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AbstractExtensionTestIT.java
(with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AtomPubSampleIT.java
(with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/WebServicesSampleIT.java
(with props)
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java?rev=960888&r1=960887&r2=960888&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
Tue Jul 6 12:46:48 2010
@@ -27,6 +27,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.AllowableActions;
import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel;
import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
/**
@@ -154,9 +155,9 @@ public interface CmisObject extends Obje
<T> void setPropertyMultivalue(String id, List<T> value);
- // void saveProperties(); // flush buffered ...Propert...-calls
+ // extensions
- // void saveAcl(); // flush buffered ...Acl...-calls
+ List<Object> getExtensions(ExtensionLevel level);
// session handling
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev=960888&r1=960887&r2=960888&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java
Tue Jul 6 12:46:48 2010
@@ -23,6 +23,7 @@ import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.GregorianCalendar;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -30,11 +31,11 @@ import java.util.Set;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.ItemIterable;
import org.apache.chemistry.opencmis.client.api.ObjectFactory;
import org.apache.chemistry.opencmis.client.api.ObjectId;
import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.client.api.OperationContext;
-import org.apache.chemistry.opencmis.client.api.ItemIterable;
import org.apache.chemistry.opencmis.client.api.Policy;
import org.apache.chemistry.opencmis.client.api.Property;
import org.apache.chemistry.opencmis.client.api.Relationship;
@@ -52,6 +53,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
import org.apache.chemistry.opencmis.commons.enums.Cardinality;
+import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel;
import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
import org.apache.chemistry.opencmis.commons.enums.Updatability;
import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
@@ -71,6 +73,7 @@ public abstract class AbstractPersistent
private Acl acl;
private List<Policy> policies;
private List<Relationship> relationships;
+ private Map<ExtensionLevel, List<Object>> extensions;
private OperationContext creationContext;
private boolean isChanged = false;
private long refreshTimestamp;
@@ -98,6 +101,7 @@ public abstract class AbstractPersistent
this.session = session;
this.objectType = objectType;
+ this.extensions = new HashMap<ExtensionLevel, List<Object>>();
this.creationContext = new OperationContextImpl(context);
this.refreshTimestamp = System.currentTimeMillis();
@@ -107,11 +111,13 @@ public abstract class AbstractPersistent
// handle properties
if (objectData.getProperties() != null) {
this.properties = of.convertProperties(objectType,
objectData.getProperties());
+ extensions.put(ExtensionLevel.PROPERTIES,
objectData.getProperties().getExtensions());
}
// handle allowable actions
if (objectData.getAllowableActions() != null) {
this.allowableActions = objectData.getAllowableActions();
+ extensions.put(ExtensionLevel.ALLOWABLE_ACTIONS,
objectData.getAllowableActions().getExtensions());
}
// handle renditions
@@ -125,6 +131,7 @@ public abstract class AbstractPersistent
// handle ACL
if (objectData.getAcl() != null) {
acl = objectData.getAcl();
+ extensions.put(ExtensionLevel.ACL,
objectData.getAcl().getExtensions());
}
// handle policies
@@ -136,6 +143,7 @@ public abstract class AbstractPersistent
policies.add((Policy) policy);
}
}
+ extensions.put(ExtensionLevel.POLICIES,
objectData.getPolicyIds().getExtensions());
}
// handle relationships
@@ -148,6 +156,8 @@ public abstract class AbstractPersistent
}
}
}
+
+ extensions.put(ExtensionLevel.OBJECT, objectData.getExtensions());
}
isChanged = false;
@@ -763,6 +773,17 @@ public abstract class AbstractPersistent
});
}
+ // --- extensions ---
+
+ public List<Object> getExtensions(ExtensionLevel level) {
+ List<Object> ext = extensions.get(level);
+ if (ext == null) {
+ return null;
+ }
+
+ return Collections.unmodifiableList(ext);
+ }
+
// --- other ---
/*
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java?rev=960888&r1=960887&r2=960888&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
Tue Jul 6 12:46:48 2010
@@ -37,6 +37,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.AllowableActions;
import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel;
import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
public class CmisObjectMock implements CmisObject, Serializable {
@@ -150,6 +151,10 @@ public class CmisObjectMock implements C
return null;
}
+ public List<Object> getExtensions(ExtensionLevel level) {
+ return null;
+ }
+
public boolean isChanged() {
return false;
}
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/ExtensionLevel.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/ExtensionLevel.java?rev=960888&view=auto
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/ExtensionLevel.java
(added)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/ExtensionLevel.java
Tue Jul 6 12:46:48 2010
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.enums;
+
+public enum ExtensionLevel {
+
+ OBJECT("object"), //
+ PROPERTIES("properties"), //
+ ALLOWABLE_ACTIONS("allowableActions"), //
+ ACL("acl"), //
+ POLICIES("policies"), //
+ CHANGE_EVENT("changeEvent");
+ private final String value;
+
+ ExtensionLevel(String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ public static ExtensionLevel fromValue(String v) {
+ for (ExtensionLevel c : ExtensionLevel.values()) {
+ if (c.value.equals(v)) {
+ return c;
+ }
+ }
+ throw new IllegalArgumentException(v);
+ }
+}
Propchange:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/ExtensionLevel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AbstractExtensionTestIT.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AbstractExtensionTestIT.java?rev=960888&view=auto
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AbstractExtensionTestIT.java
(added)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AbstractExtensionTestIT.java
Tue Jul 6 12:46:48 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.fit.runtime.extensions;
+
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public abstract class AbstractExtensionTestIT {
+
+ private static Session fSession;
+
+ /**
+ * Returns the current Session object.
+ */
+ protected Session getSession() {
+ return fSession;
+ }
+
+ /**
+ * Returns a new Session object.
+ */
+ protected abstract Session createSession();
+
+ @BeforeClass
+ public static void setUpClass() {
+ fSession = null;
+ }
+
+ @Before
+ public void setUp() {
+ if (fSession == null) {
+ fSession = createSession();
+ }
+ }
+
+ /**
+ * Simple extension test.
+ */
+ @Test
+ public void testExtensions() {
+ Folder rootFolder = getSession().getRootFolder();
+
+ // only test getting extensions without check
+ // (the InMemory repository does not expose extensions yet)
+ List<Object> extensions = null;
+ extensions = rootFolder.getExtensions(ExtensionLevel.OBJECT);
+ extensions = rootFolder.getExtensions(ExtensionLevel.PROPERTIES);
+ extensions = rootFolder.getExtensions(ExtensionLevel.ACL);
+ }
+}
Propchange:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AbstractExtensionTestIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AtomPubSampleIT.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AtomPubSampleIT.java?rev=960888&view=auto
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AtomPubSampleIT.java
(added)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AtomPubSampleIT.java
Tue Jul 6 12:46:48 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.fit.runtime.extensions;
+
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.fit.SessionFactory;
+
+/**
+ * AtomPub extension test.
+ */
+public class AtomPubSampleIT extends AbstractExtensionTestIT {
+
+ @Override
+ protected Session createSession() {
+ return SessionFactory.createAtomPubSession();
+ }
+}
Propchange:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/AtomPubSampleIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/WebServicesSampleIT.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/WebServicesSampleIT.java?rev=960888&view=auto
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/WebServicesSampleIT.java
(added)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/WebServicesSampleIT.java
Tue Jul 6 12:46:48 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.fit.runtime.extensions;
+
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.fit.SessionFactory;
+
+/**
+ * Web Services extension test.
+ */
+public class WebServicesSampleIT extends AbstractExtensionTestIT {
+
+ @Override
+ protected Session createSession() {
+ return SessionFactory.createWebServicesSession();
+ }
+}
Propchange:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/extensions/WebServicesSampleIT.java
------------------------------------------------------------------------------
svn:eol-style = native