chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1005006 [4/5] - in /incubator/chemistry/opencmis/trunk: ./ chemistry-opencmis-workbench/ chemistry-opencmis-workbench/chemistry-opencmis-workbench/ chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/ chemistry-opencmis-workbench...
Date Wed, 06 Oct 2010 12:32:26 GMT
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,237 @@
+/*
+ * 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.workbench.model;
+
+import java.net.Authenticator;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.client.api.OperationContext;
+import org.apache.chemistry.opencmis.client.api.Repository;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory;
+import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+
+public class ClientSession {
+
+    public static final String WORKBENCH_PREFIX = "cmis.workbench.";
+    public static final String OBJECT_PREFIX = WORKBENCH_PREFIX + "object.";
+    public static final String FOLDER_PREFIX = WORKBENCH_PREFIX + "folder.";
+    public static final String ACCEPT_SELF_SIGNED_CERTIFICATES = WORKBENCH_PREFIX + "acceptSelfSignedCertificates";
+
+    public enum Authentication {
+        NONE, STANDARD, NTLM
+    }
+
+    private static final Set<String> PROPERTY_SET = new HashSet<String>();
+    static {
+        PROPERTY_SET.add(PropertyIds.OBJECT_ID);
+        PROPERTY_SET.add(PropertyIds.OBJECT_TYPE_ID);
+        PROPERTY_SET.add(PropertyIds.NAME);
+        PROPERTY_SET.add(PropertyIds.CONTENT_STREAM_MIME_TYPE);
+        PROPERTY_SET.add(PropertyIds.CONTENT_STREAM_LENGTH);
+        PROPERTY_SET.add(PropertyIds.CONTENT_STREAM_FILE_NAME);
+        PROPERTY_SET.add(PropertyIds.CREATED_BY);
+        PROPERTY_SET.add(PropertyIds.CREATION_DATE);
+        PROPERTY_SET.add(PropertyIds.LAST_MODIFIED_BY);
+        PROPERTY_SET.add(PropertyIds.LAST_MODIFICATION_DATE);
+    }
+
+    private Map<String, String> sessionParameters;
+    private List<Repository> repositories;
+    private Session session;
+    private OperationContext objectOperationContext;
+    private OperationContext folderOperationContext;
+
+    public ClientSession(String url, BindingType binding, String username, String password, Authentication authenticaion) {
+        Map<String, String> parameters = new HashMap<String, String>();
+
+        if (binding == BindingType.WEBSERVICES) {
+            parameters.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());
+            parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url);
+            parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url);
+        } else {
+            parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
+            parameters.put(SessionParameter.ATOMPUB_URL, url);
+        }
+
+        switch (authenticaion) {
+        case STANDARD:
+            parameters.put(SessionParameter.USER, username);
+            parameters.put(SessionParameter.PASSWORD, password);
+            break;
+        case NTLM:
+            parameters.put(SessionParameter.USER, username);
+            parameters.put(SessionParameter.PASSWORD, password);
+            parameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS,
+                    CmisBindingFactory.NTLM_AUTHENTICATION_PROVIDER);
+            break;
+        }
+
+        // get additional workbench properties from system properties
+        Properties sysProps = System.getProperties();
+        for (String key : sysProps.stringPropertyNames()) {
+            if (key.startsWith(WORKBENCH_PREFIX)) {
+                parameters.put(key, sysProps.getProperty(key));
+            }
+        }
+
+        connect(parameters);
+    }
+
+    public ClientSession(Map<String, String> sessionParameters) {
+        if (sessionParameters == null) {
+            throw new IllegalArgumentException("Parameters must not be null!");
+        }
+
+        connect(sessionParameters);
+    }
+
+    private void connect(Map<String, String> sessionParameters) {
+        this.sessionParameters = sessionParameters;
+
+        // set a new dummy authenticator
+        // don't send previous credentials to another server
+        Authenticator.setDefault(new Authenticator() {
+        });
+
+        if (Boolean.parseBoolean(sessionParameters.get(ACCEPT_SELF_SIGNED_CERTIFICATES))) {
+            acceptSelfSignedCertificates();
+        }
+
+        repositories = SessionFactoryImpl.newInstance().getRepositories(sessionParameters);
+    }
+
+    public List<Repository> getRepositories() {
+        return repositories;
+    }
+
+    public Session createSession(int index) {
+        session = repositories.get(index).createSession();
+        createOperationContexts();
+        return getSession();
+    }
+
+    public Session getSession() {
+        return session;
+    }
+
+    public OperationContext getObjectOperationContext() {
+        return objectOperationContext;
+    }
+
+    public OperationContext getFolderOperationContext() {
+        return folderOperationContext;
+    }
+
+    private void createOperationContexts() {
+        // object operation context
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.FILTER, "*");
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_ACLS, "true");
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_ALLOWABLE_ACTIONS, "true");
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_POLICIES, "true");
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_RELATIONSHIPS,
+                IncludeRelationships.BOTH.value());
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.RENDITION_FILTER, "*");
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.ORDER_BY, null);
+        setDefault(OBJECT_PREFIX, sessionParameters, ClientOperationContext.MAX_ITEMS_PER_PAGE, "1000");
+
+        objectOperationContext = new ClientOperationContext(OBJECT_PREFIX, sessionParameters);
+
+        // folder operation context
+        if (!sessionParameters.containsKey(FOLDER_PREFIX + ClientOperationContext.FILTER)) {
+            ObjectType type = session.getTypeDefinition(BaseTypeId.CMIS_DOCUMENT.value());
+
+            StringBuilder filter = new StringBuilder();
+            for (String propId : PROPERTY_SET) {
+                PropertyDefinition<?> propDef = type.getPropertyDefinitions().get(propId);
+                if (propDef != null) {
+                    if (filter.length() > 0) {
+                        filter.append(",");
+                    }
+                    filter.append(propDef.getQueryName());
+                }
+            }
+
+            sessionParameters.put(FOLDER_PREFIX + ClientOperationContext.FILTER, filter.toString());
+        }
+
+        setDefault(FOLDER_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_ACLS, "false");
+        setDefault(FOLDER_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_ALLOWABLE_ACTIONS, "false");
+        setDefault(FOLDER_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_POLICIES, "false");
+        setDefault(FOLDER_PREFIX, sessionParameters, ClientOperationContext.INCLUDE_RELATIONSHIPS,
+                IncludeRelationships.NONE.value());
+        setDefault(FOLDER_PREFIX, sessionParameters, ClientOperationContext.RENDITION_FILTER, "cmis:none");
+        setDefault(FOLDER_PREFIX, sessionParameters, ClientOperationContext.ORDER_BY, null);
+        setDefault(FOLDER_PREFIX, sessionParameters, ClientOperationContext.MAX_ITEMS_PER_PAGE, "1000");
+
+        folderOperationContext = new ClientOperationContext(FOLDER_PREFIX, sessionParameters);
+    }
+
+    private void setDefault(String prefix, Map<String, String> map, String key, String value) {
+        if (!map.containsKey(prefix + key)) {
+            map.put(prefix + key, value);
+        }
+    }
+
+    private void acceptSelfSignedCertificates() {
+        TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
+            public X509Certificate[] getAcceptedIssuers() {
+                return null;
+            }
+
+            public void checkClientTrusted(X509Certificate[] certs, String authType) {
+            }
+
+            public void checkServerTrusted(X509Certificate[] certs, String authType) {
+            }
+        } };
+
+        try {
+            SSLContext sc = SSLContext.getInstance("SSL");
+            sc.init(null, trustAllCerts, new java.security.SecureRandom());
+            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+        } catch (Exception e) {
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/FolderListener.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/FolderListener.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/FolderListener.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/FolderListener.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.workbench.model;
+
+import java.util.EventListener;
+
+public interface FolderListener extends EventListener {
+
+	void folderLoaded(ClientModelEvent event);
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/FolderListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,253 @@
+/*
+ * 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.workbench.model;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MIMETypes {
+
+	private static Map<String, String> EXT2MIME = new HashMap<String, String>();
+
+	static {
+		EXT2MIME.put("", "application/octet-stream");
+		EXT2MIME.put("ai", "application/postscript");
+		EXT2MIME.put("aif", "audio/x-aiff");
+		EXT2MIME.put("aifc", "audio/x-aiff");
+		EXT2MIME.put("aiff", "audio/x-aiff");
+		EXT2MIME.put("asf", "video/x-ms-asf");
+		EXT2MIME.put("asr", "video/x-ms-asf");
+		EXT2MIME.put("asx", "video/x-ms-asf");
+		EXT2MIME.put("au", "audio/basic");
+		EXT2MIME.put("avi", "video/x-msvideo");
+		EXT2MIME.put("axs", "application/olescript");
+		EXT2MIME.put("bas", "text/plain");
+		EXT2MIME.put("bmp", "image/bmp");
+		EXT2MIME.put("c", "text/plain");
+		EXT2MIME.put("cat", "application/vnd.ms-pkiseccat");
+		EXT2MIME.put("cdf", "application/x-cdf");
+		EXT2MIME.put("cer", "application/x-x509-ca-cert");
+		EXT2MIME.put("clp", "application/x-msclip");
+		EXT2MIME.put("cmx", "image/x-cmx");
+		EXT2MIME.put("cod", "image/cis-cod");
+		EXT2MIME.put("cpio", "application/x-cpio");
+		EXT2MIME.put("crd", "application/x-mscardfile");
+		EXT2MIME.put("crl", "application/pkix-crl");
+		EXT2MIME.put("crt", "application/x-x509-ca-cert");
+		EXT2MIME.put("csh", "application/x-csh");
+		EXT2MIME.put("css", "text/css");
+		EXT2MIME.put("dll", "application/x-msdownload");
+		EXT2MIME.put("doc", "application/msword");
+		EXT2MIME
+				.put("docx",
+						"application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+		EXT2MIME
+				.put("doct",
+						"application/vnd.openxmlformats-officedocument.wordprocessingml.template");
+		EXT2MIME.put("dot", "application/msword");
+		EXT2MIME.put("dvi", "application/x-dvi");
+		EXT2MIME.put("dxr", "application/x-director");
+		EXT2MIME.put("eps", "application/postscript");
+		EXT2MIME.put("etx", "text/x-setext");
+		EXT2MIME.put("evy", "application/envoy");
+		EXT2MIME.put("fif", "application/fractals");
+		EXT2MIME.put("flr", "x-world/x-vrml");
+		EXT2MIME.put("gif", "image/gif");
+		EXT2MIME.put("gtar", "application/x-gtar");
+		EXT2MIME.put("gz", "application/x-gzip");
+		EXT2MIME.put("h", "text/plain");
+		EXT2MIME.put("hdf", "application/x-hdf");
+		EXT2MIME.put("hlp", "application/winhlp");
+		EXT2MIME.put("hqx", "application/mac-binhex40");
+		EXT2MIME.put("hta", "application/hta");
+		EXT2MIME.put("htc", "text/x-component");
+		EXT2MIME.put("htm", "text/html");
+		EXT2MIME.put("html", "text/html");
+		EXT2MIME.put("htt", "text/webviewhtml");
+		EXT2MIME.put("ico", "image/x-icon");
+		EXT2MIME.put("ief", "image/ief");
+		EXT2MIME.put("iii", "application/x-iphone");
+		EXT2MIME.put("isp", "application/x-internet-signup");
+		EXT2MIME.put("jfif", "image/pipeg");
+		EXT2MIME.put("jpe", "image/jpeg");
+		EXT2MIME.put("jpeg", "image/jpeg");
+		EXT2MIME.put("jpg", "image/jpeg");
+		EXT2MIME.put("js", "application/x-javascript");
+		EXT2MIME.put("latex", "application/x-latex");
+		EXT2MIME.put("lsf", "video/x-la-asf");
+		EXT2MIME.put("lsx", "video/x-la-asf");
+		EXT2MIME.put("m3u", "audio/x-mpegurl");
+		EXT2MIME.put("man", "application/x-troff-man");
+		EXT2MIME.put("mdb", "application/x-msaccess");
+		EXT2MIME.put("me", "application/x-troff-me");
+		EXT2MIME.put("mhtv", "message/rfc822");
+		EXT2MIME.put("mhtml", "message/rfc822");
+		EXT2MIME.put("mid", "audio/mid");
+		EXT2MIME.put("mov", "video/quicktime");
+		EXT2MIME.put("movie", "video/x-sgi-movie");
+		EXT2MIME.put("mp2", "video/mpeg");
+		EXT2MIME.put("mp3", "audio/mpeg");
+		EXT2MIME.put("mpa", "video/mpeg");
+		EXT2MIME.put("mpe", "video/mpegv");
+		EXT2MIME.put("mpeg", "video/mpeg");
+		EXT2MIME.put("mpg", "video/mpegv");
+		EXT2MIME.put("mpp", "application/vnd.ms-project");
+		EXT2MIME.put("mpv2", "video/mpeg");
+		EXT2MIME.put("ms", "application/x-troff-ms");
+		EXT2MIME.put("mvb", "application/x-msmediaview");
+		EXT2MIME.put("nws", "message/rfc822");
+		EXT2MIME.put("oda", "application/oda");
+		EXT2MIME.put("p10", "application/pkcs10");
+		EXT2MIME.put("p12", "application/x-pkcs12v");
+		EXT2MIME.put("p7b", "application/x-pkcs7-certificates");
+		EXT2MIME.put("p7c", "application/x-pkcs7-mime");
+		EXT2MIME.put("p7m", "application/x-pkcs7-mime");
+		EXT2MIME.put("p7r", "application/x-pkcs7-certreqresp");
+		EXT2MIME.put("p7s", "application/x-pkcs7-signature");
+		EXT2MIME.put("pbm", "image/x-portable-bitmap");
+		EXT2MIME.put("pdf", "application/pdf");
+		EXT2MIME.put("pfx", "application/x-pkcs12");
+		EXT2MIME.put("pgm", "image/x-portable-graymap");
+		EXT2MIME.put("vpko", "application/ynd.ms-pkipko");
+		EXT2MIME.put("pma", "application/x-perfmon");
+		EXT2MIME.put("pmc", "application/x-perfmon");
+		EXT2MIME.put("pml", "application/x-perfmon");
+		EXT2MIME.put("pmr", "application/x-perfmon");
+		EXT2MIME.put("pmw", "application/x-perfmon");
+		EXT2MIME.put("png", "image/png");
+		EXT2MIME.put("pnm", "image/x-portable-anymap");
+		EXT2MIME.put("pot", "application/vnd.ms-powerpoint");
+		EXT2MIME.put("ppm", "image/x-portable-pixmap");
+		EXT2MIME.put("pps", "application/vnd.ms-powerpoint");
+		EXT2MIME.put("ppt", "application/vnd.ms-powerpoint");
+		EXT2MIME
+				.put("pptx",
+						"application/vnd.openxmlformats-officedocument.presentationml.presentation");
+		EXT2MIME
+				.put("ppsx",
+						"application/vnd.openxmlformats-officedocument.presentationml.slideshow");
+		EXT2MIME
+				.put("potx",
+						"application/vnd.openxmlformats-officedocument.presentationml.template");
+		EXT2MIME.put("prf", "application/pics-rules");
+		EXT2MIME.put("ps", "application/postscript");
+		EXT2MIME.put("pub", "application/x-mspublisher");
+		EXT2MIME.put("qt", "video/quicktime");
+		EXT2MIME.put("ra", "audio/x-pn-realaudio");
+		EXT2MIME.put("ram", "audio/x-pn-realaudio");
+		EXT2MIME.put("ras", "image/x-cmu-raster");
+		EXT2MIME.put("rgb", "image/x-rgb");
+		EXT2MIME.put("rmi", "audio/mid");
+		EXT2MIME.put("roff", "application/x-troff");
+		EXT2MIME.put("rtf", "application/rtf");
+		EXT2MIME.put("rtx", "text/richtext");
+		EXT2MIME.put("scd", "application/x-msschedule");
+		EXT2MIME.put("sct", "text/scriptlet");
+		EXT2MIME.put("sh", "application/x-sh");
+		EXT2MIME.put("shar", "application/x-shar");
+		EXT2MIME.put("sit", "application/x-stuffit");
+		EXT2MIME.put("snd", "audio/basic");
+		EXT2MIME.put("spc", "application/x-pkcs7-certificates");
+		EXT2MIME.put("spl", "application/futuresplash");
+		EXT2MIME.put("src", "application/x-wais-source");
+		EXT2MIME.put("sst", "application/vnd.ms-pkicertstore");
+		EXT2MIME.put("stl", "application/vnd.ms-pkistl");
+		EXT2MIME.put("stm", "text/html");
+		EXT2MIME.put("svg", "image/svg+xml");
+		EXT2MIME.put("swf", "application/x-shockwave-flash");
+		EXT2MIME.put("t", "application/x-troff");
+		EXT2MIME.put("tar", "application/x-tar");
+		EXT2MIME.put("tcl", "application/x-tcl");
+		EXT2MIME.put("tex", "application/x-tex");
+		EXT2MIME.put("texi", "application/x-texinfo");
+		EXT2MIME.put("texinfo", "application/x-texinfo");
+		EXT2MIME.put("tgz", "application/x-compressed");
+		EXT2MIME.put("tif", "image/tiff");
+		EXT2MIME.put("tiff", "image/tiff");
+		EXT2MIME.put("tr", "application/x-troff");
+		EXT2MIME.put("trm", "application/x-msterminal");
+		EXT2MIME.put("tsv", "text/tab-separated-values");
+		EXT2MIME.put("txt", "text/plain");
+		EXT2MIME.put("uls", "text/iuls");
+		EXT2MIME.put("ustar", "application/x-ustar");
+		EXT2MIME.put("vcf", "text/x-vcard");
+		EXT2MIME.put("vrml", "x-world/x-vrml");
+		EXT2MIME.put("wav", "audio/x-wav");
+		EXT2MIME.put("wcm", "application/vnd.ms-works");
+		EXT2MIME.put("wdb", "application/vnd.ms-works");
+		EXT2MIME.put("wmf", "application/x-msmetafile");
+		EXT2MIME.put("wps", "application/vnd.ms-works");
+		EXT2MIME.put("wri", "application/x-mswrite");
+		EXT2MIME.put("wrl", "x-world/x-vrml");
+		EXT2MIME.put("wrz", "x-world/x-vrml");
+		EXT2MIME.put("xaf", "x-world/x-vrml");
+		EXT2MIME.put("xbm", "image/x-xbitmap");
+		EXT2MIME.put("xla", "application/vnd.ms-excel");
+		EXT2MIME.put("xlc", "application/vnd.ms-excel");
+		EXT2MIME.put("xlm", "application/vnd.ms-excel");
+		EXT2MIME.put("xls", "application/vnd.ms-excel");
+		EXT2MIME
+				.put("xlsx",
+						"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		EXT2MIME.put("xlt", "application/vnd.ms-excel");
+		EXT2MIME
+				.put("xltx",
+						"application/vnd.openxmlformats-officedocument.spreadsheetml.template");
+		EXT2MIME.put("xlw", "application/vnd.ms-excel");
+		EXT2MIME.put("xml", "text/xml");
+		EXT2MIME.put("xof", "x-world/x-vrml");
+		EXT2MIME.put("xpm", "image/x-xpixmap");
+		EXT2MIME.put("xwd", "image/x-xwindowdump");
+		EXT2MIME.put("z", "application/x-compress");
+		EXT2MIME.put("zip", "application/zip");
+	}
+
+	/**
+	 * Returns the MIME type for file extension.
+	 */
+	public static String getMIMEType(String ext) {
+		if (ext == null) {
+			return EXT2MIME.get("");
+		}
+
+		int x = ext.lastIndexOf('.');
+		if (x > -1) {
+			ext = ext.substring(x + 1);
+		}
+
+		String mime = EXT2MIME.get(ext.toLowerCase());
+		if (mime == null) {
+			mime = EXT2MIME.get("");
+		}
+
+		return mime;
+	}
+
+	/**
+	 * Returns the MIME type for a file.
+	 */
+	public static String getMIMEType(File file) {
+		if (file == null) {
+			return getMIMEType("");
+		}
+
+		return getMIMEType(file.getName());
+	}
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ObjectListener.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ObjectListener.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ObjectListener.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ObjectListener.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.workbench.model;
+
+import java.util.EventListener;
+
+public interface ObjectListener extends EventListener {
+
+	void objectLoaded(ClientModelEvent event);
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ObjectListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,153 @@
+/*
+ * 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.workbench.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.workbench.ClientHelper;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+
+public abstract class ActionPanel extends JPanel implements ActionListener {
+
+	private static final long serialVersionUID = 1L;
+
+	private ClientModel model;
+	private CmisObject object;
+
+	private JPanel centerPanel;
+
+	public ActionPanel(String title, String buttonLabel, ClientModel model) {
+		super();
+		this.model = model;
+		createGUI(title, buttonLabel);
+	}
+
+	public ClientModel getClientModel() {
+		return model;
+	}
+
+	public void setObject(CmisObject object) {
+		this.object = object;
+	}
+
+	public CmisObject getObject() {
+		return object;
+	}
+
+	protected void createGUI(String title, String buttonLabel) {
+		BorderLayout borderLayout = new BorderLayout();
+		borderLayout.setVgap(3);
+		setLayout(borderLayout);
+
+		setBackground(Color.WHITE);
+		setBorder(BorderFactory.createCompoundBorder(BorderFactory
+				.createEmptyBorder(5, 5, 5, 5), BorderFactory
+				.createCompoundBorder(BorderFactory.createLineBorder(
+						Color.GRAY, 2), BorderFactory.createEmptyBorder(5, 5,
+						5, 5))));
+
+		Font labelFont = UIManager.getFont("Label.font");
+		Font boldFont = labelFont.deriveFont(Font.BOLD,
+				labelFont.getSize2D() * 1.2f);
+
+		JLabel titleLabel = new JLabel(title);
+		titleLabel.setFont(boldFont);
+		add(titleLabel, BorderLayout.PAGE_START);
+
+		centerPanel = new JPanel();
+		centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS));
+		centerPanel.setBackground(Color.WHITE);
+		add(centerPanel, BorderLayout.CENTER);
+
+		createActionComponents();
+
+		JButton deleteButton = new JButton(buttonLabel);
+		deleteButton.addActionListener(this);
+		add(deleteButton, BorderLayout.PAGE_END);
+
+		setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height));
+	}
+
+	protected void addActionComponent(JComponent comp) {
+		comp.setAlignmentX(LEFT_ALIGNMENT);
+		centerPanel.add(comp);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		try {
+			setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+			doAction();
+			model.reloadFolder();
+		} catch (Exception ex) {
+			ClientHelper.showError(null, ex);
+		} finally {
+			setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+		}
+	}
+
+	protected abstract void createActionComponents();
+
+	public abstract boolean isAllowed();
+
+	public abstract void doAction() throws Exception;
+
+	protected JPanel createFilenamePanel(final JTextField filenameField) {
+		JPanel filePanel = new JPanel(new BorderLayout());
+		filePanel.setBackground(Color.WHITE);
+
+		filePanel.add(new JLabel("File:"), BorderLayout.LINE_START);
+
+		filePanel.add(filenameField, BorderLayout.CENTER);
+
+		JButton browseButton = new JButton("Browse");
+		browseButton.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent event) {
+				JFileChooser fileChooser = new JFileChooser();
+				int chooseResult = fileChooser.showDialog(filenameField,
+						"Select");
+				if (chooseResult == JFileChooser.APPROVE_OPTION) {
+					if (fileChooser.getSelectedFile().isFile()) {
+						filenameField.setText(fileChooser.getSelectedFile()
+								.getAbsolutePath());
+					}
+				}
+			}
+		});
+		filePanel.add(browseButton, BorderLayout.LINE_END);
+
+		return filePanel;
+	}
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CollectionRenderer.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CollectionRenderer.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CollectionRenderer.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CollectionRenderer.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,78 @@
+/*
+ * 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.workbench.swing;
+
+import java.awt.Component;
+import java.util.Collection;
+import java.util.GregorianCalendar;
+
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import org.apache.chemistry.opencmis.commons.definitions.Choice;
+import org.apache.chemistry.opencmis.workbench.ClientHelper;
+
+public class CollectionRenderer extends DefaultTableCellRenderer {
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
+            int row, int column) {
+        Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+
+        int height = (int) getPreferredSize().getHeight();
+        if (height > (getFontMetrics(getFont()).getHeight() + getInsets().bottom + getInsets().top)) {
+            if (table.getRowHeight(row) != height) {
+                table.setRowHeight(row, height);
+            }
+        }
+
+        return comp;
+    }
+
+    @Override
+    protected void setValue(Object value) {
+        Collection<?> col = (Collection<?>) value;
+
+        if ((col == null) || (col.isEmpty())) {
+            super.setValue("");
+            return;
+        }
+
+        // build string
+        StringBuilder sb = new StringBuilder("<html>");
+        if (col != null) {
+            for (Object o : col) {
+                if (o == null) {
+                    sb.append("<i>null</i>");
+                } else if (o instanceof GregorianCalendar) {
+                    sb.append(ClientHelper.getDateString((GregorianCalendar) o));
+                } else if (o instanceof Choice<?>) {
+                    sb.append(((Choice<?>) o).getValue());
+                } else {
+                    sb.append(o.toString());
+                }
+                sb.append("<br/>");
+            }
+        }
+        sb.append("</html>");
+
+        super.setValue(sb.toString());
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CollectionRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CreateDialog.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CreateDialog.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CreateDialog.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CreateDialog.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,108 @@
+/*
+ * 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.workbench.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+
+public abstract class CreateDialog extends JDialog {
+
+	private static final long serialVersionUID = 1L;
+
+	private ClientModel model;
+	private JPanel panel;
+
+	public CreateDialog(Frame owner, String title, ClientModel model) {
+		super(owner, title, true);
+		this.model = model;
+
+		setLayout(new BorderLayout());
+		panel = new JPanel(new GridBagLayout());
+		panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+		add(panel, BorderLayout.CENTER);
+	}
+
+	protected ClientModel getClientModel() {
+		return model;
+	}
+
+	protected void createRow(String label, JComponent comp, int row) {
+		JLabel textLabel = new JLabel(label);
+		textLabel.setLabelFor(comp);
+
+		GridBagConstraints c = new GridBagConstraints();
+		c.anchor = GridBagConstraints.LINE_START;
+		c.fill = GridBagConstraints.HORIZONTAL;
+		c.gridx = 0;
+		c.gridy = row;
+		panel.add(textLabel, c);
+		c.gridx = 1;
+		panel.add(comp, c);
+	}
+
+	public void showDialog() {
+		panel.invalidate();
+
+		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+		pack();
+		setLocationRelativeTo(null);
+		setVisible(true);
+	}
+
+	protected Object[] getTypes(String rootTypeId) {
+		List<ObjectType> types = model.getCreateableTypes(rootTypeId);
+
+		Object[] result = new Object[types.size()];
+
+		int i = 0;
+		for (final ObjectType type : types) {
+			result[i] = new ObjectTypeItem() {
+				public ObjectType getObjectType() {
+					return type;
+				}
+
+				@Override
+				public String toString() {
+					return type.getDisplayName() + " (" + type.getId() + ")";
+				}
+			};
+
+			i++;
+		}
+
+		return result;
+	}
+
+	public static interface ObjectTypeItem {
+		ObjectType getObjectType();
+	}
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CreateDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/GregorianCalendarRenderer.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/GregorianCalendarRenderer.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/GregorianCalendarRenderer.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/GregorianCalendarRenderer.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,37 @@
+/*
+ * 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.workbench.swing;
+
+import java.util.GregorianCalendar;
+
+import javax.swing.table.DefaultTableCellRenderer;
+
+import org.apache.chemistry.opencmis.workbench.ClientHelper;
+
+public class GregorianCalendarRenderer extends DefaultTableCellRenderer {
+    private static final long serialVersionUID = 1L;
+
+    public GregorianCalendarRenderer() {
+        super();
+    }
+
+    public void setValue(Object value) {
+        setText(ClientHelper.getDateString((GregorianCalendar) value));
+    }
+}
\ No newline at end of file

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/GregorianCalendarRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,130 @@
+/*
+ * 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.workbench.swing;
+
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.BorderFactory;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+
+public abstract class InfoPanel extends JPanel {
+
+	private static final long serialVersionUID = 1L;
+
+	private JPanel gridPanel;
+	private GridBagConstraints gbc;
+	private Font boldFont;
+
+	protected void setupGUI() {
+		setLayout(new FlowLayout(FlowLayout.LEFT));
+		setBackground(Color.WHITE);
+
+		gridPanel = new JPanel(new GridBagLayout());
+		gridPanel.setBackground(Color.WHITE);
+		add(gridPanel);
+
+		gbc = new GridBagConstraints();
+
+		gbc.fill = GridBagConstraints.BOTH;
+		gbc.gridy = 0;
+		gbc.insets = new Insets(3, 3, 3, 3);
+
+		Font labelFont = UIManager.getFont("Label.font");
+		boldFont = labelFont
+				.deriveFont(Font.BOLD, labelFont.getSize2D() * 1.2f);
+	}
+
+	protected JTextField addLine(String label) {
+		return addLine(label, false);
+	}
+
+	protected JTextField addLine(String label, boolean bold) {
+		JTextField textField = new JTextField();
+		textField.setEditable(false);
+		textField.setBorder(BorderFactory.createEmptyBorder());
+		if (bold) {
+			textField.setFont(boldFont);
+		}
+
+		JLabel textLable = new JLabel(label);
+		textLable.setLabelFor(textField);
+		if (bold) {
+			textLable.setFont(boldFont);
+		}
+
+		gbc.gridy++;
+
+		gbc.gridx = 0;
+		gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
+		gridPanel.add(textLable, gbc);
+
+		gbc.gridx = 1;
+		gbc.anchor = GridBagConstraints.BASELINE_LEADING;
+		gridPanel.add(textField, gbc);
+
+		return textField;
+	}
+
+	protected JCheckBox addCheckBox(String label) {
+		JCheckBox checkBox = new JCheckBox();
+		checkBox.setEnabled(false);
+
+		JLabel textLable = new JLabel(label);
+		textLable.setLabelFor(checkBox);
+
+		gbc.gridy++;
+
+		gbc.gridx = 0;
+		gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
+		gridPanel.add(textLable, gbc);
+
+		gbc.gridx = 1;
+		gbc.anchor = GridBagConstraints.BASELINE_LEADING;
+		gridPanel.add(checkBox, gbc);
+
+		return checkBox;
+	}
+
+	protected <T extends JComponent> T addComponent(String label, T comp) {
+		JLabel textLable = new JLabel(label);
+		textLable.setLabelFor(comp);
+
+		gbc.gridy++;
+
+		gbc.gridx = 0;
+		gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
+		gridPanel.add(textLable, gbc);
+
+		gbc.gridx = 1;
+		gbc.anchor = GridBagConstraints.BASELINE_LEADING;
+		gridPanel.add(comp, gbc);
+
+		return comp;
+	}
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/jnlp/template.vm
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/jnlp/template.vm?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/jnlp/template.vm (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/jnlp/template.vm Wed Oct  6 12:32:23 2010
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.5+" codebase="!server!">
+  <information>
+    <title>$project.Name</title>
+    <vendor>$project.Organization.Name</vendor>
+    <homepage href="http://incubator.apache.org/chemistry/opencmis.html"/>
+    <description>$project.Description</description>
+    <offline-allowed/>
+    <update check="timeout" policy="prompt-update"/>
+  </information>
+  <security>
+     <all-permissions/>
+  </security>
+  <resources>
+    <j2se version="1.6+" initial-heap-size="64m" max-heap-size="256m"/>
+     $dependencies
+    <property name="cmis.workbench.url" value="!repository!"/>  
+    <property name="cmis.workbench.user" value="!user!"/>  
+    <property name="cmis.workbench.password" value="!password!"/>
+    <property name="cmis.workbench.binding" value="!binding!"/>
+  </resources>
+  <application-desc main-class="$mainClass"/>
+</jnlp>
+

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/jnlp/template.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README Wed Oct  6 12:32:23 2010
@@ -0,0 +1,47 @@
+CMIS Workbench
+
+This is a simple Content Management Interoperability Services (CMIS) client based on Swing and 
+Apache Chemistry OpenCMIS (http://incubator.apache.org/chemistry/opencmis.html).
+
+This CMIS client is distributed under the Apache License, version 2.0.
+Please see the NOTICE and LICENSE files for details.
+
+
+
+System properties reference
+---------------------------
+
+Login dialog:
+
+cmis.workbench.url            - preset URL
+cmis.workbench.user           - preset user name
+cmis.workbench.password       - preset password
+cmis.workbench.binding        - preset binding (atompub/webservices)
+cmis.workbench.authentication - preset authentication method (none/standard/ntlm)
+
+
+Folder operation context:
+
+cmis.workbench.folder.filter
+cmis.workbench.folder.includeAcls
+cmis.workbench.folder.includeAllowableActions
+cmis.workbench.folder.includePolicies
+cmis.workbench.folder.includeRelationships
+cmis.workbench.folder.renditionFilter
+cmis.workbench.folder.orderBy
+cmis.workbench.folder.maxItemsPerPage
+
+
+Object operation context:
+
+cmis.workbench.object.filter
+cmis.workbench.object.includeAcls
+cmis.workbench.object.includeAllowableActions
+cmis.workbench.object.includePolicies
+cmis.workbench.object.includeRelationships
+cmis.workbench.object.renditionFilter
+
+
+Others:
+
+cmis.workbench.acceptSelfSignedCertificates - disable SSL certificate check (true/false)
\ No newline at end of file

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/changelog.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/changelog.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/changelog.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/connect.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/connect.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/connect.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/console.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/console.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/console.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/document.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/document.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/document.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/folder.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/folder.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/folder.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/icon.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/icon.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/icon.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/info.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/info.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/info.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/log.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/log.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/log.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newdocument.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newdocument.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newdocument.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newfolder.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newfolder.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newfolder.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/policy.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/policy.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/policy.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/query.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/query.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/query.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/relationship.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/relationship.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/relationship.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/repository-info.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/repository-info.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/repository-info.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/types.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/types.png?rev=1005006&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/types.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties Wed Oct  6 12:32:23 2010
@@ -0,0 +1,20 @@
+# 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.
+
+log4j.rootLogger=info, logframe
+
+log4j.appender.logframe = org.apache.chemistry.opencmis.workbench.ClientWriterAppender
+log4j.appender.logframe.layout = org.apache.log4j.EnhancedPatternLayout
+log4j.appender.logframe.layout.ConversionPattern = > %d{HH:mm:ss} %5.5p %40.40c: %m%n%throwable{15}
\ No newline at end of file

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/CMIS.groovy
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/CMIS.groovy?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/CMIS.groovy (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/CMIS.groovy Wed Oct  6 12:32:23 2010
@@ -0,0 +1,148 @@
+/*
+ * 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 scripts
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.apache.chemistry.opencmis.commons.*
+import org.apache.chemistry.opencmis.commons.data.*
+import org.apache.chemistry.opencmis.commons.enums.*
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
+import org.apache.chemistry.opencmis.client.api.*
+
+class CMIS {
+    
+    Session session
+    
+    CMIS(Session session) {
+        this.session = session
+    }
+    
+    CmisObject getObject(id) {
+        CmisObject result = null
+        
+        if(id instanceof CmisObject) {
+            result = id
+        } else if(id instanceof ObjectId) {
+            result = session.getObject(id)
+        } else if(id instanceof String) {
+            if(id.startsWith("/")) {
+                result = session.getObjectByPath(id)
+            } else {
+                result = session.getObject(session.createObjectId(id))
+            }
+        }
+        
+        if(result == null) {
+            throw new Exception("Object not found!")
+        }
+        
+        return result
+    }
+    
+    Folder getFolder(id) {
+        CmisObject folder = getObject(id)
+        if(!(folder instanceof Folder)) {
+            throw new Exception("Object is not a folder!")
+        }
+        
+        return folder
+    }
+    
+    Document getDocument(id) {
+        CmisObject doc = getObject(id)
+        if(!(doc instanceof Document)) {
+            throw new Exception("Object is not a document!")
+        }
+        
+        return doc
+    }
+    
+    void printProperties(id) {
+        CmisObject object = getObject(id)
+        
+        for(Property prop: object.getProperties()) {
+            printProperty(prop)
+        }
+    }
+    
+    void printProperty(Property prop) {
+        println prop.getId() + ": " + prop.getValuesAsString()
+    }
+    
+    void download(id, destination) {
+        Document doc = getDocument(id)
+        
+        def file = new FileOutputStream(destination)
+        def out = new BufferedOutputStream(file)
+        out << doc.contentStream.stream
+        out.close()
+    }
+    
+    Folder createFolder(parent, String name, String type = "cmis:folder") {        
+        CmisObject parentFolder = getFolder(parent)
+        
+        def properties = [
+                    (PropertyIds.OBJECT_TYPE_ID): type, 
+                    (PropertyIds.NAME): name
+                ]
+        
+        return parentFolder.createFolder(properties, session.getDefaultContext())
+    }
+    
+    Document createTextDocument(parent, String name, String content, String type = "cmis:document", 
+    VersioningState versioningState = VersioningState.MAJOR) {        
+        CmisObject parentFolder = getFolder(parent)
+        
+        def properties = [
+                    (PropertyIds.OBJECT_TYPE_ID): type,
+                    (PropertyIds.NAME): name
+                ]
+        
+        def stream = new ByteArrayInputStream(content.bytes)
+        def contentStream = new ContentStreamImpl(name, content.bytes.length, "text/plain", stream)
+        
+        return parentFolder.createDocument(properties, contentStream, 
+        versioningState, session.getDefaultContext())
+    }
+    
+    Document createDocumentFromFile(parent, File file, String type = "cmis:document", 
+    VersioningState versioningState = VersioningState.MAJOR) {
+        CmisObject parentFolder = getFolder(parent)
+        
+        def name = file.getName()
+        def mimetype = org.apache.chemistry.opencmis.workbench.model.MIMETypes.getMIMEType(file)
+        
+        def properties = [
+                    (PropertyIds.OBJECT_TYPE_ID): type,
+                    (PropertyIds.NAME): name
+                ]
+        
+        def contentStream = new ContentStreamImpl(name, file.size(), mimetype, new FileInputStream(file))
+        
+        return parentFolder.createDocument(properties, contentStream,
+        versioningState, session.getDefaultContext())
+    }
+    
+    void delete(id) {
+        getObject(id).delete(true)
+    }
+}
\ No newline at end of file

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/counttypes.groovy
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/counttypes.groovy?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/counttypes.groovy (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/counttypes.groovy Wed Oct  6 12:32:23 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+import org.apache.chemistry.opencmis.commons.*
+import org.apache.chemistry.opencmis.commons.data.*
+import org.apache.chemistry.opencmis.commons.enums.*
+import org.apache.chemistry.opencmis.commons.exceptions.*
+import org.apache.chemistry.opencmis.client.api.*
+
+println "'cmis:document' and subtypes:     " + countTypes("cmis:document")
+println "'cmis:folder' and subtypes:       " + countTypes("cmis:folder")
+println "'cmis:relationship' and subtypes: " + countTypes("cmis:relationship")
+println "'cmis:policy' and subtypes:       " + countTypes("cmis:policy")
+
+
+
+int countTypes(String typeId) {
+    def counter = 0
+
+    try {
+        session.getTypeDescendants(typeId, -1, false).each { counter += 1 + count(it) }
+    }
+    catch(CmisBaseException e) { }
+    
+    return counter
+}
+
+int count(Tree tree) {
+    def counter = 0
+    tree.children.each { counter += 1 + count(it) }
+    
+    return counter
+}
\ No newline at end of file

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/getdescendants.groovy
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/getdescendants.groovy?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/getdescendants.groovy (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/getdescendants.groovy Wed Oct  6 12:32:23 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+import org.apache.chemistry.opencmis.client.api.*
+
+session.rootFolder.getDescendants(-1).each {
+    printTree(it, 0)
+}
+
+def printTree(Tree tree, int depth) {
+    for(i in 0..depth) { print "  " }
+
+    println tree.item.name
+    
+    if(tree.children.size > 0) {
+        tree.children.each {
+            printTree(it, depth + 1)
+        }
+    }
+}
\ No newline at end of file

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/query.groovy
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/query.groovy?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/query.groovy (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/query.groovy Wed Oct  6 12:32:23 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+import org.apache.chemistry.opencmis.commons.*
+import org.apache.chemistry.opencmis.commons.data.*
+import org.apache.chemistry.opencmis.commons.enums.*
+import org.apache.chemistry.opencmis.client.api.*
+
+String cql = "SELECT cmis:objectId, cmis:name, cmis:contentStreamLength FROM cmis:document"
+
+ItemIterable<QueryResult> results = session.query(cql, false)
+
+//ItemIterable<QueryResult> results = session.query(cql, false).getPage(10)
+//ItemIterable<QueryResult> results = session.query(cql, false).skipTo(10).getPage(10)
+
+results.each { hit ->  
+    hit.properties.each { println "${it.queryName}: ${it.firstValue}" }
+    println "--------------------------------------"
+}
+
+println "--------------------------------------"    
+println "Total number: ${results.totalNumItems}"
+println "Has more: ${results.hasMoreItems}" 
+println "--------------------------------------"
\ No newline at end of file

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties Wed Oct  6 12:32:23 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.
+#
+#
+
+#
+# Add more scripts here.
+# key = script file, value = title
+#
+
+startup.groovy = - Demo -
+template.groovy = - Basic template -
+
+getdescendants.groovy = Print descendants tree
+query.groovy = Execute a query
+counttypes.groovy = Count types and sub types
+upload.groovy = Upload a local folder to the repository

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/startup.groovy
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/startup.groovy?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/startup.groovy (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/startup.groovy Wed Oct  6 12:32:23 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+import org.apache.chemistry.opencmis.commons.*
+import org.apache.chemistry.opencmis.commons.data.*
+import org.apache.chemistry.opencmis.commons.enums.*
+import org.apache.chemistry.opencmis.client.api.*
+
+// variable 'session' is bound to the current OpenCMIS session
+
+// print the repository name - Java style
+println "Repository: " + session.getRepositoryInfo().getName()
+
+// print the repository name - Groovy style
+println "Repository: " + session.repositoryInfo.name
+
+
+// get root folder
+Folder root = session.getRootFolder()
+println "--- Root Folder: " + root.getName() + " ---"
+
+// print root folder children
+for(CmisObject object: root.getChildren()) { 
+    println object.getName() + " \t(" + object.getType().getId() + ")"
+}
+
+// run a quick query
+for(QueryResult hit: session.query("SELECT * FROM cmis:document", false)) {     
+     hit.properties.each{ println it.queryName + ": " + it.firstValue }
+     println "----------------------------------"
+ }
+
+// CMIS helper script
+def cmis = new scripts.CMIS(session)
+
+cmis.printProperties "/"                    // access by path
+cmis.printProperties session.rootFolder.id  // access by id
+cmis.printProperties session.rootFolder     // access by object
+
+// Folder folder = cmis.createFolder("/", "test-folder", "cmis:folder")
+
+// Document doc = cmis.createTextDocument(folder, "test.txt", "Hello World!", "cmis:document")
+// cmis.printProperties doc
+// cmis.download(doc, "/some/path/helloWorld.txt")
+// cmis.delete doc.id
+
+// cmis.delete folder
+
+
+// see /scripts/CMIS.groovy for more methods
\ No newline at end of file

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy Wed Oct  6 12:32:23 2010
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+import org.apache.chemistry.opencmis.commons.*
+import org.apache.chemistry.opencmis.commons.data.*
+import org.apache.chemistry.opencmis.commons.enums.*
+import org.apache.chemistry.opencmis.client.api.*
+
+// def cmis = new scripts.CMIS(session)
+// println session.repositoryInfo.name
\ No newline at end of file

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/upload.groovy
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/upload.groovy?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/upload.groovy (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/upload.groovy Wed Oct  6 12:32:23 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+import org.apache.chemistry.opencmis.commons.*
+import org.apache.chemistry.opencmis.commons.data.*
+import org.apache.chemistry.opencmis.commons.enums.*
+import org.apache.chemistry.opencmis.client.api.*
+
+CMIS cmis = new scripts.CMIS(session)
+
+// destination folder
+Folder destFolder = cmis.getFolder("/")
+
+// source folder
+String localPath = "/some/local/folder"
+
+// upload folder tree
+upload(destFolder, localPath)
+
+
+//--------------------------------------------------
+
+def upload(destination, String localPath, 
+String folderType = "cmis:folder",
+String documentType = "cmis:document",
+VersioningState versioningState = VersioningState.MAJOR) {
+    
+    println "Uploading...\n"   
+    doUpload(destination, new File(localPath), folderType, documentType, versioningState)
+    println "\n...done."
+}
+
+def doUpload(Folder parent, File folder, String folderType, String documentType, VersioningState versioningState) {
+    folder.eachFile {
+        println it.getName()
+        
+        if(it.isFile()) {
+            cmis.createDocumentFromFile(parent, it, documentType, versioningState)
+        }
+        else if(it.isDirectory()) {
+            Folder newFolder = cmis.createFolder(parent, it.getName(), folderType)
+            doUpload(newFolder, it, folderType, documentType, versioningState)
+        }
+    }
+}



Mime
View raw message