chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1802391 - in /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main: java/org/apache/chemistry/opencmis/workbench/ resources/scripts/ resources/snippets/
Date Wed, 19 Jul 2017 13:25:08 GMT
Author: fmui
Date: Wed Jul 19 13:25:08 2017
New Revision: 1802391

URL: http://svn.apache.org/viewvc?rev=1802391&view=rev
Log:
Workbench: small improvments

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/get-type-definition.groovy
  (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-file-document.groovy
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-folder.groovy
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-text-document.groovy
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/getchildren.groovy
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/snippet-library.properties
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/update-properties.groovy

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
Wed Jul 19 13:25:08 2017
@@ -20,6 +20,8 @@ package org.apache.chemistry.opencmis.wo
 
 import java.awt.Container;
 import java.awt.Dimension;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
 import java.util.Locale;
 import java.util.Map;
 
@@ -172,7 +174,7 @@ public class BasicLoginTab extends Abstr
         boolean cert = (System.getProperty(SYSPROP_AUTHENTICATION, "").toLowerCase(Locale.ENGLISH).equals("cert"));
         boolean none = !standard && !ntlm && !oauth && !cert;
         authenticationNoneButton = new JRadioButton("None", none);
-        authenticationStandardButton = new JRadioButton("Standard", standard);
+        authenticationStandardButton = new JRadioButton("Standard (basic auth)", standard);
         authenticationNTLMButton = new JRadioButton("NTLM", ntlm);
         authenticationOAuthButton = new JRadioButton("OAuth 2.0 (Bearer Token)", oauth);
         authenticationCertButton = new JRadioButton("Client Certificate", cert);
@@ -195,11 +197,47 @@ public class BasicLoginTab extends Abstr
 
         pane.add(authenticatioLabel);
         pane.add(createHelp("<html>Select the authentication method.<br>"
+                + "Choose <b>None</b> for anonymous access to the repository.<br>"
                 + "The <b>Standard authentication</b> is Basic Auth and should
work with most repositories.<br>"
                 + "The <b>NTLM authentication</b> should be used with caution!
It's very likely that some CMIS operations will fail.<br>"
                 + "The <b>OAuth authentication</b> requires a bearer token in
the username field. The token will not be refreshed when it expires. "
                 + "Use the OAuthAuthenticationProvider for full OAuth support.<br>"
                 + "The <b>Client Certificate authentication</b> requires a JKS
key file path the username field and the passphrase in the password field."));
+
+        authenticationNoneButton.addItemListener(new ItemListener() {
+            @Override
+            public void itemStateChanged(ItemEvent e) {
+                if (e.getStateChange() == ItemEvent.SELECTED) {
+                    usernameField.setEnabled(false);
+                    passwordField.setEnabled(false);
+                }
+            }
+        });
+
+        ItemListener EnableBothListener = new ItemListener() {
+            @Override
+            public void itemStateChanged(ItemEvent e) {
+                if (e.getStateChange() == ItemEvent.SELECTED) {
+                    usernameField.setEnabled(true);
+                    passwordField.setEnabled(true);
+                }
+            }
+        };
+
+        authenticationStandardButton.addItemListener(EnableBothListener);
+        authenticationNTLMButton.addItemListener(EnableBothListener);
+        authenticationCertButton.addItemListener(EnableBothListener);
+
+        authenticationOAuthButton.addItemListener(new ItemListener() {
+            @Override
+            public void itemStateChanged(ItemEvent e) {
+                if (e.getStateChange() == ItemEvent.SELECTED) {
+                    usernameField.setEnabled(true);
+                    passwordField.setEnabled(false);
+                }
+            }
+        });
+
         pane.add(authenticationContainer);
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
Wed Jul 19 13:25:08 2017
@@ -27,6 +27,7 @@ import java.awt.datatransfer.Clipboard;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.io.File;
@@ -113,12 +114,14 @@ public class ConsoleHelper {
 
             // add menu
             JMenu cmisMenu = new JMenu("CMIS");
+            cmisMenu.setMnemonic(KeyEvent.VK_M);
             console.getFrame().getRootPane().getJMenuBar().add(cmisMenu);
 
             addConsoleMenu(cmisMenu, "CMIS 1.0 Specification",
                     new URI("https://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
             addConsoleMenu(cmisMenu, "CMIS 1.1 Specification",
                     new URI("https://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html"));
+            cmisMenu.addSeparator();
             addConsoleMenu(cmisMenu, "OpenCMIS Documentation",
                     new URI("https://chemistry.apache.org/java/opencmis.html"));
             addConsoleMenu(cmisMenu, "OpenCMIS Code Samples",
@@ -141,6 +144,18 @@ public class ConsoleHelper {
             });
             cmisMenu.add(menuItem);
 
+            JMenu snippetsMenu = new JMenu("Snippets");
+            snippetsMenu.setMnemonic(KeyEvent.VK_N);
+            console.getFrame().getRootPane().getJMenuBar().add(snippetsMenu);
+
+            for (FileEntry entry : readSnippetLibrary()) {
+                String snippet = ClientHelper.readFileAndRemoveHeader(entry.getFile());
+
+                JMenuItem snippetItem = new JMenuItem(entry.getName());
+                snippetItem.addActionListener(new ConsoleInsertActionListener(console, snippet));
+                snippetsMenu.add(snippetItem);
+            }
+
             // add popup menu
 
             final JPopupMenu popup = new JPopupMenu();
@@ -157,19 +172,6 @@ public class ConsoleHelper {
             pasteItem.setText("Paste");
             popup.add(pasteItem);
 
-            popup.addSeparator();
-
-            JMenu snippetsSubMenu = new JMenu("Snippets");
-            popup.add(snippetsSubMenu);
-
-            for (FileEntry entry : readSnippetLibrary()) {
-                String snippet = ClientHelper.readFileAndRemoveHeader(entry.getFile());
-
-                JMenuItem snippetItem = new JMenuItem(entry.getName());
-                snippetItem.addActionListener(new ConsolePopupMenuActionListener(console,
snippet));
-                snippetsSubMenu.add(snippetItem);
-            }
-
             console.getInputArea().addMouseListener(new MouseAdapter() {
                 @Override
                 public void mouseClicked(MouseEvent e) {
@@ -323,11 +325,11 @@ public class ConsoleHelper {
 
     // ---
 
-    private static class ConsolePopupMenuActionListener implements ActionListener {
+    private static class ConsoleInsertActionListener implements ActionListener {
         private final Console console;
         private final String snippet;
 
-        public ConsolePopupMenuActionListener(Console console, String snippet) {
+        public ConsoleInsertActionListener(Console console, String snippet) {
             this.console = console;
             this.snippet = snippet;
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy
Wed Jul 19 13:25:08 2017
@@ -23,6 +23,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.client.api.*
 import org.apache.chemistry.opencmis.client.util.*
 
-// def cmis = new scripts.CMIS(session)
 // println session.repositoryInfo.name
-// cmis.printObjectSummary "/"
\ No newline at end of file
+//
+// def rootFolder = session.rootFolder
+// println rootFolder.name
+// 
+// rootFolder.getChildren().each { child ->
+//    println "${child.name} (${child.id}) [${child.type.id}]"
+// }
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-file-document.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-file-document.groovy?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-file-document.groovy
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-file-document.groovy
Wed Jul 19 13:25:08 2017
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-Folder parentFolder = ...
-File file = ...
+Folder parentFolder = ...  // session.getObjectByPath("/")
+File file = ...  // new File("/path/to/file") 
 
 def properties = [
     (PropertyIds.OBJECT_TYPE_ID): "cmis:document",

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-folder.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-folder.groovy?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-folder.groovy
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-folder.groovy
Wed Jul 19 13:25:08 2017
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-Folder parentFolder = ...
+Folder parentFolder = ...  // session.getObjectByPath("/")
 String name = "new folder"
 
 def properties = [

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-text-document.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-text-document.groovy?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-text-document.groovy
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/create-text-document.groovy
Wed Jul 19 13:25:08 2017
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-Folder parentFolder = ...
+Folder parentFolder = ...  // session.getObjectByPath("/")
 String name = "document.txt"
 String content = "content"
 

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/get-type-definition.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/get-type-definition.groovy?rev=1802391&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/get-type-definition.groovy
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/get-type-definition.groovy
Wed Jul 19 13:25:08 2017
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+ObjectType type = session.getTypeDefinition("cmis:document", true)
+
+println "${type.id}: ${type.displayName}"
+println "----------------------------------"
+
+type.propertyDefinitions.each { propDefEntry ->
+   println "  ${propDefEntry.value.id} [${propDefEntry.value.propertyType.value}]: ${propDefEntry.value.displayName}"
+}
\ No newline at end of file

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/get-type-definition.groovy
------------------------------------------------------------------------------
    svn:eol-style = LF

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/getchildren.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/getchildren.groovy?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/getchildren.groovy
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/getchildren.groovy
Wed Jul 19 13:25:08 2017
@@ -17,7 +17,7 @@
  * under the License.
  */
  
-Folder folder = ...
+Folder folder = ...  // session.getObjectByPath("/")
 OperationContext ctxt = OperationContextUtils.createMaximumOperationContext()
 
 folder.getChildren(ctxt).each { child ->

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/snippet-library.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/snippet-library.properties?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/snippet-library.properties
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/snippet-library.properties
Wed Jul 19 13:25:08 2017
@@ -24,10 +24,11 @@
 # key = snippet file, value = title
 #
 
-create-folder.groovy = create folder
-create-text-document.groovy = create document (text)
-create-file-document.groovy = create document (file)
-update-properties.groovy = update properties
-getchildren.groovy = get children
-query.groovy = query
-get-full-object.groovy = get full object
\ No newline at end of file
+create-folder.groovy = Create folder
+create-text-document.groovy = Create document (text)
+create-file-document.groovy = Create document (file)
+update-properties.groovy = Update properties
+getchildren.groovy = Get children
+query.groovy = Query
+get-full-object.groovy = Get full object
+get-type-definition.groovy = Get a type definition
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/update-properties.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/update-properties.groovy?rev=1802391&r1=1802390&r2=1802391&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/update-properties.groovy
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/snippets/update-properties.groovy
Wed Jul 19 13:25:08 2017
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-CmisObject cmisObject = ...
+CmisObject cmisObject = ... // session.getObject("...");
 
 def properties = [
     (PropertyIds.NAME): "new name"



Mime
View raw message