incubator-kalumet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1205585 [23/23] - in /incubator/kalumet/trunk: ./ console/ console/src/main/java/org/apache/kalumet/console/app/ console/src/main/resources/org/apache/kalumet/console/app/templates/
Date Wed, 23 Nov 2011 20:52:25 GMT
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwaresPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwaresPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwaresPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwaresPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,624 @@
+/*
+ * 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.kalumet.console.app;
+
+import java.util.Iterator;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.Column;
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Insets;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.TextField;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import org.apache.kalumet.FileManipulator;
+import org.apache.kalumet.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.Agent;
+import org.apache.kalumet.model.Kalumet;
+import org.apache.kalumet.model.Software;
+import org.apache.kalumet.ws.client.SoftwareClient;
+
+/**
+ * Environment external manual applications pane.
+ */
+public class SoftwaresPane extends ContentPane {
+
+    private EnvironmentWindow parent;
+    private Grid grid;
+
+    // update thread
+    class UpdateThread extends Thread {
+
+        public String softwareName;
+        public boolean ended = false;
+        public boolean failure = false;
+        public String message;
+
+        public void run() {
+            try {
+                // load Kalumet configuration
+                Kalumet kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(parent.getEnvironment().getAgent());
+                if (agent == null) {
+                    throw new IllegalArgumentException("agent not found.");
+                }
+                // call the WebService
+                SoftwareClient client = new SoftwareClient(agent.getHostname(), agent.getPort());
+                client.update(parent.getEnvironmentName(), softwareName, false);
+            } catch (Exception e) {
+                failure = true;
+                message = "Software " + softwareName + " update failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // toggle blocker
+    private ActionListener toggleBlocker = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the external object
+            Software software = parent.getEnvironment().getSoftware(event.getActionCommand());
+            if (software == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("external.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // change the external state and add a change event
+            if (software.isBlocker()) {
+                software.setBlocker(false);
+                parent.getChangeEvents().add("Set not blocker for software " + software.getName());
+            } else {
+                software.setBlocker(true);
+                parent.getChangeEvents().add("Set blocker for software " + software.getName());
+            }
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log pane
+            parent.updateJournalPane();
+            // update the pane
+            update();
+        }
+    };
+    // toggle active
+    private ActionListener toggleActive = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the software object
+            Software software = parent.getEnvironment().getSoftware(event.getActionCommand());
+            if (software == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("software.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // change the external state and add a change event
+            if (software.isActive()) {
+                software.setActive(false);
+                parent.getChangeEvents().add("Disable software " + software.getName());
+            } else {
+                software.setActive(true);
+                parent.getChangeEvents().add("Enable software " + software.getName());
+            }
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log pane
+            parent.updateJournalPane();
+            // update the pane
+            update();
+        }
+    };
+    // toggle before
+    private ActionListener toggleBefore = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the software object
+            Software software = parent.getEnvironment().getSoftware(event.getActionCommand());
+            if (software == null) {
+                return;
+            }
+            // change the external software order
+            if (software.isBeforej2ee()) {
+                software.setBeforej2ee(false);
+                parent.getChangeEvents().add("Flag software " + software.getName() + " to be updated after J2EE resources.");
+            } else {
+                software.setBeforej2ee(true);
+                parent.getChangeEvents().add("Flag software " + software.getName() + " to be updated before J2EE resources.");
+            }
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log pane
+            parent.updateJournalPane();
+            // update this pane
+            update();
+        }
+    };
+    // delete
+    private ActionListener delete = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the external object
+            final Software software = parent.getEnvironment().getSoftware(event.getActionCommand());
+            if (software == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("software.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // delete the external object
+                    parent.getEnvironment().getSoftwares().remove(software);
+                    // add a change event
+                    parent.getChangeEvents().add("Delete software " + software.getName());
+                    // change the updated flag
+                    parent.setUpdated(true);
+                    // update the whole environment window
+                    parent.update();
+                    // update the pane
+                    update();
+                }
+            }));
+        }
+    };
+    // edit
+    private ActionListener edit = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            if (KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().getComponent("softwarewindow_" + parent.getEnvironmentName() + "_" + event.getActionCommand()) == null) {
+                KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new SoftwareWindow(SoftwaresPane.this, event.getActionCommand()));
+            }
+        }
+    };
+    // create
+    private ActionListener create = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new SoftwareWindow(SoftwaresPane.this, null));
+        }
+    };
+    // up
+    private ActionListener up = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the external object
+            Software software = parent.getEnvironment().getSoftware(event.getActionCommand());
+            if (software == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("software.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the external index
+            int index = parent.getEnvironment().getSoftwares().indexOf(software);
+            // if the external index is the first one or the object is not found,
+            // do nothing, the list must contains at least 2 externals
+            if (index == 0 || index == -1 || parent.getEnvironment().getSoftwares().size() < 2) {
+                return;
+            }
+            // get the previous external
+            Software previous = (Software) parent.getEnvironment().getSoftwares().get(index - 1);
+            // switch external
+            parent.getEnvironment().getSoftwares().set(index, previous);
+            parent.getEnvironment().getSoftwares().set(index - 1, software);
+            // update the pane
+            update();
+        }
+    };
+    // down
+    private ActionListener down = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the software object
+            Software software = parent.getEnvironment().getSoftware(event.getActionCommand());
+            if (software == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("software.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the external index
+            int index = parent.getEnvironment().getSoftwares().indexOf(software);
+            // if the external index is the last one or the object is not found,
+            // the list must contains at least 2 externals
+            if (index == -1 || index == parent.getEnvironment().getSoftwares().size() - 1 || parent.getEnvironment().getSoftwares().size() < 2) {
+                return;
+            }
+            // get the next external
+            Software next = (Software) parent.getEnvironment().getSoftwares().get(index + 1);
+            // switch the external
+            parent.getEnvironment().getSoftwares().set(index + 1, software);
+            parent.getEnvironment().getSoftwares().set(index, next);
+            // update the pane
+            update();
+        }
+    };
+    // copy
+    private ActionListener copy = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // looking for the software object
+            Software software = parent.getEnvironment().getSoftware(event.getActionCommand());
+            if (software == null) {
+                return;
+            }
+            try {
+                KalumetConsoleApplication.getApplication().setCopyComponent(software.clone());
+            } catch (Exception e) {
+                return;
+            }
+        }
+    };
+    // apply
+    private ActionListener apply = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the external software name
+            String name = event.getActionCommand();
+            // get the external software URI textfield
+            TextField uriField = (TextField) SoftwaresPane.this.getComponent("softwareuri_" + parent.getEnvironmentName() + "_" + name);
+            // get the external software URI
+            String uriFieldValue = uriField.getText();
+            // looking for the software object
+            Software software = parent.getEnvironment().getSoftware(name);
+            if (software == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("software.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // add a change event
+            parent.getChangeEvents().add("Change software " + software.getName() + " URI to " + uriFieldValue);
+            // change the external software URI
+            software.setUri(uriFieldValue);
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log tab pane
+            parent.updateJournalPane();
+            // update this pane
+            update();
+        }
+    };
+    private ActionListener update = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().softwaresUpdatePermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if some change has not been saved
+            if (parent.isUpdated()) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the software name
+            final String softwareName = event.getActionCommand();
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // put a message into the log pane and the journal
+                    KalumetConsoleApplication.getApplication().getLogPane().addInfo("Software " + softwareName + " update in progress ...", parent.getEnvironmentName());
+                    parent.getChangeEvents().add("Software " + softwareName + " update requested.");
+                    // start the update thread
+                    final UpdateThread updateThread = new UpdateThread();
+                    updateThread.softwareName = softwareName;
+                    updateThread.start();
+                    // sync with the client
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (updateThread.ended) {
+                                if (updateThread.failure) {
+                                    KalumetConsoleApplication.getApplication().getLogPane().addError(updateThread.message, parent.getEnvironmentName());
+                                    parent.getChangeEvents().add(updateThread.message);
+                                } else {
+                                    KalumetConsoleApplication.getApplication().getLogPane().addConfirm("Software " + softwareName + " updated.", parent.getEnvironmentName());
+                                    parent.getChangeEvents().add("Software " + softwareName + " updated.");
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+            }));
+        }
+    };
+    // test URI
+    private ActionListener testUri = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            String name = event.getActionCommand();
+            TextField uriField = (TextField) SoftwaresPane.this.getComponent("softwareuri_" + parent.getEnvironmentName() + "_" + name);
+            String uri = FileManipulator.format(uriField.getText());
+            boolean exists = false;
+            try {
+                FileManipulator fileManipulator = FileManipulator.getInstance();
+                exists = fileManipulator.exists(uri);
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning("Can't check the URI " + uri + ": " + e.getMessage(), parent.getEnvironmentName());
+            }
+            if (exists) {
+                KalumetConsoleApplication.getApplication().getLogPane().addConfirm("URI " + uri + " exists.", parent.getEnvironmentName());
+            } else {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning("URI " + uri + " doesn't exists.", parent.getEnvironmentName());
+            }
+        }
+    };
+
+    /**
+     * Create a new <code>ExternalsPane</code>.
+     *
+     * @param parent the parent <code>EnvironmentWindow</code>.
+     */
+    public SoftwaresPane(EnvironmentWindow parent) {
+        super();
+        setStyleName("tab.content");
+
+        // update parent
+        this.parent = parent;
+
+        // column layout
+        Column content = new Column();
+        content.setCellSpacing(new Extent(2));
+        add(content);
+
+        // add the create button
+        if (getEnvironmentWindow().adminPermission
+                || getEnvironmentWindow().softwaresPermission) {
+            Button createButton = new Button(Messages.getString("software.add"), Styles.ADD);
+            createButton.addActionListener(create);
+            content.add(createButton);
+        }
+
+        // add external softwares grid
+        grid = new Grid(4);
+        grid.setStyleName("border.grid");
+        grid.setColumnWidth(0, new Extent(50, Extent.PX));
+        grid.setColumnWidth(1, new Extent(20, Extent.PERCENT));
+        grid.setColumnWidth(2, new Extent(60, Extent.PERCENT));
+        grid.setColumnWidth(3, new Extent(20, Extent.PERCENT));
+        content.add(grid);
+
+        // update the pane
+        update();
+    }
+
+    /**
+     * Update the pane.
+     */
+    public void update() {
+        // remove all softwares grid children
+        grid.removeAll();
+
+        // add softwares grid header
+        Label actionHeader = new Label(" ");
+        actionHeader.setStyleName("grid.header");
+        grid.add(actionHeader);
+        Label nameHeader = new Label(Messages.getString("name"));
+        nameHeader.setStyleName("grid.header");
+        grid.add(nameHeader);
+        Label uriHeader = new Label(Messages.getString("uri"));
+        uriHeader.setStyleName("grid.header");
+        grid.add(uriHeader);
+        Label agentHeader = new Label(Messages.getString("agent"));
+        agentHeader.setStyleName("grid.header");
+        grid.add(agentHeader);
+        // add the softwares
+        for (Iterator softwareIterator = parent.getEnvironment().getSoftwares().iterator(); softwareIterator.hasNext(); ) {
+            Software software = (Software) softwareIterator.next();
+            // row
+            Row row = new Row();
+            row.setInsets(new Insets(2));
+            row.setCellSpacing(new Extent(2));
+            grid.add(row);
+            // before JEE resources
+            Button orderButton;
+            if (software.isBeforej2ee()) {
+                orderButton = new Button(Styles.BOOK_PREVIOUS);
+                orderButton.setToolTipText(Messages.getString("switch.afterjee"));
+            } else {
+                orderButton = new Button(Styles.BOOK_NEXT);
+                orderButton.setToolTipText(Messages.getString("switch.beforejee"));
+            }
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().softwaresPermission) {
+                orderButton.setActionCommand(software.getName());
+                orderButton.addActionListener(toggleBefore);
+            }
+            row.add(orderButton);
+            // copy
+            Button copyButton = new Button(Styles.PAGE_COPY);
+            copyButton.setToolTipText(Messages.getString("copy"));
+            copyButton.setActionCommand(software.getName());
+            copyButton.addActionListener(copy);
+            row.add(copyButton);
+            // active
+            Button activeButton;
+            if (software.isActive()) {
+                activeButton = new Button(Styles.LIGHTBULB);
+                activeButton.setToolTipText(Messages.getString("switch.disable"));
+            } else {
+                activeButton = new Button(Styles.LIGHTBULB_OFF);
+                activeButton.setToolTipText(Messages.getString("switch.enable"));
+            }
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().softwaresPermission) {
+                activeButton.setActionCommand(software.getName());
+                activeButton.addActionListener(toggleActive);
+            }
+            row.add(activeButton);
+            // blocker
+            Button blockerButton;
+            if (software.isBlocker()) {
+                blockerButton = new Button(Styles.PLUGIN);
+                blockerButton.setToolTipText(Messages.getString("switch.notblocker"));
+            } else {
+                blockerButton = new Button(Styles.PLUGIN_DISABLED);
+                blockerButton.setToolTipText(Messages.getString("switch.blocker"));
+            }
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().softwaresPermission) {
+                blockerButton.setActionCommand(software.getName());
+                blockerButton.addActionListener(toggleBlocker);
+            }
+            row.add(blockerButton);
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().softwaresPermission) {
+                // up
+                Button upButton = new Button(Styles.ARROW_UP);
+                upButton.setToolTipText(Messages.getString("up"));
+                upButton.setActionCommand(software.getName());
+                upButton.addActionListener(up);
+                row.add(upButton);
+                // down
+                Button downButton = new Button(Styles.ARROW_DOWN);
+                downButton.setToolTipText(Messages.getString("down"));
+                downButton.setActionCommand(software.getName());
+                downButton.addActionListener(down);
+                row.add(downButton);
+            }
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().softwaresUpdatePermission) {
+                // update
+                Button updateButton = new Button(Styles.COG);
+                updateButton.setToolTipText(Messages.getString("update"));
+                updateButton.setActionCommand(software.getName());
+                updateButton.addActionListener(update);
+                row.add(updateButton);
+            }
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().softwaresPermission) {
+                // apply
+                Button applyButton = new Button(Styles.ACCEPT);
+                applyButton.setToolTipText(Messages.getString("apply"));
+                applyButton.setActionCommand(software.getName());
+                applyButton.addActionListener(apply);
+                row.add(applyButton);
+                // delete
+                Button deleteButton = new Button(Styles.DELETE);
+                deleteButton.setToolTipText(Messages.getString("delete"));
+                deleteButton.setActionCommand(software.getName());
+                deleteButton.addActionListener(delete);
+                row.add(deleteButton);
+            }
+            // name
+            Button nameButton = new Button(software.getName());
+            nameButton.setActionCommand(software.getName());
+            nameButton.addActionListener(edit);
+            nameButton.setStyleName("default");
+            grid.add(nameButton);
+            // uri
+            Row uriRow = new Row();
+            grid.add(uriRow);
+            TextField uri = new TextField();
+            uri.setStyleName("default");
+            uri.setWidth(new Extent(500, Extent.PX));
+            uri.setId("softwareuri_" + parent.getEnvironmentName() + "_" + software.getName());
+            uri.setText(software.getUri());
+            uriRow.add(uri);
+            Button uriTestButton = new Button(Styles.WORLD);
+            uriTestButton.setToolTipText(Messages.getString("uri.test"));
+            uriTestButton.setActionCommand(software.getName());
+            uriTestButton.addActionListener(testUri);
+            uriRow.add(uriTestButton);
+            // agent
+            Label agent = new Label(software.getAgent());
+            agent.setStyleName("default");
+            grid.add(agent);
+        }
+    }
+
+    /**
+     * Get the parent <code>EnvironmentWindow</code>.
+     *
+     * @return the parent <code>EnvironmentWindow</code>.
+     */
+    public EnvironmentWindow getEnvironmentWindow() {
+        return parent;
+    }
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatisticsPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatisticsPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatisticsPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatisticsPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.kalumet.console.app;
+
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+
+/**
+ * Environment statistics pane.
+ */
+public class StatisticsPane extends ContentPane {
+
+    private EnvironmentWindow parent;
+    private Label updateCount;
+    private Label lastChangeDate;
+    private Label lastUpdateDate;
+
+
+    /**
+     * Create a new <code>StatisticsPane</code>.
+     *
+     * @param parent the parent <code>EnvironmentWindow</code>.
+     */
+    public StatisticsPane(EnvironmentWindow parent) {
+        super();
+        this.setStyleName("tab.content");
+
+        // update the parent
+        this.parent = parent;
+
+        Grid layout = new Grid(2);
+        layout.setStyleName("default");
+        add(layout);
+
+        Label updateCountLabel = new Label(Messages.getString("update.count"));
+        layout.add(updateCountLabel);
+
+        updateCount = new Label();
+        layout.add(updateCount);
+
+        Label lastChangeDateLabel = new Label(Messages.getString("last.change.date"));
+        layout.add(lastChangeDateLabel);
+
+        lastChangeDate = new Label();
+        layout.add(lastChangeDate);
+
+        Label lastUpLabelLabel = new Label(Messages.getString("last.update.date"));
+        layout.add(lastUpLabelLabel);
+
+        lastUpdateDate = new Label();
+        layout.add(lastUpLabelLabel);
+
+        update();
+    }
+
+    /**
+     * Update the pane.
+     */
+    public void update() {
+
+    }
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatsWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatsWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatsWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatsWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,164 @@
+/*
+ * 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.kalumet.console.app;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.Column;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.SplitPane;
+import nextapp.echo2.app.WindowPane;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import org.apache.kalumet.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.Kalumet;
+
+/**
+ * Stats window.
+ */
+public class StatsWindow extends WindowPane {
+
+    private Label agentsCount;
+    private Label environmentsCount;
+    private Label groupsCount;
+    private Label usersCount;
+
+    /**
+     * Create a new <code>StatsWindow</code>.
+     */
+    public StatsWindow() {
+        super();
+
+        setTitle(Messages.getString("stats"));
+        setId("statswindow");
+        setIcon(Styles.CHART_BAR);
+        setStyleName("stats");
+        setDefaultCloseOperation(WindowPane.DISPOSE_ON_CLOSE);
+
+        // create a split pane for the control buttons
+        SplitPane splitPane = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new Extent(32));
+        add(splitPane);
+
+        // add the control pane
+        Row controlRow = new Row();
+        controlRow.setStyleName("control");
+        splitPane.add(controlRow);
+        // add the refresh button
+        Button refreshButton = new Button(Messages.getString("reload"), Styles.DATABASE_REFRESH);
+        refreshButton.setStyleName("control");
+        refreshButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                update();
+            }
+        });
+        controlRow.add(refreshButton);
+        // add the close button
+        Button closeButton = new Button(Messages.getString("close"), Styles.CROSS);
+        closeButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                userClose();
+            }
+        });
+        closeButton.setStyleName("control");
+        controlRow.add(closeButton);
+
+        // add the content pane
+        Column content = new Column();
+        content.setStyleName("stats");
+        splitPane.add(content);
+
+        // the agents count
+        Row agentsCountRow = new Row();
+        content.add(agentsCountRow);
+        Label agentsCountLabel = new Label(Messages.getString("agents.count") + ": ");
+        agentsCountLabel.setStyleName("default");
+        agentsCountRow.add(agentsCountLabel);
+        agentsCount = new Label(" ");
+        agentsCount.setStyleName("default");
+        agentsCountRow.add(agentsCount);
+
+        // the environments count
+        Row environmentsCountRow = new Row();
+        content.add(environmentsCountRow);
+        Label environmentsCountLabel = new Label(Messages.getString("environments.count") + ": ");
+        environmentsCountLabel.setStyleName("default");
+        environmentsCountRow.add(environmentsCountLabel);
+        environmentsCount = new Label(" ");
+        environmentsCount.setStyleName("default");
+        environmentsCountRow.add(environmentsCount);
+
+        // the groups count
+        Row groupsCountRow = new Row();
+        content.add(groupsCountRow);
+        Label groupsCountLabel = new Label(Messages.getString("groups.count") + ": ");
+        groupsCountLabel.setStyleName("default");
+        groupsCountRow.add(groupsCountLabel);
+        groupsCount = new Label(" ");
+        groupsCount.setStyleName("default");
+        groupsCountRow.add(groupsCount);
+
+        // the users count
+        Row usersCountRow = new Row();
+        content.add(usersCountRow);
+        Label usersCountLabel = new Label(Messages.getString("users.count") + ": ");
+        usersCountLabel.setStyleName("default");
+        usersCountRow.add(usersCountLabel);
+        usersCount = new Label(" ");
+        usersCount.setStyleName("default");
+        usersCountRow.add(usersCount);
+
+        // the reporting buttons
+        Row agentMapRow = new Row();
+        content.add(agentMapRow);
+        Button agentMap = new Button(Messages.getString("stats.agents"), Styles.COG);
+        agentMapRow.add(agentMap);
+
+        Row physicalMapRow = new Row();
+        content.add(physicalMapRow);
+        Button physicalMap = new Button(Messages.getString("stats.physical"), Styles.COMPUTER);
+        physicalMapRow.add(physicalMap);
+
+        Row middlewareMapRow = new Row();
+        content.add(middlewareMapRow);
+        Button middlewareMap = new Button(Messages.getString("stats.middlewares"), Styles.BUILDING);
+        middlewareMapRow.add(middlewareMap);
+
+        update();
+    }
+
+    /**
+     * Update the window content.
+     */
+    public void update() {
+        // parse Kalumet configuration
+        Kalumet kalumet = null;
+        try {
+            kalumet = ConfigurationManager.loadStore();
+        } catch (Exception e) {
+            KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.read") + ": " + e.getMessage());
+            return;
+        }
+        agentsCount.setText(new Integer(kalumet.getAgents().size()).toString());
+        environmentsCount.setText(new Integer(kalumet.getEnvironments().size()).toString());
+        groupsCount.setText(new Integer(kalumet.getSecurity().getGroups().size()).toString());
+        usersCount.setText(new Integer(kalumet.getSecurity().getUsers().size()).toString());
+    }
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/Styles.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/Styles.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/Styles.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/Styles.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,109 @@
+/*
+ * 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.kalumet.console.app;
+
+import nextapp.echo2.app.ImageReference;
+import nextapp.echo2.app.ResourceImageReference;
+import nextapp.echo2.app.StyleSheet;
+import nextapp.echo2.app.componentxml.ComponentXmlException;
+import nextapp.echo2.app.componentxml.StyleSheetLoader;
+
+/**
+ * Define the look'n feel information.
+ */
+public class Styles {
+
+    public static final String ICONS_PATH = "/org/apache/kalumet/console/app/resources/icons/";
+    public static final String STYLE_PATH = "/org/apache/kalumet/console/app/resources/style/";
+
+    // default style sheet.
+    public static final StyleSheet DEFAULT_STYLE_SHEET;
+
+    static {
+        try {
+            DEFAULT_STYLE_SHEET = StyleSheetLoader.load(STYLE_PATH + "default.stylesheet", Thread.currentThread().getContextClassLoader());
+        } catch (ComponentXmlException exception) {
+            throw new RuntimeException(exception);
+        }
+    }
+
+    // icons
+    public static final ImageReference ACCEPT = new ResourceImageReference(ICONS_PATH + "accept.png");
+    public static final ImageReference ADD = new ResourceImageReference(ICONS_PATH + "add.png");
+    public static final ImageReference APPLICATION = new ResourceImageReference(ICONS_PATH + "application.png");
+    public static final ImageReference APPLICATION_ADD = new ResourceImageReference(ICONS_PATH + "application_add.png");
+    public static final ImageReference APPLICATION_DELETE = new ResourceImageReference(ICONS_PATH + "application_delete.png");
+    public static final ImageReference ARROW_DOWN = new ResourceImageReference(ICONS_PATH + "arrow_down.png");
+    public static final ImageReference ARROW_LEFT = new ResourceImageReference(ICONS_PATH + "arrow_left.png");
+    public static final ImageReference ARROW_RIGHT = new ResourceImageReference(ICONS_PATH + "arrow_right.png");
+    public static final ImageReference ARROW_UP = new ResourceImageReference(ICONS_PATH + "arrow_up.png");
+    public static final ImageReference CROSS = new ResourceImageReference(ICONS_PATH + "cross.png");
+    public static final ImageReference BRICK = new ResourceImageReference(ICONS_PATH + "brick.png");
+    public static final ImageReference BRICK_ADD = new ResourceImageReference(ICONS_PATH + "brick_add.png");
+    public static final ImageReference BRICK_DELETE = new ResourceImageReference(ICONS_PATH + "brick_delete.png");
+    public static final ImageReference BOOK_NEXT = new ResourceImageReference(ICONS_PATH + "book_next.png");
+    public static final ImageReference BOOK_PREVIOUS = new ResourceImageReference(ICONS_PATH + "book_previous.png");
+    public static final ImageReference BUILDING = new ResourceImageReference(ICONS_PATH + "building.png");
+    public static final ImageReference CHART_BAR = new ResourceImageReference(ICONS_PATH + "chart_bar.png");
+    public static final ImageReference COG = new ResourceImageReference(ICONS_PATH + "cog.png");
+    public static final ImageReference COG_ADD = new ResourceImageReference(ICONS_PATH + "cog_add.png");
+    public static final ImageReference COG_DELETE = new ResourceImageReference(ICONS_PATH + "cog_delete.png");
+    public static final ImageReference COMPUTER = new ResourceImageReference(ICONS_PATH + "computer.png");
+    public static final ImageReference COMPUTER_EDIT = new ResourceImageReference(ICONS_PATH + "computer_edit.png");
+    public static final ImageReference DATABASE = new ResourceImageReference(ICONS_PATH + "database.png");
+    public static final ImageReference DATABASE_ADD = new ResourceImageReference(ICONS_PATH + "database_add.png");
+    public static final ImageReference DATABASE_GEAR = new ResourceImageReference(ICONS_PATH + "database_gear.png");
+    public static final ImageReference DATABASE_GO = new ResourceImageReference(ICONS_PATH + "database_go.png");
+    public static final ImageReference DATABASE_REFRESH = new ResourceImageReference(ICONS_PATH + "database_refresh.png");
+    public static final ImageReference DATABASE_SAVE = new ResourceImageReference(ICONS_PATH + "database_save.png");
+    public static final ImageReference DELETE = new ResourceImageReference(ICONS_PATH + "delete.png");
+    public static final ImageReference DISCONNECT = new ResourceImageReference(ICONS_PATH + "disconnect.png");
+    public static final ImageReference DOOR_IN = new ResourceImageReference(ICONS_PATH + "door_in.png");
+    public static final ImageReference DRIVE_WEB = new ResourceImageReference(ICONS_PATH + "drive_web.png");
+    public static final ImageReference ERROR = new ResourceImageReference(ICONS_PATH + "error.png");
+    public static final ImageReference EXCLAMATION = new ResourceImageReference(ICONS_PATH + "exclamation.png");
+    public static final ImageReference FLAG_GREEN = new ResourceImageReference(ICONS_PATH + "flag_green.png");
+    public static final ImageReference FLAG_RED = new ResourceImageReference(ICONS_PATH + "flag_red.png");
+    public static final ImageReference FOLDER_EXPLORE = new ResourceImageReference(ICONS_PATH + "folder_explore.png");
+    public static final ImageReference GROUP_ADD = new ResourceImageReference(ICONS_PATH + "group_add.png");
+    public static final ImageReference GROUP_DELETE = new ResourceImageReference(ICONS_PATH + "group_delete.png");
+    public static final ImageReference GROUP_EDIT = new ResourceImageReference(ICONS_PATH + "group_edit.png");
+    public static final ImageReference GROUP = new ResourceImageReference(ICONS_PATH + "group.png");
+    public static final ImageReference INFORMATION = new ResourceImageReference(ICONS_PATH + "information.png");
+    public static final ImageReference LIGHTBULB = new ResourceImageReference(ICONS_PATH + "lightbulb.png");
+    public static final ImageReference LIGHTBULB_OFF = new ResourceImageReference(ICONS_PATH + "lightbulb_off.png");
+    public static final ImageReference LORRY = new ResourceImageReference(ICONS_PATH + "lorry.png");
+    public static final ImageReference LOCK = new ResourceImageReference(ICONS_PATH + "lock.png");
+    public static final ImageReference PAGE_COPY = new ResourceImageReference(ICONS_PATH + "page_copy.png");
+    public static final ImageReference PAGE_PASTE = new ResourceImageReference(ICONS_PATH + "page_paste.png");
+    public static final ImageReference PLUGIN = new ResourceImageReference(ICONS_PATH + "plugin.png");
+    public static final ImageReference PLUGIN_DISABLED = new ResourceImageReference(ICONS_PATH + "plugin_disabled.png");
+    public static final ImageReference SCRIPT = new ResourceImageReference(ICONS_PATH + "script.png");
+    public static final ImageReference SERVER_ADD = new ResourceImageReference(ICONS_PATH + "server_add.png");
+    public static final ImageReference SERVER_DELETE = new ResourceImageReference(ICONS_PATH + "server_delete.png");
+    public static final ImageReference STOP = new ResourceImageReference(ICONS_PATH + "stop.png");
+    public static final ImageReference TIME = new ResourceImageReference(ICONS_PATH + "time.png");
+    public static final ImageReference USER_ADD = new ResourceImageReference(ICONS_PATH + "user_add.png");
+    public static final ImageReference USER_DELETE = new ResourceImageReference(ICONS_PATH + "user_delete.png");
+    public static final ImageReference USER_EDIT = new ResourceImageReference(ICONS_PATH + "user_edit.png");
+    public static final ImageReference USER = new ResourceImageReference(ICONS_PATH + "user.png");
+    public static final ImageReference WORLD = new ResourceImageReference(ICONS_PATH + "world.png");
+    public static final ImageReference WRENCH = new ResourceImageReference(ICONS_PATH + "wrench.png");
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ViewFileWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ViewFileWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ViewFileWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ViewFileWindow.java Wed Nov 23 20:52:16 2011
@@ -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.kalumet.console.app;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Insets;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.SplitPane;
+import nextapp.echo2.app.TextArea;
+import nextapp.echo2.app.WindowPane;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import nextapp.echo2.app.layout.SplitPaneLayoutData;
+import org.apache.kalumet.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.Agent;
+import org.apache.kalumet.model.Kalumet;
+import org.apache.kalumet.ws.client.FileClient;
+
+/**
+ * Window displaying the content of a file.
+ */
+public class ViewFileWindow extends WindowPane {
+
+    private String path;
+    private String agentId;
+    private Label statusLabel;
+    private TextArea contentArea;
+
+    // view thread
+    class ViewThread extends Thread {
+
+        public boolean ended = false;
+        public boolean failure = false;
+        public String path;
+        public String agentId;
+        public String message;
+
+        public void run() {
+            try {
+                // load Kalumet configuration
+                Kalumet kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(agentId);
+                if (agent == null) {
+                    throw new IllegalArgumentException("agent " + agentId + " not found.");
+                }
+                // call the WebService
+                FileClient client = new FileClient(agent.getHostname(), agent.getPort());
+                message = client.view(path);
+            } catch (Exception e) {
+                failure = true;
+                message = "Can't view " + path + ": " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+
+    }
+
+    // refresh
+    private ActionListener refresh = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            update();
+        }
+    };
+
+    /**
+     * Create a window to display the content of the given file.
+     *
+     * @param path    the file path to display content.
+     * @param agentId the agent id to use to view the file.
+     */
+    public ViewFileWindow(String path, String agentId) {
+        super();
+
+        this.path = path;
+        this.agentId = agentId;
+
+        this.setStyleName("default");
+        this.setTitle("View file " + path);
+        this.setIcon(Styles.SCRIPT);
+        this.setWidth(new Extent(600, Extent.PX));
+        this.setHeight(new Extent(400, Extent.PX));
+
+        // add the split pane
+        SplitPane splitPane = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new Extent(32));
+        add(splitPane);
+
+        // add the control row
+        Row controlRow = new Row();
+        controlRow.setStyleName("control");
+        splitPane.add(controlRow);
+
+        // add the refresh button
+        Button refreshButton = new Button(Messages.getString("reload"), Styles.DATABASE_REFRESH);
+        refreshButton.setStyleName("control");
+        refreshButton.addActionListener(refresh);
+        controlRow.add(refreshButton);
+
+        // add the close button
+        Button closeButton = new Button(Messages.getString("close"), Styles.CROSS);
+        closeButton.setStyleName("control");
+        closeButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                ViewFileWindow.this.userClose();
+            }
+        });
+        controlRow.add(closeButton);
+
+        // add the content column
+        SplitPane content = new SplitPane(SplitPane.ORIENTATION_VERTICAL_TOP_BOTTOM, new Extent(20));
+        splitPane.add(content);
+
+        // add the status label
+        statusLabel = new Label();
+        statusLabel.setStyleName("default");
+        SplitPaneLayoutData layoutData = new SplitPaneLayoutData();
+        layoutData.setInsets(new Insets(4));
+        statusLabel.setLayoutData(layoutData);
+        content.add(statusLabel);
+
+        // add the file content area
+        contentArea = new TextArea();
+        contentArea.setStyleName("default");
+        contentArea.setLayoutData(layoutData);
+        contentArea.setWidth(new Extent(100, Extent.PERCENT));
+        contentArea.setHeight(new Extent(98, Extent.PERCENT));
+        contentArea.setEnabled(false);
+        content.add(contentArea);
+
+        // update the pane
+        update();
+    }
+
+    public void update() {
+        statusLabel.setText("Please wait ...");
+        statusLabel.setIcon(Styles.ERROR);
+
+        // launch the view thread
+        final ViewThread viewThread = new ViewThread();
+        viewThread.agentId = agentId;
+        viewThread.path = path;
+        viewThread.start();
+
+        // sync with the client
+        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+            public void run() {
+                if (viewThread.ended) {
+                    if (viewThread.failure) {
+                        statusLabel.setText(viewThread.message);
+                        statusLabel.setIcon(Styles.EXCLAMATION);
+                    } else {
+                        statusLabel.setText("File loaded.");
+                        statusLabel.setIcon(Styles.ACCEPT);
+                        contentArea.setText(viewThread.message);
+                    }
+                } else {
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                }
+            }
+        });
+    }
+
+}

Added: incubator/kalumet/trunk/console/src/main/resources/org/apache/kalumet/console/app/templates/environment-homepage.html
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/resources/org/apache/kalumet/console/app/templates/environment-homepage.html?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/resources/org/apache/kalumet/console/app/templates/environment-homepage.html (added)
+++ incubator/kalumet/trunk/console/src/main/resources/org/apache/kalumet/console/app/templates/environment-homepage.html Wed Nov 23 20:52:16 2011
@@ -0,0 +1,181 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+  <head>
+    <title>ENVIRONMENT_NAME</title>
+    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
+    <meta http-equiv="pragma" content="no-cache"/>
+    <meta http-equiv="Content-Language" content="en-US"/>
+    <style>
+    <!--
+body {
+  margin: 0;
+  padding: 0;
+  background-color: #ffffff;
+}
+
+input {
+  background-color: #dbdbdb;
+  color: #000000;
+  font: 10px helvetica, sans-serif;
+  text-align: right;
+}
+
+input[type=text] {
+   width: 98%;
+}
+
+input.cronin {
+   width: 10%;
+}
+
+input[type=password] {
+   width: 98%;
+}
+
+select {
+  background-color: #dbdbdb;
+  color: #000000;
+  font: 10px helvetica, sans-serif;
+  text-align: right;
+}
+
+#header {
+  background-color: #f0f0f0;
+  width: 100%;
+  font: bold 14px helvetica, sans-serif;
+  color: #000000;
+}
+
+#topmenu {
+  background-color: #cdcdcd;
+  font: 10px helvatica, sans-serif;
+}
+
+#topmenu a {
+  text-decoration: none;
+  color: black;
+}
+
+#topmenu a:hover {
+  text-decoration: none;
+  background-color: #5a5a5a;
+  color: #bfbfbf;
+}
+
+#central {
+  width: 100%;
+  font: 10px helvetica, sans-serif;
+}
+
+#leftmenu {
+  float: left;
+  width: 19%;
+  font: 10px helvetica, sans-serif;
+  color: #f0f0f0;
+  margin: 0;
+}
+
+#leftmenu h2 {
+  font: bold 10px helvetica, sans-serif;
+  color: black;
+  background-color: white;
+}
+
+#leftmenu h3 {
+  font: bold 10px helvetica, sans-serif;
+  color: #5a5a5a;
+  background-color: #bfbfbf;
+}
+
+#leftmenu a {
+  text-decoration: none;
+  color: #5a5a5a;
+}
+
+#leftmenu a:hover {
+  text-decoration: none;
+  color: #5a5a5a;
+  background-color: #bfbfbf;
+}
+
+#maincontent {
+  float: right;
+  margin-left: 22%;
+  width: 79%;
+  margin: 0;
+  font: 10px helvetica, sans-serif;
+}
+
+#part {
+  font: 10px helvetica, sans-serif;
+  border: 1px solid black;
+  margin: 0px;
+  padding: 2px;
+}
+
+#part h3 {
+  font: bold 10px helvetica, sans-serif;
+  margin: 0;
+  color: #5a5a5a;
+  background-color: #bfbfbf;
+}
+
+#part a {
+  font-weight: bold;
+  color: red;
+  text-decoration: none;
+}
+
+#part table {
+  background-color: #efefef;
+  margin-left: 5%;
+}
+
+#part tr {
+  vertical-align: top;
+}
+
+#footer {
+  width: 100%;
+  clear: both;
+  margin-top: 10px;
+  padding-top: 10px;
+  position: relative;
+  font: 8px helvetica, sans-serif;
+  text-align: center;
+}
+    -->
+    </style>
+  </head>
+  
+  <body>
+
+    <div id="header">
+      ENVIRONMENT_NAME
+    </div>
+    <div id="topmenu">
+      <hr/>
+        &nbsp; &nbsp;
+        ENVIRONMENT_APPLICATIONS
+        <hr/>
+    </div>
+
+    <div id="central">
+      <div id="leftmenu">
+        <h3>&nbsp; Environment Links</h3>
+        ENVIRONMENT_WEBLINKS
+      </div>
+      <div id="content">
+        &nbsp; &nbsp; &nbsp;
+        ENVIRONMENT_NOTES
+      </div>
+    </div>
+
+    <div id="footer">
+      <hr/>
+      Copyright (c) 2006 - BuildProcess - All Rights Reserved
+    </div>
+
+  </body>
+
+</html>

Modified: incubator/kalumet/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/pom.xml?rev=1205585&r1=1205584&r2=1205585&view=diff
==============================================================================
--- incubator/kalumet/trunk/pom.xml (original)
+++ incubator/kalumet/trunk/pom.xml Wed Nov 23 20:52:16 2011
@@ -165,6 +165,8 @@
         <commons-lang.version>2.6</commons-lang.version>
         <commons-net.version>3.0.1</commons-net.version>
         <commons-vfs.version>1.0</commons-vfs.version>
+        <echo2.version>2.1.1</echo2.version>
+        <echo2.extras.version>2.1.0</echo2.extras.version>
         <junit.version>4.9</junit.version>
         <jta.version>1.1.1</jta.version>
         <log4j.version>1.2.16</log4j.version>
@@ -176,6 +178,20 @@
         <xml-apis.version>2.0.2</xml-apis.version>
     </properties>
 
+    <repositories>
+        <repository>
+            <id>kalumet.m2</id>
+            <name>Kalumet M2 repo</name>
+            <url>https://svn.apache.org/repos/asf/incubator/kalumet/m2-repo</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
@@ -274,6 +290,31 @@
                 <version>${commons-vfs.version}</version>
             </dependency>
             <dependency>
+                <groupId>com.nextapp.echo</groupId>
+                <artifactId>app</artifactId>
+                <version>${echo2.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.nextapp.echo</groupId>
+                <artifactId>webcontainer</artifactId>
+                <version>${echo2.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.nextapp.echo</groupId>
+                <artifactId>webrender</artifactId>
+                <version>${echo2.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.nextapp.echo.extras</groupId>
+                <artifactId>app</artifactId>
+                <version>${echo2.extras.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.nextapp.echo.extras</groupId>
+                <artifactId>webcontainer</artifactId>
+                <version>${echo2.extras.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>${junit.version}</version>



Mime
View raw message