You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/10/06 14:32:26 UTC

svn commit: r1005006 [2/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...

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.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/FolderTable.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,340 @@
+/*
+ * 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;
+
+import java.awt.Cursor;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.DropMode;
+import javax.swing.ImageIcon;
+import javax.swing.JComponent;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.TransferHandler;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.model.ClientModelEvent;
+import org.apache.chemistry.opencmis.workbench.model.FolderListener;
+import org.apache.chemistry.opencmis.workbench.swing.GregorianCalendarRenderer;
+
+public class FolderTable extends JTable implements FolderListener {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String[] COLUMN_NAMES = { "", "Name", "Type", "Content Type", "Size", "Creation Date",
+            "Created by", "Modification Date", "Modified by", "Id" };
+    private static final int[] COLUMN_WIDTHS = { 24, 200, 150, 150, 80, 180, 100, 180, 100, 300 };
+    private static final int ID_COLUMN = 9;
+
+    private ClientModel model;
+
+    private Map<BaseTypeId, ImageIcon> icons;
+
+    public FolderTable(final ClientModel model) {
+        super();
+
+        this.model = model;
+
+        setModel(new FolderTableModel());
+
+        setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        setAutoResizeMode(AUTO_RESIZE_OFF);
+        setAutoCreateRowSorter(true);
+
+        setDefaultRenderer(GregorianCalendar.class, new GregorianCalendarRenderer());
+        setTransferHandler(new FolderTransferHandler());
+        setDragEnabled(true);
+        setDropMode(DropMode.INSERT);
+
+        for (int i = 0; i < COLUMN_WIDTHS.length; i++) {
+            TableColumn column = getColumnModel().getColumn(i);
+            column.setPreferredWidth(COLUMN_WIDTHS[i]);
+        }
+
+        getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+            public void valueChanged(ListSelectionEvent e) {
+                if (e.getValueIsAdjusting()) {
+                    return;
+                }
+
+                int row = getSelectedRow();
+                if (row > -1) {
+                    String id = getValueAt(row, ID_COLUMN).toString();
+
+                    try {
+                        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+                        model.loadObject(id);
+                    } catch (Exception ex) {
+                        ClientHelper.showError(null, ex);
+                        return;
+                    } finally {
+                        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+                    }
+                }
+            }
+        });
+
+        addMouseListener(new MouseAdapter() {
+            public void mouseClicked(MouseEvent e) {
+                if (e.getClickCount() == 2) {
+                    doAction(e.isShiftDown());
+                }
+            }
+        });
+
+        addKeyListener(new KeyListener() {
+            public void keyTyped(KeyEvent e) {
+            }
+
+            public void keyReleased(KeyEvent e) {
+                if (e.getKeyCode() == KeyEvent.VK_SPACE) {
+                    doAction(e.isShiftDown());
+                }
+            }
+
+            public void keyPressed(KeyEvent e) {
+            }
+        });
+
+        loadIcons();
+    }
+
+    private void loadIcons() {
+        icons = new HashMap<BaseTypeId, ImageIcon>();
+        icons.put(BaseTypeId.CMIS_DOCUMENT, ClientHelper.getIcon("document.png"));
+        icons.put(BaseTypeId.CMIS_FOLDER, ClientHelper.getIcon("folder.png"));
+        icons.put(BaseTypeId.CMIS_RELATIONSHIP, ClientHelper.getIcon("relationship.png"));
+        icons.put(BaseTypeId.CMIS_POLICY, ClientHelper.getIcon("policy.png"));
+    }
+
+    public void folderLoaded(ClientModelEvent event) {
+        event.getClientModel().getCurrentChildren();
+
+        ((FolderTableModel) getModel()).fireTableDataChanged();
+    }
+
+    private void doAction(boolean alternate) {
+        int row = getSelectedRow();
+        if ((row > -1) && (row < model.getCurrentChildren().size())) {
+            String id = getValueAt(row, ID_COLUMN).toString();
+            CmisObject object = model.getFromCurrentChildren(id);
+
+            if (object instanceof Document) {
+                if (alternate) {
+                    ClientHelper.download(this.getParent(), (Document) object, null);
+                } else {
+                    ClientHelper.open(this.getParent(), (Document) object, null);
+                }
+            } else if (object instanceof Folder) {
+                try {
+                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+                    model.loadFolder(object.getId(), false);
+                } catch (Exception ex) {
+                    ClientHelper.showError(null, ex);
+                    return;
+                } finally {
+                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+                }
+            }
+        }
+    }
+
+    class FolderTableModel extends AbstractTableModel {
+
+        private static final long serialVersionUID = 1L;
+
+        public String getColumnName(int columnIndex) {
+            return COLUMN_NAMES[columnIndex];
+        }
+
+        public int getColumnCount() {
+            return COLUMN_NAMES.length;
+        }
+
+        public int getRowCount() {
+            return model.getCurrentChildren().size();
+        }
+
+        public Object getValueAt(int rowIndex, int columnIndex) {
+            CmisObject obj = model.getCurrentChildren().get(rowIndex);
+
+            switch (columnIndex) {
+            case 0:
+                return icons.get(obj.getBaseTypeId());
+            case 1:
+                return obj.getName();
+            case 2:
+                return obj.getType().getId();
+            case 3:
+                if (obj instanceof Document) {
+                    return ((Document) obj).getContentStreamMimeType();
+                } else {
+                    return null;
+                }
+            case 4:
+                if (obj instanceof Document) {
+                    return ((Document) obj).getContentStreamLength();
+                } else {
+                    return null;
+                }
+            case 5:
+                return obj.getCreationDate();
+            case 6:
+                return obj.getCreatedBy();
+            case 7:
+                return obj.getLastModificationDate();
+            case 8:
+                return obj.getLastModifiedBy();
+            case ID_COLUMN:
+                return obj.getId();
+            }
+
+            return "";
+        }
+
+        @Override
+        public Class<?> getColumnClass(int columnIndex) {
+            switch (columnIndex) {
+            case 0:
+                return ImageIcon.class;
+            case 4:
+                return Long.class;
+            case 5:
+            case 7:
+                return GregorianCalendar.class;
+            }
+
+            return String.class;
+        }
+    }
+
+    class FolderTransferHandler extends TransferHandler {
+
+        private static final long serialVersionUID = 1L;
+
+        public FolderTransferHandler() {
+            super();
+        }
+
+        @Override
+        public boolean canImport(TransferSupport support) {
+            if (!support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
+                return false;
+            }
+
+            if (!support.isDrop()) {
+                return false;
+            }
+
+            return true;
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean importData(TransferSupport support) {
+            if (!canImport(support)) {
+                return false;
+            }
+
+            File file = null;
+            try {
+                List<File> fileList = (List<File>) support.getTransferable().getTransferData(
+                        DataFlavor.javaFileListFlavor);
+
+                if ((fileList == null) || (fileList.size() != 1) || (fileList.get(0) == null)
+                        || !fileList.get(0).isFile()) {
+                    return false;
+                }
+
+                file = fileList.get(0);
+            } catch (Exception ex) {
+                ClientHelper.showError(null, ex);
+                return false;
+            }
+
+            new CreateDocumentDialog(null, model, file);
+
+            return true;
+        }
+
+        @Override
+        public int getSourceActions(JComponent c) {
+            return COPY;
+        }
+
+        @Override
+        protected Transferable createTransferable(JComponent c) {
+            int row = getSelectedRow();
+            if ((row > -1) && (row < model.getCurrentChildren().size())) {
+                String id = getValueAt(row, ID_COLUMN).toString();
+                CmisObject object = model.getFromCurrentChildren(id);
+
+                if (object instanceof Document) {
+                    Document doc = (Document) object;
+
+                    File tempFile = null;
+                    try {
+                        tempFile = ClientHelper.createTempFileFromDocument(doc, null);
+                    } catch (Exception e) {
+                        ClientHelper.showError(null, e);
+                    }
+
+                    final File tempTransFile = tempFile;
+
+                    return new Transferable() {
+                        public boolean isDataFlavorSupported(DataFlavor flavor) {
+                            return flavor == DataFlavor.javaFileListFlavor;
+                        }
+
+                        public DataFlavor[] getTransferDataFlavors() {
+                            return new DataFlavor[] { DataFlavor.javaFileListFlavor };
+                        }
+
+                        public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+                            return (List<File>) Collections.singletonList(tempTransFile);
+                        }
+                    };
+                }
+            }
+
+            return null;
+        }
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.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/InfoDialog.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,118 @@
+/*
+ * 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;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.UIManager;
+
+public class InfoDialog extends JDialog {
+
+    private static final long serialVersionUID = 1L;
+
+    public InfoDialog(Frame owner) {
+        super(owner, "Info", true);
+        createGUI();
+    }
+
+    private void createGUI() {
+        setPreferredSize(new Dimension(800, 500));
+        setMinimumSize(new Dimension(600, 400));
+
+        setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
+
+        JPanel topPanel = new JPanel(new FlowLayout());
+
+        JLabel cmisLogo = new JLabel(ClientHelper.getIcon("icon.png"));
+        topPanel.add(cmisLogo);
+
+        Font labelFont = UIManager.getFont("Label.font");
+        Font titleFont = labelFont.deriveFont(Font.BOLD, labelFont.getSize2D() * 2f);
+
+        JLabel titleLabel = new JLabel("CMIS Workbench");
+        titleLabel.setFont(titleFont);
+        topPanel.add(titleLabel);
+
+        add(topPanel);
+
+        StringBuilder readme = new StringBuilder();
+
+        readme.append(loadText("/META-INF/README", "CMIS Workbench"));
+        readme.append("\n---------------------------------------------------------\n");
+        readme.append(loadText("/META-INF/build-timestamp.txt", ""));
+
+        JTextArea ta = new JTextArea(readme.toString());
+        ta.setEditable(false);
+        ta.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
+        JScrollPane readmePane = new JScrollPane(ta);
+        readmePane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
+        
+        add(readmePane);
+
+        setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+        pack();
+        setLocationRelativeTo(null);
+    }
+
+    public void showDialog() {
+        setVisible(true);
+    }
+
+    public void hideDialog() {
+        setVisible(false);
+    }
+
+    private String loadText(String file, String defaultText) {
+        StringBuilder result = new StringBuilder();
+
+        InputStream stream = getClass().getResourceAsStream(file);
+        if (stream != null) {
+            try {
+                BufferedReader br = new BufferedReader(new InputStreamReader(stream));
+
+                String s = null;
+                while ((s = br.readLine()) != null) {
+                    result.append(s);
+                    result.append('\n');
+                }
+
+                br.close();
+            } catch (Exception e) {
+            }
+        } else {
+            result.append(defaultText);
+        }
+
+        return result.toString();
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LogFrame.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/LogFrame.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LogFrame.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LogFrame.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+public class LogFrame extends JFrame {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String WINDOW_TITLE = "CMIS Client Logging";
+
+    private JTextArea logTextArea;
+
+    public LogFrame() {
+        super();
+        createGUI();
+    }
+
+    private void createGUI() {
+        setTitle(WINDOW_TITLE);
+        setPreferredSize(new Dimension(800, 600));
+        setMinimumSize(new Dimension(200, 60));
+
+        setLayout(new BorderLayout());
+
+        logTextArea = new JTextArea();
+        logTextArea.setEditable(false);
+        logTextArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
+        logTextArea.setLineWrap(true);
+        logTextArea.setWrapStyleWord(true);
+        add(new JScrollPane(logTextArea), BorderLayout.CENTER);
+
+        JPanel inputPanel = new JPanel(new FlowLayout());
+        add(inputPanel, BorderLayout.PAGE_END);
+
+        JButton clearButton = new JButton("Clear");
+        clearButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                logTextArea.setText("");
+            }
+        });
+        inputPanel.add(clearButton);
+
+        String[] levels = new String[] { Level.ALL.toString(), Level.TRACE.toString(), Level.DEBUG.toString(),
+                Level.INFO.toString(), Level.WARN.toString(), Level.ERROR.toString(), Level.FATAL.toString(),
+                Level.OFF.toString() };
+
+        final JComboBox levelBox = new JComboBox(levels);
+        levelBox.setSelectedItem(Logger.getRootLogger().getLevel().toString());
+        levelBox.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                Logger.getRootLogger().setLevel(Level.toLevel(levelBox.getSelectedItem().toString()));
+            }
+        });
+        inputPanel.add(levelBox);
+
+        setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+        pack();
+
+        setLocationRelativeTo(null);
+        setVisible(false);
+
+        ClientWriterAppender.setTextArea(logTextArea);
+    }
+
+    public void showFrame() {
+        setVisible(true);
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.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/LoginDialog.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,305 @@
+/*
+ * 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;
+
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.Repository;
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
+import org.apache.chemistry.opencmis.workbench.model.ClientSession;
+
+public class LoginDialog extends JDialog {
+
+    public static final String SYSPROP_URL = ClientSession.WORKBENCH_PREFIX + "url";
+    public static final String SYSPROP_BINDING = ClientSession.WORKBENCH_PREFIX + "binding";
+    public static final String SYSPROP_AUTHENTICATION = ClientSession.WORKBENCH_PREFIX + "authentication";
+    public static final String SYSPROP_USER = ClientSession.WORKBENCH_PREFIX + "user";
+    public static final String SYSPROP_PASSWORD = ClientSession.WORKBENCH_PREFIX + "password";
+
+    private static final long serialVersionUID = 1L;
+
+    private JTextField urlField;
+    private JRadioButton bindingAtomButton;
+    private JRadioButton bindingWebServicesButton;
+    private JTextField usernameField;
+    private JPasswordField passwordField;
+    private JRadioButton authenticationNoneButton;
+    private JRadioButton authenticationStandardButton;
+    private JRadioButton authenticationNTLMButton;
+    private JButton connectButton;
+    private JButton loginButton;
+    private JComboBox repositoryBox;
+
+    private boolean canceled = true;
+
+    private ClientSession clientSession;
+
+    public LoginDialog(Frame owner) {
+        super(owner, "Login", true);
+        createGUI();
+    }
+
+    private void createGUI() {
+        setPreferredSize(new Dimension(520, 280));
+
+        Container pane = getContentPane();
+
+        pane.setLayout(new GridBagLayout());
+
+        urlField = createTextField(pane, "URL:", 1);
+        urlField.setText(System.getProperty(SYSPROP_URL, ""));
+
+        createBindingButtons(pane, 2);
+
+        usernameField = createTextField(pane, "Username:", 3);
+        usernameField.setText(System.getProperty(SYSPROP_USER, ""));
+
+        passwordField = createPasswordField(pane, "Password:", 4);
+        passwordField.setText(System.getProperty(SYSPROP_PASSWORD, ""));
+
+        createAuthenticationButtons(pane, 5);
+
+        connectButton = createButton(pane, "Connect", 6);
+
+        createRepositoryBox(pane, 7);
+
+        loginButton = createButton(pane, "Login", 8);
+        loginButton.setEnabled(false);
+
+        connectButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                repositoryBox.removeAllItems();
+
+                try {
+                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+                    createClientSession();
+
+                    List<Repository> repositories = clientSession.getRepositories();
+                    if (repositories.size() > 0) {
+
+                        for (Repository repository : repositories) {
+                            repositoryBox.addItem(repository.getName() + " (" + repository.getId() + ")");
+                        }
+
+                        repositoryBox.setEnabled(true);
+                        loginButton.setEnabled(true);
+                    } else {
+                        repositoryBox.setEnabled(false);
+                        loginButton.setEnabled(false);
+                    }
+                } catch (Exception ex) {
+                    repositoryBox.setEnabled(false);
+                    loginButton.setEnabled(false);
+
+                    ClientHelper.showError(getOwner(), ex);
+                } finally {
+                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+                }
+            }
+        });
+
+        loginButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                try {
+                    clientSession.createSession(repositoryBox.getSelectedIndex());
+                    canceled = false;
+                    hideDialog();
+                } catch (Exception ex) {
+                    repositoryBox.setEnabled(false);
+                    loginButton.setEnabled(false);
+
+                    ClientHelper.showError(getOwner(), ex);
+                }
+            }
+        });
+
+        setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+        pack();
+        setLocationRelativeTo(null);
+    }
+
+    private JTextField createTextField(Container pane, String label, int row) {
+        JTextField textField = new JTextField(60);
+        JLabel textLabel = new JLabel(label);
+        textLabel.setLabelFor(textField);
+
+        GridBagConstraints c = new GridBagConstraints();
+        c.anchor = GridBagConstraints.LINE_START;
+        c.fill = GridBagConstraints.HORIZONTAL;
+        c.gridx = 0;
+        c.gridy = row;
+        pane.add(textLabel, c);
+        c.gridx = 1;
+        c.ipadx = 400;
+        pane.add(textField, c);
+
+        return textField;
+    }
+
+    private JPasswordField createPasswordField(Container pane, String label, int row) {
+        JPasswordField textField = new JPasswordField(60);
+        JLabel textLabel = new JLabel(label);
+        textLabel.setLabelFor(textField);
+
+        GridBagConstraints c = new GridBagConstraints();
+        c.anchor = GridBagConstraints.LINE_START;
+        c.fill = GridBagConstraints.HORIZONTAL;
+        c.gridx = 0;
+        c.gridy = row;
+        pane.add(textLabel, c);
+        c.gridx = 1;
+        pane.add(textField, c);
+
+        return textField;
+    }
+
+    private void createBindingButtons(Container pane, int row) {
+        JPanel bindingContainer = new JPanel();
+        boolean atom = (System.getProperty(SYSPROP_BINDING, "atom").toLowerCase().charAt(0) == 'a');
+        bindingAtomButton = new JRadioButton("AtomPub", atom);
+        bindingWebServicesButton = new JRadioButton("Web Services", !atom);
+        ButtonGroup bindingGroup = new ButtonGroup();
+        bindingGroup.add(bindingAtomButton);
+        bindingGroup.add(bindingWebServicesButton);
+        bindingContainer.add(bindingAtomButton);
+        bindingContainer.add(bindingWebServicesButton);
+        JLabel bindingLabel = new JLabel("Binding:");
+
+        GridBagConstraints c = new GridBagConstraints();
+        c.anchor = GridBagConstraints.LINE_START;
+        c.gridx = 0;
+        c.gridy = row;
+        pane.add(bindingLabel, c);
+        c.gridx = 1;
+        pane.add(bindingContainer, c);
+    }
+
+    private void createAuthenticationButtons(Container pane, int row) {
+        JPanel authenticationContainer = new JPanel();
+        boolean standard = (System.getProperty(SYSPROP_AUTHENTICATION, "standard").toLowerCase().equals("standard"));
+        boolean ntlm = (System.getProperty(SYSPROP_AUTHENTICATION, "").toLowerCase().equals("ntlm"));
+        boolean none = !standard && !ntlm;
+        authenticationNoneButton = new JRadioButton("None", none);
+        authenticationStandardButton = new JRadioButton("Standard", standard);
+        authenticationNTLMButton = new JRadioButton("NTLM", ntlm);
+        ButtonGroup authenticationGroup = new ButtonGroup();
+        authenticationGroup.add(authenticationNoneButton);
+        authenticationGroup.add(authenticationStandardButton);
+        authenticationGroup.add(authenticationNTLMButton);
+        authenticationContainer.add(authenticationNoneButton);
+        authenticationContainer.add(authenticationStandardButton);
+        authenticationContainer.add(authenticationNTLMButton);
+        JLabel authenticatioLabel = new JLabel("Authentication:");
+
+        GridBagConstraints c = new GridBagConstraints();
+        c.anchor = GridBagConstraints.LINE_START;
+        c.gridx = 0;
+        c.gridy = row;
+        pane.add(authenticatioLabel, c);
+        c.gridx = 1;
+        pane.add(authenticationContainer, c);
+    }
+
+    private JButton createButton(Container pane, String label, int row) {
+        JButton button = new JButton(label);
+
+        GridBagConstraints c = new GridBagConstraints();
+        c.anchor = GridBagConstraints.CENTER;
+        c.fill = GridBagConstraints.HORIZONTAL;
+        c.gridx = 1;
+        c.gridy = row;
+        pane.add(button, c);
+
+        return button;
+    }
+
+    private void createRepositoryBox(Container pane, int row) {
+        repositoryBox = new JComboBox();
+        repositoryBox.setEnabled(false);
+        JLabel boxLabel = new JLabel("Repository:");
+        boxLabel.setLabelFor(repositoryBox);
+
+        GridBagConstraints c = new GridBagConstraints();
+        c.anchor = GridBagConstraints.LINE_START;
+        c.fill = GridBagConstraints.HORIZONTAL;
+        c.gridx = 0;
+        c.gridy = row;
+        pane.add(boxLabel, c);
+        c.gridx = 1;
+        pane.add(repositoryBox, c);
+    }
+
+    public void createClientSession() {
+        String url = urlField.getText();
+        BindingType binding = bindingAtomButton.isSelected() ? BindingType.ATOMPUB : BindingType.WEBSERVICES;
+        String username = usernameField.getText();
+        String password = new String(passwordField.getPassword());
+
+        ClientSession.Authentication authentication = ClientSession.Authentication.NONE;
+        if (authenticationStandardButton.isSelected()) {
+            authentication = ClientSession.Authentication.STANDARD;
+        } else if (authenticationNTLMButton.isSelected()) {
+            authentication = ClientSession.Authentication.NTLM;
+        }
+
+        clientSession = new ClientSession(url, binding, username, password, authentication);
+    }
+
+    public void showDialog() {
+        clientSession = null;
+        canceled = true;
+
+        repositoryBox.removeAllItems();
+        repositoryBox.setEnabled(false);
+        loginButton.setEnabled(false);
+
+        setVisible(true);
+    }
+
+    public void hideDialog() {
+        setVisible(false);
+    }
+
+    public ClientSession getClientSession() {
+        return clientSession;
+    }
+
+    public boolean isCanceled() {
+        return canceled;
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.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/QueryFrame.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,338 @@
+/*
+ * 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;
+
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFormattedTextField;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.text.NumberFormatter;
+
+import org.apache.chemistry.opencmis.client.api.ItemIterable;
+import org.apache.chemistry.opencmis.client.api.QueryResult;
+import org.apache.chemistry.opencmis.commons.data.PropertyData;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+
+public class QueryFrame extends JFrame {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String WINDOW_TITLE = "CMIS Query";
+    private static final String DEFAULT_QUERY = "SELECT * FROM cmis:document";
+
+    private ClientModel model;
+
+    private JTextArea queryText;
+    private JFormattedTextField maxHitsField;
+    private JCheckBox searchAllVersionsCheckBox;
+    private JTable resultsTable;
+    private JLabel queryTimeLabel;
+
+    public QueryFrame(ClientModel model) {
+        super();
+
+        this.model = model;
+        createGUI();
+    }
+
+    private void createGUI() {
+        setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
+        setPreferredSize(new Dimension(800, 700));
+        setMinimumSize(new Dimension(200, 60));
+
+        setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
+
+        // input
+        JPanel inputPanel = new JPanel();
+        inputPanel.setLayout(new BoxLayout(inputPanel, BoxLayout.LINE_AXIS));
+
+        queryText = new JTextArea(DEFAULT_QUERY, 5, 60);
+        inputPanel.add(queryText);
+
+        JPanel inputPanel2 = new JPanel();
+        inputPanel2.setPreferredSize(new Dimension(160, 100));
+        inputPanel2.setMaximumSize(inputPanel.getPreferredSize());
+        inputPanel2.setLayout(new GridBagLayout());
+
+        GridBagConstraints c = new GridBagConstraints();
+        c.fill = GridBagConstraints.HORIZONTAL;
+
+        JButton queryButton = new JButton("Query");
+        queryButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                doQuery();
+            }
+        });
+
+        c.gridx = 0;
+        c.gridy = 0;
+        c.gridwidth = 2;
+        inputPanel2.add(queryButton, c);
+
+        maxHitsField = new JFormattedTextField(new NumberFormatter());
+        maxHitsField.setValue(Integer.valueOf(100));
+        maxHitsField.setColumns(5);
+
+        JLabel maxHitsLabel = new JLabel("Max hits:");
+        maxHitsLabel.setLabelFor(maxHitsField);
+
+        c.gridx = 0;
+        c.gridy = 1;
+        c.gridwidth = 1;
+        inputPanel2.add(maxHitsLabel, c);
+        c.gridx = 1;
+        c.gridy = 1;
+        c.gridwidth = 1;
+        inputPanel2.add(maxHitsField, c);
+
+        searchAllVersionsCheckBox = new JCheckBox("search all versions", false);
+        c.gridx = 0;
+        c.gridy = 2;
+        c.gridwidth = 2;
+        inputPanel2.add(searchAllVersionsCheckBox, c);
+
+        queryTimeLabel = new JLabel("(-- hits in -- seconds)");
+        c.gridx = 0;
+        c.gridy = 3;
+        c.gridwidth = 2;
+        inputPanel2.add(queryTimeLabel, c);
+
+        inputPanel.add(inputPanel2);
+
+        // table
+        resultsTable = new JTable();
+        resultsTable.setFillsViewportHeight(true);
+        resultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+
+        final JPopupMenu popup = new JPopupMenu();
+        JMenuItem menuItem = new JMenuItem("Copy to clipboard");
+        popup.add(menuItem);
+
+        menuItem.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                StringBuilder sb = new StringBuilder();
+                int rows = resultsTable.getModel().getColumnCount();
+                for (int row = 0; row < rows; row++) {
+                    int cols = resultsTable.getModel().getColumnCount();
+                    for (int col = 0; col < cols; col++) {
+                        sb.append(resultsTable.getModel().getValueAt(row, col));
+                        sb.append("|");
+                    }
+                    sb.append("\n");
+                }
+
+                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+                Transferable transferable = new StringSelection(sb.toString());
+                clipboard.setContents(transferable, null);
+            }
+        });
+
+        resultsTable.addMouseListener(new MouseListener() {
+            public void mouseExited(MouseEvent e) {
+            }
+
+            public void mouseEntered(MouseEvent e) {
+            }
+
+            public void mouseClicked(MouseEvent e) {
+            }
+
+            public void mousePressed(MouseEvent e) {
+                maybeShowPopup(e);
+            }
+
+            public void mouseReleased(MouseEvent e) {
+                maybeShowPopup(e);
+            }
+
+            private void maybeShowPopup(MouseEvent e) {
+                if (e.isPopupTrigger()) {
+                    popup.show(e.getComponent(), e.getX(), e.getY());
+                }
+            }
+        });
+
+        add(new JSplitPane(JSplitPane.VERTICAL_SPLIT, inputPanel, new JScrollPane(resultsTable)));
+
+        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        pack();
+
+        setLocationRelativeTo(null);
+        setVisible(true);
+    }
+
+    private synchronized void doQuery() {
+        String text = queryText.getText();
+        text = text.replace('\n', ' ');
+
+        ItemIterable<QueryResult> results = null;
+
+        try {
+            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+            int maxHits = 1000;
+            try {
+                maxHitsField.commitEdit();
+                maxHits = ((Number) maxHitsField.getValue()).intValue();
+            } catch (Exception e) {
+            }
+
+            results = model.query(text, searchAllVersionsCheckBox.isSelected(), maxHits);
+
+            ResultTableModel rtm = new ResultTableModel();
+
+            long startTime = System.currentTimeMillis();
+
+            int row = 0;
+            for (QueryResult qr : results.getPage(maxHits)) {
+                rtm.setColumnCount(Math.max(rtm.getColumnCount(), qr.getProperties().size()));
+
+                for (PropertyData<?> prop : qr.getProperties()) {
+                    rtm.setValue(row, prop.getQueryName(), prop.getFirstValue());
+                }
+
+                row++;
+            }
+            rtm.setRowCount(row);
+
+            long stopTime = System.currentTimeMillis();
+            float time = ((float) (stopTime - startTime)) / 1000f;
+            queryTimeLabel.setText("(" + row + " hits in " + time + " seconds)");
+
+            resultsTable.setModel(rtm);
+        } catch (Exception ex) {
+            ClientHelper.showError(null, ex);
+            return;
+        } finally {
+            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+        }
+    }
+
+    static class ResultTableModel extends AbstractTableModel {
+
+        private static final long serialVersionUID = 1L;
+
+        private int columnCount = 0;
+        private int rowCount = 0;
+        private Map<String, Integer> columnMapping = new HashMap<String, Integer>();
+        private Map<Integer, Map<Integer, Object>> data = new HashMap<Integer, Map<Integer, Object>>();
+        private Map<Integer, Class<?>> columnClass = new HashMap<Integer, Class<?>>();
+
+        public ResultTableModel() {
+        }
+
+        public void setColumnCount(int columnCount) {
+            this.columnCount = columnCount;
+        }
+
+        public int getColumnCount() {
+            return columnCount;
+        }
+
+        public void setRowCount(int rowCount) {
+            this.rowCount = rowCount;
+        }
+
+        public int getRowCount() {
+            return rowCount;
+        }
+
+        public void setValue(int rowIndex, String queryName, Object value) {
+            Integer col = columnMapping.get(queryName);
+            if (col == null) {
+                col = columnMapping.size();
+                columnMapping.put(queryName, columnMapping.size());
+            }
+
+            if (value == null) {
+                return;
+            }
+
+            if (value instanceof GregorianCalendar) {
+                value = ClientHelper.getDateString((GregorianCalendar) value);
+            }
+
+            columnClass.put(col, value.getClass());
+
+            Map<Integer, Object> row = data.get(rowIndex);
+            if (row == null) {
+                row = new HashMap<Integer, Object>();
+                data.put(rowIndex, row);
+            }
+
+            row.put(col, value);
+        }
+
+        public Object getValueAt(int rowIndex, int columnIndex) {
+            Map<Integer, Object> row = data.get(rowIndex);
+            if (row == null) {
+                return null;
+            }
+
+            return row.get(columnIndex);
+        }
+
+        @Override
+        public String getColumnName(int column) {
+            for (Map.Entry<String, Integer> e : columnMapping.entrySet()) {
+                if (e.getValue().equals(column)) {
+                    return e.getKey();
+                }
+            }
+
+            return "?";
+        }
+
+        @Override
+        public Class<?> getColumnClass(int columnIndex) {
+            Class<?> clazz = columnClass.get(columnIndex);
+            if (clazz != null) {
+                return clazz;
+            }
+
+            return String.class;
+        }
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.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/RepositoryInfoFrame.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,182 @@
+/*
+ * 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;
+
+import java.awt.Dimension;
+
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+
+import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
+import org.apache.chemistry.opencmis.commons.data.PermissionMapping;
+import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.InfoPanel;
+
+public class RepositoryInfoFrame extends JFrame {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String WINDOW_TITLE = "CMIS Repository Info";
+
+    private ClientModel model;
+
+    public RepositoryInfoFrame(ClientModel model) {
+        super();
+
+        this.model = model;
+        createGUI();
+    }
+
+    private void createGUI() {
+        setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
+        setPreferredSize(new Dimension(700, 700));
+        setMinimumSize(new Dimension(200, 60));
+
+        RepositoryInfo repInfo = null;
+        try {
+            repInfo = model.getRepositoryInfo();
+        } catch (Exception e) {
+            ClientHelper.showError(this, e);
+            dispose();
+            return;
+        }
+
+        add(new JScrollPane(new RepositoryInfoPanel(repInfo)));
+
+        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        pack();
+
+        setLocationRelativeTo(null);
+        setVisible(true);
+    }
+
+    static class RepositoryInfoPanel extends InfoPanel {
+
+        private static final long serialVersionUID = 1L;
+
+        private RepositoryInfo repInfo;
+
+        public RepositoryInfoPanel(RepositoryInfo repInfo) {
+            super();
+
+            this.repInfo = repInfo;
+            createGUI();
+        }
+
+        private void createGUI() {
+            setupGUI();
+
+            addLine("Name:", true).setText(repInfo.getName());
+            addLine("Id:").setText(repInfo.getId());
+            addLine("Description:").setText(repInfo.getDescription());
+            addLine("Vendor:").setText(repInfo.getVendorName());
+            addLine("Product:").setText(repInfo.getProductName() + " " + repInfo.getProductVersion());
+            addLine("CMIS Version:").setText(repInfo.getCmisVersionSupported());
+            addLine("Root folder Id:").setText(repInfo.getRootFolderId());
+            addLine("Latest change token:").setText(repInfo.getLatestChangeLogToken());
+            addLine("Thin client URI:").setText(repInfo.getThinClientUri());
+            addLine("Principal id anonymous:").setText(repInfo.getPrincipalIdAnonymous());
+            addLine("Principal id anyone:").setText(repInfo.getPrincipalIdAnyone());
+            addCheckBox("Changes incomplete:").setSelected(is(repInfo.getChangesIncomplete()));
+            addLine("Changes on type:").setText(
+                    repInfo.getChangesOnType() == null ? "" : repInfo.getChangesOnType().toString());
+
+            if (repInfo.getCapabilities() != null) {
+                RepositoryCapabilities cap = repInfo.getCapabilities();
+
+                addLine("Capabilities", true).setText("");
+
+                addCheckBox("Get descendants supported:").setSelected(is(cap.isGetDescendantsSupported()));
+                addCheckBox("Get folder tree supported:").setSelected(is(cap.isGetFolderTreeSupported()));
+                addCheckBox("Unfiling supported:").setSelected(is(cap.isUnfilingSupported()));
+                addCheckBox("Multifiling supported:").setSelected(is(cap.isMultifilingSupported()));
+                addCheckBox("Version specific filing supported:").setSelected(
+                        is(cap.isVersionSpecificFilingSupported()));
+                addLine("Query:").setText(str(cap.getQueryCapability()));
+                addLine("Joins:").setText(str(cap.getJoinCapability()));
+                addCheckBox("All versions searchable:").setSelected(is(cap.isAllVersionsSearchableSupported()));
+                addCheckBox("PWC searchable:").setSelected(is(cap.isPwcSearchableSupported()));
+                addCheckBox("PWC updatable:").setSelected(is(cap.isPwcUpdatableSupported()));
+                addLine("Content stream updates:").setText(str(cap.getContentStreamUpdatesCapability()));
+                addLine("Renditions:").setText(str(cap.getRenditionsCapability()));
+                addLine("Changes:").setText(str(cap.getChangesCapability()));
+                addLine("ACLs:").setText(str(cap.getAclCapability()));
+            }
+
+            if (repInfo.getAclCapabilities() != null) {
+                AclCapabilities cap = repInfo.getAclCapabilities();
+
+                addLine("ACL Capabilities", true).setText("");
+
+                addLine("Supported permissions:").setText(str(cap.getSupportedPermissions()));
+                addLine("ACL propagation:").setText(str(cap.getAclPropagation()));
+
+                if (cap.getPermissions() != null) {
+                    String[][] data = new String[cap.getPermissions().size()][2];
+
+                    int i = 0;
+                    for (PermissionDefinition pd : cap.getPermissions()) {
+                        data[i][0] = pd.getId();
+                        data[i][1] = pd.getDescription();
+                        i++;
+                    }
+
+                    JTable permTable = new JTable(data, new String[] { "Permission", "Description" });
+                    permTable.setFillsViewportHeight(true);
+                    addComponent("Permissions", new JScrollPane(permTable));
+                }
+
+                if (cap.getPermissionMapping() != null) {
+                    String[][] data = new String[cap.getPermissionMapping().size()][2];
+
+                    int i = 0;
+                    for (PermissionMapping pm : cap.getPermissionMapping().values()) {
+                        data[i][0] = pm.getKey();
+                        data[i][1] = (pm.getPermissions() == null ? "" : pm.getPermissions().toString());
+                        i++;
+                    }
+
+                    JTable permMapTable = new JTable(data, new String[] { "Key", "Permissions" });
+                    permMapTable.setFillsViewportHeight(true);
+                    addComponent("Permission mapping", new JScrollPane(permMapTable));
+                }
+            }
+        }
+
+        private boolean is(Boolean b) {
+            if (b == null) {
+                return false;
+            }
+
+            return b.booleanValue();
+        }
+
+        private String str(Object o) {
+            if (o == null) {
+                return "?";
+            }
+
+            return o.toString();
+        }
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.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/TypesFrame.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,410 @@
+/*
+ * 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;
+
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.JTree;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeSelectionModel;
+
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.client.api.Tree;
+import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.CollectionRenderer;
+import org.apache.chemistry.opencmis.workbench.swing.InfoPanel;
+
+public class TypesFrame extends JFrame {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String WINDOW_TITLE = "CMIS Types";
+
+    private ClientModel model;
+
+    private JTree typesTree;
+    private TypeInfoPanel typePanel;
+    private PropertyDefinitionTable propertyDefinitionTable;
+
+    public TypesFrame(ClientModel model) {
+        super();
+
+        this.model = model;
+        createGUI();
+        loadData();
+    }
+
+    private void createGUI() {
+        setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
+        setPreferredSize(new Dimension(1000, 700));
+        setMinimumSize(new Dimension(200, 60));
+
+        typesTree = new JTree();
+        typesTree.setRootVisible(false);
+        typesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+
+        typesTree.addTreeSelectionListener(new TreeSelectionListener() {
+            public void valueChanged(TreeSelectionEvent e) {
+                DefaultMutableTreeNode node = (DefaultMutableTreeNode) ((JTree) e.getSource())
+                        .getLastSelectedPathComponent();
+
+                if (node == null) {
+                    return;
+                }
+
+                ObjectType type = ((TypeNode) node.getUserObject()).getType();
+                typePanel.setType(type);
+                propertyDefinitionTable.setType(type);
+            }
+        });
+
+        typePanel = new TypeInfoPanel();
+        propertyDefinitionTable = new PropertyDefinitionTable();
+
+        JSplitPane typeSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(typePanel),
+                new JScrollPane(propertyDefinitionTable));
+        typeSplitPane.setDividerLocation(300);
+
+        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(typesTree), typeSplitPane);
+        splitPane.setDividerLocation(300);
+
+        add(splitPane);
+
+        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        pack();
+
+        setLocationRelativeTo(null);
+        setVisible(true);
+    }
+
+    private void loadData() {
+        try {
+            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+            DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
+
+            List<Tree<ObjectType>> types = model.getTypeDescendants();
+            for (Tree<ObjectType> tt : types) {
+                addLevel(rootNode, tt);
+            }
+
+            DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
+            typesTree.setModel(treeModel);
+        } catch (Exception ex) {
+            ClientHelper.showError(null, ex);
+            return;
+        } finally {
+            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+        }
+    }
+
+    private void addLevel(DefaultMutableTreeNode parent, Tree<ObjectType> tree) {
+        DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TypeNode(tree.getItem()));
+        parent.add(node);
+
+        if (tree.getChildren() != null) {
+            for (Tree<ObjectType> tt : tree.getChildren()) {
+                addLevel(node, tt);
+            }
+        }
+    }
+
+    static class TypeNode {
+        private ObjectType type;
+
+        public TypeNode(ObjectType type) {
+            this.type = type;
+        }
+
+        public ObjectType getType() {
+            return type;
+        }
+
+        @Override
+        public String toString() {
+            return type.getDisplayName() + " (" + type.getId() + ")";
+        }
+    }
+
+    static class TypeInfoPanel extends InfoPanel {
+
+        private static final long serialVersionUID = 1L;
+
+        private JTextField nameField;
+        private JTextField descriptionField;
+        private JTextField idField;
+        private JTextField localNamespaceField;
+        private JTextField localNameField;
+        private JTextField queryNameField;
+        private JTextField baseTypeField;
+        private JCheckBox creatableBox;
+        private JCheckBox fileableBox;
+        private JCheckBox queryableBox;
+        private JCheckBox aclBox;
+        private JCheckBox policyBox;
+        private JCheckBox versionableBox;
+        private JTextField contentStreamAllowedField;
+        private JTextField allowedSourceTypesField;
+        private JTextField allowedTargetTypesField;
+
+        public TypeInfoPanel() {
+            super();
+            createGUI();
+        }
+
+        public void setType(ObjectType type) {
+            if (type != null) {
+                nameField.setText(type.getDisplayName());
+                descriptionField.setText(type.getDescription());
+                idField.setText(type.getId());
+                localNamespaceField.setText(type.getLocalNamespace());
+                localNameField.setText(type.getLocalName());
+                queryNameField.setText(type.getQueryName());
+                baseTypeField.setText(type.getBaseTypeId().value());
+                creatableBox.setSelected(is(type.isCreatable()));
+                fileableBox.setSelected(is(type.isFileable()));
+                queryableBox.setSelected(is(type.isQueryable()));
+                aclBox.setSelected(is(type.isControllableAcl()));
+                policyBox.setSelected(is(type.isControllablePolicy()));
+
+                if (type instanceof DocumentTypeDefinition) {
+                    DocumentTypeDefinition docType = (DocumentTypeDefinition) type;
+                    versionableBox.setVisible(true);
+                    versionableBox.setSelected(is(docType.isVersionable()));
+                    contentStreamAllowedField.setVisible(true);
+                    contentStreamAllowedField.setText(docType.getContentStreamAllowed() == null ? "???" : docType
+                            .getContentStreamAllowed().toString());
+                } else {
+                    versionableBox.setVisible(false);
+                    contentStreamAllowedField.setVisible(false);
+                }
+
+                if (type instanceof RelationshipTypeDefinition) {
+                    RelationshipTypeDefinition relationshipType = (RelationshipTypeDefinition) type;
+                    allowedSourceTypesField.setVisible(true);
+                    allowedSourceTypesField.setText(relationshipType.getAllowedSourceTypeIds() == null ? "???"
+                            : relationshipType.getAllowedSourceTypeIds().toString());
+                    allowedTargetTypesField.setVisible(true);
+                    allowedTargetTypesField.setText(relationshipType.getAllowedTargetTypeIds() == null ? "???"
+                            : relationshipType.getAllowedTargetTypeIds().toString());
+                } else {
+                    allowedSourceTypesField.setVisible(false);
+                    allowedTargetTypesField.setVisible(false);
+                }
+            } else {
+                nameField.setText("");
+                descriptionField.setText("");
+                idField.setText("");
+                localNamespaceField.setText("");
+                localNameField.setText("");
+                queryNameField.setText("");
+                baseTypeField.setText("");
+                creatableBox.setSelected(false);
+                fileableBox.setSelected(false);
+                queryableBox.setSelected(false);
+                aclBox.setSelected(false);
+                policyBox.setSelected(false);
+                versionableBox.setVisible(false);
+                contentStreamAllowedField.setVisible(false);
+                allowedSourceTypesField.setVisible(false);
+                allowedTargetTypesField.setVisible(false);
+            }
+
+            revalidate();
+        }
+
+        private void createGUI() {
+            setupGUI();
+
+            nameField = addLine("Name:", true);
+            descriptionField = addLine("Description:");
+            idField = addLine("Id:");
+            localNamespaceField = addLine("Local Namespace:");
+            localNameField = addLine("Local Name:");
+            queryNameField = addLine("Query Name:");
+            baseTypeField = addLine("Base Type:");
+            creatableBox = addCheckBox("Creatable:");
+            fileableBox = addCheckBox("Fileable:");
+            queryableBox = addCheckBox("Queryable:");
+            aclBox = addCheckBox("ACL controlable:");
+            policyBox = addCheckBox("Policy controlable:");
+            versionableBox = addCheckBox("Versionable:");
+            contentStreamAllowedField = addLine("Content stream allowed:");
+            allowedSourceTypesField = addLine("Allowed source types:");
+            allowedTargetTypesField = addLine("Allowed target types:");
+        }
+
+        private boolean is(Boolean b) {
+            if (b == null) {
+                return false;
+            }
+
+            return b.booleanValue();
+        }
+    }
+
+    static class PropertyDefinitionTable extends JTable {
+
+        private static final long serialVersionUID = 1L;
+
+        private static final String[] COLUMN_NAMES = { "Name", "Id", "Description", "Local Namespace", "Local Name",
+                "Query Name", "Type", "Cardinality", "Updatability", "Queryable", "Required", "Inherited",
+                "Default Value", "Choices" };
+        private static final int[] COLUMN_WIDTHS = { 200, 200, 200, 200, 200, 200, 80, 80, 80, 50, 50, 50, 200, 200 };
+
+        private ObjectType type;
+        private List<PropertyDefinition<?>> propertyDefintions;
+
+        public PropertyDefinitionTable() {
+            setDefaultRenderer(Collection.class, new CollectionRenderer());
+            setModel(new PropertyDefinitionTableModel(this));
+
+            setAutoResizeMode(AUTO_RESIZE_OFF);
+
+            for (int i = 0; i < COLUMN_WIDTHS.length; i++) {
+                TableColumn column = getColumnModel().getColumn(i);
+                column.setPreferredWidth(COLUMN_WIDTHS[i]);
+            }
+
+            setFillsViewportHeight(true);
+        }
+
+        public void setType(ObjectType type) {
+            this.type = type;
+
+            if ((type != null) && (type.getPropertyDefinitions() != null)) {
+                propertyDefintions = new ArrayList<PropertyDefinition<?>>();
+                for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values()) {
+                    propertyDefintions.add(propDef);
+                }
+
+                Collections.sort(propertyDefintions, new Comparator<PropertyDefinition<?>>() {
+                    public int compare(PropertyDefinition<?> pd1, PropertyDefinition<?> pd2) {
+                        return pd1.getId().compareTo(pd2.getId());
+                    }
+                });
+            } else {
+                propertyDefintions = null;
+            }
+
+            ((AbstractTableModel) getModel()).fireTableDataChanged();
+        }
+
+        public ObjectType getType() {
+            return type;
+        }
+
+        public List<PropertyDefinition<?>> getPropertyDefinitions() {
+            return propertyDefintions;
+        }
+
+        static class PropertyDefinitionTableModel extends AbstractTableModel {
+
+            private static final long serialVersionUID = 1L;
+
+            private PropertyDefinitionTable table;
+
+            public PropertyDefinitionTableModel(PropertyDefinitionTable table) {
+                this.table = table;
+            }
+
+            public String getColumnName(int columnIndex) {
+                return COLUMN_NAMES[columnIndex];
+            }
+
+            public int getColumnCount() {
+                return COLUMN_NAMES.length;
+            }
+
+            public int getRowCount() {
+                if (table.getPropertyDefinitions() == null) {
+                    return 0;
+                }
+
+                return table.getPropertyDefinitions().size();
+            }
+
+            public Object getValueAt(int rowIndex, int columnIndex) {
+                PropertyDefinition<?> propDef = table.getPropertyDefinitions().get(rowIndex);
+
+                switch (columnIndex) {
+                case 0:
+                    return propDef.getDisplayName();
+                case 1:
+                    return propDef.getId();
+                case 2:
+                    return propDef.getDescription();
+                case 3:
+                    return propDef.getLocalNamespace();
+                case 4:
+                    return propDef.getLocalName();
+                case 5:
+                    return propDef.getQueryName();
+                case 6:
+                    return propDef.getPropertyType();
+                case 7:
+                    return propDef.getCardinality();
+                case 8:
+                    return propDef.getUpdatability();
+                case 9:
+                    return propDef.isQueryable();
+                case 10:
+                    return propDef.isRequired();
+                case 11:
+                    return propDef.isInherited();
+                case 12:
+                    return propDef.getDefaultValue();
+                case 13:
+                    return propDef.getChoices();
+                }
+
+                return null;
+            }
+
+            @Override
+            public Class<?> getColumnClass(int columnIndex) {
+                if ((columnIndex == 12) || (columnIndex == 13)) {
+                    return Collection.class;
+                }
+
+                return super.getColumnClass(columnIndex);
+            }
+        }
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/Workbench.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/Workbench.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/Workbench.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/Workbench.java 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.
+ */
+package org.apache.chemistry.opencmis.workbench;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+
+public class Workbench {
+
+    public Workbench() throws InterruptedException, InvocationTargetException {
+
+        // set up Swing
+        try {
+            boolean nimbus = false;
+
+            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+                if ("Nimbus".equals(info.getName())) {
+                    UIManager.setLookAndFeel(info.getClassName());
+                    nimbus = true;
+                    break;
+                }
+            }
+
+            if (!nimbus) {
+                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        JFrame.setDefaultLookAndFeelDecorated(true);
+        JDialog.setDefaultLookAndFeelDecorated(true);
+
+        // show client frame
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                new ClientFrame();
+            }
+        });
+    }
+
+    public static void main(String[] args) throws Exception {
+        new Workbench();
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.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/actions/CancelCheckOutPanel.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.actions;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class CancelCheckOutPanel extends ActionPanel {
+
+	private static final long serialVersionUID = 1L;
+
+	public CancelCheckOutPanel(ClientModel model) {
+		super("Cancel Check-out Object", "Cancel Check-out", model);
+	}
+
+	@Override
+	protected void createActionComponents() {
+	}
+
+	@Override
+	public boolean isAllowed() {
+		if ((getObject() == null) || !(getObject() instanceof Document)) {
+			return false;
+		}
+
+		if ((getObject().getAllowableActions() == null)
+				|| (getObject().getAllowableActions().getAllowableActions() == null)) {
+			return true;
+		}
+
+		return getObject().getAllowableActions().getAllowableActions()
+				.contains(Action.CAN_CANCEL_CHECK_OUT);
+	}
+
+	@Override
+	public void doAction() throws Exception {
+		((Document) getObject()).cancelCheckOut();
+	}
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckInPanel.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/actions/CheckInPanel.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckInPanel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckInPanel.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.workbench.actions;
+
+import javax.swing.JCheckBox;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class CheckInPanel extends ActionPanel {
+
+	private static final long serialVersionUID = 1L;
+
+	private JCheckBox majorBox;
+	private JTextField filenameField;
+
+	public CheckInPanel(ClientModel model) {
+		super("Check-in Object", "Check-in", model);
+	}
+
+	@Override
+	protected void createActionComponents() {
+		majorBox = new JCheckBox("major version", true);
+		addActionComponent(majorBox);
+
+		filenameField = new JTextField(30);
+		addActionComponent(createFilenamePanel(filenameField));
+	}
+
+	@Override
+	public boolean isAllowed() {
+		if ((getObject() == null) || !(getObject() instanceof Document)) {
+			return false;
+		}
+
+		if ((getObject().getAllowableActions() == null)
+				|| (getObject().getAllowableActions().getAllowableActions() == null)) {
+			return true;
+		}
+
+		return getObject().getAllowableActions().getAllowableActions()
+				.contains(Action.CAN_CHECK_IN);
+	}
+
+	@Override
+	public void doAction() throws Exception {
+		ContentStream content = getClientModel().createContentStream(
+				filenameField.getText());
+		((Document) getObject()).checkIn(majorBox.isSelected(), null, content,
+				null, null, null, null);
+	}
+}
\ 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/actions/CheckInPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckOutPanel.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/actions/CheckOutPanel.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckOutPanel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckOutPanel.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.actions;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class CheckOutPanel extends ActionPanel {
+
+	private static final long serialVersionUID = 1L;
+
+	public CheckOutPanel(ClientModel model) {
+		super("Check-out Object", "Check-out", model);
+	}
+
+	@Override
+	protected void createActionComponents() {
+	}
+
+	@Override
+	public boolean isAllowed() {
+		if ((getObject() == null) || !(getObject() instanceof Document)) {
+			return false;
+		}
+
+		if ((getObject().getAllowableActions() == null)
+				|| (getObject().getAllowableActions().getAllowableActions() == null)) {
+			return true;
+		}
+
+		return getObject().getAllowableActions().getAllowableActions()
+				.contains(Action.CAN_CHECK_OUT);
+	}
+
+	@Override
+	public void doAction() throws Exception {
+		((Document) getObject()).checkOut();
+	}
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteContentStreamPanel.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/actions/DeleteContentStreamPanel.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteContentStreamPanel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteContentStreamPanel.java Wed Oct  6 12:32:23 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.actions;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class DeleteContentStreamPanel extends ActionPanel {
+
+	private static final long serialVersionUID = 1L;
+
+	public DeleteContentStreamPanel(ClientModel model) {
+		super("Delete Content Stream", "Delete Content Stream", model);
+	}
+
+	@Override
+	protected void createActionComponents() {
+	}
+
+	@Override
+	public boolean isAllowed() {
+		if ((getObject() == null) || !(getObject() instanceof Document)) {
+			return false;
+		}
+
+		if ((getObject().getAllowableActions() == null)
+				|| (getObject().getAllowableActions().getAllowableActions() == null)) {
+			return true;
+		}
+
+		return getObject().getAllowableActions().getAllowableActions()
+				.contains(Action.CAN_DELETE_CONTENT_STREAM);
+	}
+
+	@Override
+	public void doAction() throws Exception {
+		((Document) getObject()).deleteContentStream();
+	}
+}
\ No newline at end of file