You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kalumet-commits@incubator.apache.org by jb...@apache.org on 2011/11/23 20:52:25 UTC

svn commit: r1205585 [1/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/

Author: jbonofre
Date: Wed Nov 23 20:52:16 2011
New Revision: 1205585

URL: http://svn.apache.org/viewvc?rev=1205585&view=rev
Log:
Import Kalumet console.

Added:
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AboutWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ActionPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentsWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminConfigurationWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminGroupWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminGroupsWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminUserWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminUsersWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationArchiveWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationArchivesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationConfigurationFileWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationConfigurationFilesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationContentManagerWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationContentManagersPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationDatabaseSqlScriptWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationDatabaseWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationDatabasesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationGeneralPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationServerCachesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationServerGeneralPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationServerWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationServersPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationsPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/CheckerPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConfirmWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionFactoriesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolCapacityPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDatabasePane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDriverPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolGeneralPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolsPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/DataSourcesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/EnvironmentWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/EnvironmentsPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ErrorWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/FileBrowserPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/GeneralPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/HomePageWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/InfoWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsQueuesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerGeneralPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServersPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsTopicsPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JournalPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/KalumetConsoleApplication.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/KalumetConsoleServlet.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/LogPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/LogViewerPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/LoginScreen.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/MainScreen.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/Messages.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/NameSpaceBindingsPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/NotifierWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/NotifiersPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/PreferencesWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/PublishReleaseWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/PublisherWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/PublishersPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SecurityPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SharedLibrariesPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ShellPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwareCommandWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwareConfigurationFileWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwareDatabaseSqlScriptWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwareDatabaseWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwareLocationWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwareWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwaresPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatisticsPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/StatsWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/Styles.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ViewFileWindow.java
    incubator/kalumet/trunk/console/src/main/resources/org/apache/kalumet/console/app/templates/
    incubator/kalumet/trunk/console/src/main/resources/org/apache/kalumet/console/app/templates/environment-homepage.html
Modified:
    incubator/kalumet/trunk/console/pom.xml
    incubator/kalumet/trunk/pom.xml

Modified: incubator/kalumet/trunk/console/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/pom.xml?rev=1205585&r1=1205584&r2=1205585&view=diff
==============================================================================
--- incubator/kalumet/trunk/console/pom.xml (original)
+++ incubator/kalumet/trunk/console/pom.xml Wed Nov 23 20:52:16 2011
@@ -37,6 +37,34 @@
             <groupId>org.apache.kalumet</groupId>
             <artifactId>org.apache.kalumet.common</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.kalumet</groupId>
+            <artifactId>org.apache.kalumet.utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.nextapp.echo</groupId>
+            <artifactId>app</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.nextapp.echo</groupId>
+            <artifactId>webcontainer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.nextapp.echo</groupId>
+            <artifactId>webrender</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.nextapp.echo.extras</groupId>
+            <artifactId>app</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.nextapp.echo.extras</groupId>
+            <artifactId>webcontainer</artifactId>
+        </dependency>
 		<dependency>
 			<groupId>javax.servlet</groupId>
 			<artifactId>servlet-api</artifactId>

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AboutWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AboutWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AboutWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AboutWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,113 @@
+/*
+ * 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;
+
+/**
+ * About window.
+ */
+public class AboutWindow extends WindowPane {
+
+    /**
+     * Create a new <code>AboutWindow</code>.
+     */
+    public AboutWindow() {
+        super();
+
+        setTitle(Messages.getString("about"));
+        setIcon(Styles.INFORMATION);
+        setStyleName("about");
+        setId("aboutwindow");
+        setModal(true);
+        setDefaultCloseOperation(WindowPane.DISPOSE_ON_CLOSE);
+
+        Label label;
+
+        // split pane to put control
+        SplitPane splitPane = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new Extent(32));
+        add(splitPane);
+
+        // control row
+        Row controlRow = new Row();
+        controlRow.setStyleName("control");
+        splitPane.add(controlRow);
+
+        // close button
+        Button closeButton = new Button(Messages.getString("close"), Styles.CROSS);
+        closeButton.setStyleName("control");
+        closeButton.addActionListener(new ActionListener() {
+
+            private static final long serialVersionUID = 8624164259974769878L;
+
+            public void actionPerformed(ActionEvent e) {
+                AboutWindow.this.userClose();
+            }
+        });
+        controlRow.add(closeButton);
+
+        // define a column to store the several labels
+        Column column = new Column();
+        column.setStyleName("about");
+        column.setCellSpacing(new Extent(5));
+
+        // define the title label
+        label = new Label(Messages.getString("kalumet.console"));
+        label.setStyleName("about.title");
+        column.add(label);
+
+        // define version label if possible
+        Package p = Package.getPackage("org.apache.kalumet.console");
+        if (p != null && p.getImplementationVersion() != null) {
+            label = new Label("Version: " + p.getImplementationVersion());
+        } else {
+            label = new Label("");
+        }
+        label.setStyleName("default");
+        column.add(label);
+
+        // define the jvm label
+        label = new Label("JVM: " + System.getProperty("java.vm.vendor") + " " + System.getProperty("java.vm.name") + " " + System.getProperty("java.vm.version"));
+        label.setStyleName("default");
+        column.add(label);
+
+        // define the os label
+        label = new Label("Host: " + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
+        label.setStyleName("default");
+        column.add(label);
+
+        // define the copyright label
+        label = new Label("Apache 2.0 License");
+        label.setStyleName("default");
+        column.add(label);
+
+        // add the column to the split pane
+        splitPane.add(column);
+
+    }
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ActionPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ActionPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ActionPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ActionPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,230 @@
+/*
+ * 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.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+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.EnvironmentClient;
+
+/**
+ * Environment updater pane.
+ */
+public class ActionPane extends ContentPane {
+
+   private EnvironmentWindow parent;
+   
+   // update thread
+   class UpdateThread extends Thread {
+       
+       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
+             EnvironmentClient webServiceClient = new EnvironmentClient(agent.getHostname(), agent.getPort());
+             webServiceClient.update(parent.getEnvironmentName());
+         } catch (Exception e) {
+             message = "Environment " + parent.getEnvironmentName() + " update failed: " + e.getMessage();
+             failure = true;
+         } finally {
+             ended = true;
+         }
+      }
+
+   }
+   
+   // update
+   private ActionListener update = new ActionListener() {
+      public void actionPerformed(ActionEvent event) {
+         // check if the user has the lock
+         if (!parent.getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"));
+             return;
+         }
+         // check if no modifications are in progress
+         if (parent.isUpdated()) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"));
+             return;
+         }
+         // check if the user can launch the update
+         if (!parent.adminPermission && !parent.updatePermission) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"));
+             return;
+         }
+         
+         // add confirm window
+         KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+             public void actionPerformed(ActionEvent event) {
+                 // put message in the action events column
+                 KalumetConsoleApplication.getApplication().getLogPane().addInfo(parent.getEnvironmentName() + " update in progress ...", parent.getEnvironmentName());
+                 // launch the asynchronous task
+                 final UpdateThread updateThread = new UpdateThread();
+                 updateThread.start();
+                 // synchro
+                 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());
+                            } else {
+                                KalumetConsoleApplication.getApplication().getLogPane().addConfirm("Environment " + parent.getEnvironmentName() + " updated.", parent.getEnvironmentName());
+                            }
+                        } else {
+                            KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                        }
+                    }
+                 });
+             }
+         }));
+      }
+   };
+   // publish release
+   private ActionListener publishRelease = new ActionListener() {
+      public void actionPerformed(ActionEvent event) {
+         // check if the user has the lock
+         if (!parent.getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.warn.locked"));
+             return;
+         }
+         // check if the user has the permission to publish a release
+         if (!parent.adminPermission && !parent.releasePermission) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"));
+             return;
+         }
+         // check if no modifications are in progress
+         if (parent.isUpdated()) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"));
+             return;
+         }
+         if (KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().getComponent("publishreleasewindow_" + parent.getEnvironmentName()) == null) {
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new PublishReleaseWindow(parent));
+         }
+      }
+   };
+   // publish home page
+   private ActionListener publishHomePage = new ActionListener() {
+      public void actionPerformed(ActionEvent event) {
+         // check if the user has the lock
+         if (!parent.getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.warn.locked"));
+             return;
+         }
+         // check if the user can publish homepage
+         if (!parent.adminPermission && !parent.homepagePermission) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"));
+             return;
+         }
+         // check if no modifications are in progress
+         if (parent.isUpdated()) {
+             KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"));
+             return;
+         }
+         if (KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().getComponent("homepagewindow_" + parent.getEnvironmentName()) == null) {
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new HomePageWindow(parent));
+         }
+      }
+   };
+
+   /**
+    * Create a new <code>UpdaterPane</code>.
+    * 
+    * @param parent the parent <code>EnvironmentWindow</code>.
+    */
+   public ActionPane(EnvironmentWindow parent) {
+      super();
+      setStyleName("tab.content");
+
+      // update parent
+      this.parent = parent;
+      
+      Grid layout = new Grid(2);
+      layout.setStyleName("border.grid");
+      layout.setColumnWidth(0, new Extent(50, Extent.PX));
+      add(layout);
+      
+      // add environment grid header
+      Label environmentActionHeader = new Label(" ");
+      environmentActionHeader.setStyleName("grid.header");
+      layout.add(environmentActionHeader);
+      Label environmentHeader = new Label(Messages.getString("environment"));
+      environmentHeader.setStyleName("grid.header");
+      layout.add(environmentHeader);
+      
+      if (parent.adminPermission || parent.updatePermission) {
+          // update button
+          Button updateButton = new Button(Styles.COG);
+          updateButton.addActionListener(update);
+          layout.add(updateButton);
+          Button updateLabel = new Button(Messages.getString("update"));
+          updateLabel.setStyleName("default");
+          updateLabel.addActionListener(update);
+          layout.add(updateLabel);
+      }
+
+      if (parent.adminPermission || parent.releasePermission) {
+          // release button
+          Button releaseButton = new Button(Styles.LORRY);
+          releaseButton.addActionListener(publishRelease);
+          layout.add(releaseButton);
+          Button releaseLabel = new Button(Messages.getString("release"));
+          releaseLabel.setStyleName("default");
+          releaseLabel.addActionListener(publishRelease);
+          layout.add(releaseLabel);
+      }
+
+      if (parent.adminPermission || parent.homepagePermission) {
+          // homepage button
+          Button homePageButton = new Button(Styles.DRIVE_WEB);
+          homePageButton.addActionListener(publishHomePage);
+          layout.add(homePageButton);
+          Button homePageLabel = new Button(Messages.getString("homepage"));
+          homePageLabel.setStyleName("default");
+          homePageLabel.addActionListener(publishHomePage);
+          layout.add(homePageLabel);
+      }
+      
+      // update this pane
+      update();
+   }
+
+   /**
+    * Update the pane.
+    */
+   public void update() {
+       // nothing to do
+   }
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,433 @@
+/*
+ * 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.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.SplitPane;
+import nextapp.echo2.app.TextArea;
+import nextapp.echo2.app.TextField;
+import nextapp.echo2.app.WindowPane;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import nextapp.echo2.extras.app.TabPane;
+import nextapp.echo2.extras.app.layout.TabPaneLayoutData;
+import org.apache.kalumet.model.Agent;
+import org.apache.kalumet.ws.client.AgentClient;
+
+/**
+ * Admin agent window.
+ */
+public class AdminAgentWindow extends WindowPane {
+
+    // attributes
+    private String agentId;
+    private Agent agent;
+    private AdminAgentsWindow parent;
+    private TextField idField;
+    private TextField hostnameField;
+    private TextField portField;
+    private TextField cronField;
+    private TextField maxEnvironmentsField;
+    private TextField maxActiveApplicationServersField;
+
+    // status thread
+    class StatusThread extends Thread {
+
+        public boolean ended = false;
+        public boolean failure = false;
+        public String message;
+
+        public void run() {
+            try {
+                // call the WebService client
+                AgentClient client = new AgentClient(agent.getHostname(), agent.getPort());
+                message = "Agent " + agentId + " version " + client.getVersion() + " started.";
+            } catch (Exception e) {
+                failure = true;
+                message = "Agent " + agentId + " status check failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // close
+    private ActionListener close = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            AdminAgentWindow.this.userClose();
+        }
+    };
+    // refresh
+    private ActionListener refresh = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            for (Iterator agentIterator = parent.getAgents().iterator(); agentIterator.hasNext(); ) {
+                Agent current = (Agent) agentIterator.next();
+                if (agent.getId().equals(agentId)) {
+                    agent = current;
+                    break;
+                }
+            }
+            if (agent == null) {
+                agent = new Agent();
+            }
+            update();
+        }
+    };
+    // apply
+    private ActionListener apply = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user is the admin
+            if (!KalumetConsoleApplication.getApplication().getUserid().equals("admin")) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("agents.restricted"));
+                return;
+            }
+
+            String newId = idField.getText().trim();
+            String newHostname = hostnameField.getText().trim();
+            String newPort = portField.getText().trim();
+            String newCron = cronField.getText().trim();
+            String newMaxEnvironments = maxEnvironmentsField.getText().trim();
+            String newMaxEnvironmentsActive = maxActiveApplicationServersField.getText().trim();
+
+            // check fields
+            if (newId.length() < 1) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("agent.mandatory"));
+                return;
+            }
+            // if the admin change the agent id or if it's a new agent, check if
+            // the id is not already used
+            if (agentId == null || agentId.trim().length() < 1 || ((agentId != null) && (agentId.trim().length() > 0) && (!newId.equals(agentId)))) {
+                for (Iterator agentIterator = parent.getAgents().iterator(); agentIterator.hasNext(); ) {
+                    Agent current = (Agent) agentIterator.next();
+                    if (current.getId().equals(newId)) {
+                        KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("agent.exists"));
+                        return;
+                    }
+                }
+            }
+
+            // update the current agent
+            agent.setId(newId);
+            agent.setHostname(newHostname);
+            agent.setPort(new Integer(newPort).intValue());
+            if (newCron.length() < 1) {
+                newCron = "0 0 0 * * ?";
+            }
+            agent.setCron(newCron);
+            agent.setMaxmanagedenvironments(new Integer(newMaxEnvironments).intValue());
+            agent.setMaxj2eeapplicationserversstarted(new Integer(newMaxEnvironmentsActive).intValue());
+            if (agentId == null || agentId.trim().length() < 1) {
+                // it's a new agent
+                parent.getAgents().add(agent);
+            }
+            setTitle(Messages.getString("agent") + " " + agent.getId());
+            setId("agentwindow_" + agent.getId());
+            agentId = agent.getId();
+            parent.update();
+        }
+    };
+    // paste
+    public ActionListener paste = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // get the copy component
+            Object copy = KalumetConsoleApplication.getApplication().getCopyComponent();
+            if (copy == null || !(copy instanceof Agent)) {
+                return;
+            }
+            Agent clone = (Agent) copy;
+            idField.setText(clone.getId());
+            hostnameField.setText(clone.getHostname());
+            portField.setText(new Integer(clone.getPort()).toString());
+            cronField.setText(clone.getCron());
+            maxEnvironmentsField.setText(new Integer(clone.getMaxmanagedenvironments()).toString());
+            maxActiveApplicationServersField.setText(new Integer(clone.getMaxj2eeapplicationserversstarted()).toString());
+        }
+    };
+    // delete
+    public ActionListener delete = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // display a confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // looking for the agent to remove
+                    Agent agentToRemove = null;
+                    for (Iterator agentIterator = parent.getAgents().iterator(); agentIterator.hasNext(); ) {
+                        Agent agent = (Agent) agentIterator.next();
+                        if (agent.getId().equals(agentId)) {
+                            agentToRemove = agent;
+                            break;
+                        }
+                    }
+                    parent.getAgents().remove(agentToRemove);
+                    AdminAgentWindow.this.userClose();
+                }
+            }));
+        }
+    };
+    // status
+    public ActionListener status = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // add an event
+            KalumetConsoleApplication.getApplication().getLogPane().addInfo("Agent " + agentId + " status check in progress ...");
+            // start the status thread
+            final StatusThread statusThread = new StatusThread();
+            statusThread.start();
+            // sync with the client
+            KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                public void run() {
+                    if (statusThread.ended) {
+                        if (statusThread.failure) {
+                            KalumetConsoleApplication.getApplication().getLogPane().addError(statusThread.message);
+                        } else {
+                            KalumetConsoleApplication.getApplication().getLogPane().addConfirm(statusThread.message);
+                        }
+                    } else {
+                        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                    }
+                }
+            });
+        }
+    };
+
+    /**
+     * Create a new <code>AdminAgentWindow</code>.
+     *
+     * @param parent  the <code>AdminAgentsWindow</code> parent.
+     * @param agentId the <code>Agent</code> ID.
+     */
+    public AdminAgentWindow(AdminAgentsWindow parent, String agentId) {
+        super();
+
+        // check if the user that try to access this window is the admin
+        if (!KalumetConsoleApplication.getApplication().getUserid().equals("admin")) {
+            KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("agents.restricted"));
+            AdminAgentWindow.this.userClose();
+            return;
+        }
+
+        // update the original agent id and parent admin agents window
+        this.parent = parent;
+        this.agentId = agentId;
+
+        // update the agent object from agents parent list
+        for (Iterator agentIterator = parent.getAgents().iterator(); agentIterator.hasNext(); ) {
+            Agent current = (Agent) agentIterator.next();
+            if (current.getId().equals(agentId)) {
+                this.agent = current;
+                break;
+            }
+        }
+        if (this.agent == null) {
+            this.agent = new Agent();
+        }
+
+        if (agentId == null) {
+            setTitle(Messages.getString("agent"));
+        } else {
+            setTitle(Messages.getString("agent") + " " + agentId);
+        }
+        setIcon(Styles.COG);
+        setId("agentwindow_" + agentId);
+        setStyleName("agent");
+        setModal(false);
+        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(refresh);
+        controlRow.add(refreshButton);
+        // add the delete button
+        Button deleteButton = new Button(Messages.getString("delete"), Styles.DELETE);
+        deleteButton.setStyleName("control");
+        deleteButton.addActionListener(delete);
+        controlRow.add(deleteButton);
+        // add the paste button
+        Button pasteButton = new Button(Messages.getString("paste"), Styles.PAGE_PASTE);
+        pasteButton.setStyleName("control");
+        pasteButton.addActionListener(paste);
+        controlRow.add(pasteButton);
+        // add the status button
+        Button statusButton = new Button(Messages.getString("status"), Styles.INFORMATION);
+        statusButton.setStyleName("control");
+        statusButton.addActionListener(status);
+        controlRow.add(statusButton);
+        // add the apply button
+        Button applyButton = new Button(Messages.getString("apply"), Styles.ACCEPT);
+        applyButton.setStyleName("control");
+        applyButton.addActionListener(apply);
+        controlRow.add(applyButton);
+        // add the close button
+        Button closeButton = new Button(Messages.getString("close"), Styles.CROSS);
+        closeButton.setStyleName("control");
+        closeButton.addActionListener(close);
+        controlRow.add(closeButton);
+
+        // add the main tab pane
+        TabPane tabPane = new TabPane();
+        tabPane.setStyleName("default");
+        splitPane.add(tabPane);
+
+        // add the general tab
+        TabPaneLayoutData tabLayoutData = new TabPaneLayoutData();
+        tabLayoutData.setTitle(Messages.getString("general"));
+        ContentPane generalTab = new ContentPane();
+        generalTab.setStyleName("tab.content");
+        generalTab.setLayoutData(tabLayoutData);
+        tabPane.add(generalTab);
+
+        // add the general grid layout
+        Grid generalGridLayout = new Grid(2);
+        generalGridLayout.setStyleName("agent");
+        generalGridLayout.setWidth(new Extent(100, Extent.PERCENT));
+        generalGridLayout.setColumnWidth(0, new Extent(10, Extent.PERCENT));
+        generalGridLayout.setColumnWidth(1, new Extent(90, Extent.PERCENT));
+        generalTab.add(generalGridLayout);
+
+        // add the agent id field
+        Label agentIdLabel = new Label(Messages.getString("id"));
+        agentIdLabel.setStyleName("default");
+        generalGridLayout.add(agentIdLabel);
+        idField = new TextField();
+        idField.setStyleName("default");
+        idField.setWidth(new Extent(100, Extent.PERCENT));
+        generalGridLayout.add(idField);
+
+        // add the agent hostname field
+        Label agentHostnameLabel = new Label(Messages.getString("hostname"));
+        agentHostnameLabel.setStyleName("default");
+        generalGridLayout.add(agentHostnameLabel);
+        hostnameField = new TextField();
+        hostnameField.setStyleName("default");
+        hostnameField.setWidth(new Extent(100, Extent.PERCENT));
+        generalGridLayout.add(hostnameField);
+
+        // add the agent port field
+        Label agentPortLabel = new Label(Messages.getString("port"));
+        agentPortLabel.setStyleName("default");
+        generalGridLayout.add(agentPortLabel);
+        portField = new TextField();
+        portField.setStyleName("default");
+        portField.setWidth(new Extent(15, Extent.EX));
+        generalGridLayout.add(portField);
+
+        // add the scheduler tab
+        tabLayoutData = new TabPaneLayoutData();
+        tabLayoutData.setTitle(Messages.getString("scheduler"));
+        ContentPane schedulerTab = new ContentPane();
+        schedulerTab.setLayoutData(tabLayoutData);
+        schedulerTab.setStyleName("tab.content");
+        tabPane.add(schedulerTab);
+
+        // add the scheduler grid layout
+        Grid schedulerGridLayout = new Grid(2);
+        schedulerGridLayout.setStyleName("agent");
+        schedulerGridLayout.setWidth(new Extent(100, Extent.PERCENT));
+        schedulerGridLayout.setColumnWidth(0, new Extent(10, Extent.PERCENT));
+        schedulerGridLayout.setColumnWidth(1, new Extent(90, Extent.PERCENT));
+        schedulerTab.add(schedulerGridLayout);
+
+        // add the cron field
+        Label cronLabel = new Label(Messages.getString("cron"));
+        cronLabel.setStyleName("default");
+        schedulerGridLayout.add(cronLabel);
+        cronField = new TextField();
+        cronField.setStyleName("default");
+        cronField.setWidth(new Extent(100, Extent.PERCENT));
+        schedulerGridLayout.add(cronField);
+
+        // add the cron examples
+        Label cronExamplesLabel = new Label(Messages.getString("examples"));
+        cronExamplesLabel.setStyleName("grid.cell");
+        schedulerGridLayout.add(cronExamplesLabel);
+        TextArea cronExamples = new TextArea();
+        cronExamples.setStyleName("default");
+        cronExamples.setWidth(new Extent(100, Extent.PERCENT));
+        cronExamples.setHeight(new Extent(20, Extent.EX));
+        cronExamples.setText(Messages.getString("cron.examples"));
+        cronExamples.setEnabled(false);
+        schedulerGridLayout.add(cronExamples);
+
+        // add the capacity tab
+        tabLayoutData = new TabPaneLayoutData();
+        tabLayoutData.setTitle(Messages.getString("capacity"));
+        ContentPane capacityTab = new ContentPane();
+        capacityTab.setLayoutData(tabLayoutData);
+        capacityTab.setStyleName("tab.content");
+        tabPane.add(capacityTab);
+
+        // add the capacity grid layout
+        Grid capacityGridLayout = new Grid(2);
+        capacityGridLayout.setStyleName("agent");
+        capacityGridLayout.setWidth(new Extent(100, Extent.PERCENT));
+        capacityGridLayout.setColumnWidth(0, new Extent(10, Extent.PERCENT));
+        capacityGridLayout.setColumnWidth(1, new Extent(90, Extent.PERCENT));
+        capacityTab.add(capacityGridLayout);
+
+        // add the max environments field
+        Label agentMaxEnvironmentsLabel = new Label(Messages.getString("agent.maxenvironments"));
+        agentMaxEnvironmentsLabel.setStyleName("default");
+        capacityGridLayout.add(agentMaxEnvironmentsLabel);
+        maxEnvironmentsField = new TextField();
+        maxEnvironmentsField.setStyleName("default");
+        maxEnvironmentsField.setWidth(new Extent(15, Extent.EX));
+        capacityGridLayout.add(maxEnvironmentsField);
+
+        // add the max active environments field
+        Label agentMaxActiveEnvironmentsLabel = new Label(Messages.getString("agent.maxactiveapplicationservers"));
+        agentMaxActiveEnvironmentsLabel.setStyleName("default");
+        capacityGridLayout.add(agentMaxActiveEnvironmentsLabel);
+        maxActiveApplicationServersField = new TextField();
+        maxActiveApplicationServersField.setStyleName("default");
+        maxActiveApplicationServersField.setWidth(new Extent(15, Extent.EX));
+        capacityGridLayout.add(maxActiveApplicationServersField);
+
+        // update the view
+        update();
+    }
+
+    /**
+     * Update the fields value.
+     */
+    protected void update() {
+        // update fields
+        idField.setText(agent.getId());
+        hostnameField.setText(agent.getHostname());
+        portField.setText(new Integer(agent.getPort()).toString());
+        cronField.setText(agent.getCron());
+        maxEnvironmentsField.setText(new Integer(agent.getMaxmanagedenvironments()).toString());
+        maxActiveApplicationServersField.setText(new Integer(agent.getMaxj2eeapplicationserversstarted()).toString());
+    }
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentsWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentsWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentsWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminAgentsWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,351 @@
+/*
+ * 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.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.Column;
+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.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.Agent;
+import org.apache.kalumet.model.Kalumet;
+import org.apache.kalumet.ws.client.AgentClient;
+
+/**
+ * Admin agents window.
+ */
+public class AdminAgentsWindow extends WindowPane {
+
+    // attributes
+    private List agents;
+    private Grid agentsGrid;
+
+    // status thread
+    class StatusThread extends Thread {
+
+        public boolean ended = false;
+        public boolean failure = false;
+        public String id;
+        public String message;
+
+        public void run() {
+            try {
+                // load Kalumet configuration
+                Kalumet kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(id);
+                if (agent == null) {
+                    throw new IllegalArgumentException("agent " + id + " not found.");
+                }
+                // call the WebService
+                AgentClient client = new AgentClient(agent.getHostname(), agent.getPort());
+                message = "Agent " + id + " version " + client.getVersion() + " started.";
+            } catch (Exception e) {
+                failure = true;
+                message = "Agent " + id + " status check failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // close action listener
+    private ActionListener closeActionListener = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            AdminAgentsWindow.this.userClose();
+        }
+    };
+    // refresh action listener
+    private ActionListener refreshActionListener = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            Kalumet kalumet = null;
+            try {
+                kalumet = ConfigurationManager.loadStore();
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.read") + ": " + e.getMessage());
+                return;
+            }
+            agents = kalumet.getAgents();
+            update();
+            KalumetConsoleApplication.getApplication().getLogPane().addInfo(Messages.getString("agents") + " " + Messages.getString("reloaded"));
+        }
+    };
+    // delete action listener
+    private ActionListener deleteActionListener = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            final String agentId = event.getActionCommand();
+            // display a confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // looking for the agent to remove
+                    Agent agentToRemove = null;
+                    for (Iterator agentIterator = agents.iterator(); agentIterator.hasNext(); ) {
+                        Agent agent = (Agent) agentIterator.next();
+                        if (agent.getId().equals(agentId)) {
+                            agentToRemove = agent;
+                            break;
+                        }
+                    }
+                    // remove the agnet
+                    agents.remove(agentToRemove);
+                    // update the window
+                    update();
+                }
+            }));
+        }
+    };
+    // save action listener
+    private ActionListener saveActionListener = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            Kalumet kalumet = null;
+            // load Kalumet configuration
+            try {
+                kalumet = ConfigurationManager.loadStore();
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.read") + ": " + e.getMessage());
+                return;
+            }
+            kalumet.setAgents((LinkedList) agents);
+            try {
+                ConfigurationManager.writeStore(kalumet);
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.write") + ": " + e.getMessage());
+                return;
+            }
+            KalumetConsoleApplication.getApplication().getLogPane().addConfirm(Messages.getString("agents.saved"));
+        }
+    };
+    // edit action listener
+    private ActionListener editActionListener = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            if (KalumetConsoleApplication.getApplication().getDefaultWindow().getComponent("agentwindow_" + event.getActionCommand()) == null) {
+                KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new AdminAgentWindow(AdminAgentsWindow.this, event.getActionCommand()));
+            }
+        }
+    };
+    // add action listener
+    private ActionListener addActionListener = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new AdminAgentWindow(AdminAgentsWindow.this, null));
+        }
+    };
+    // copy
+    private ActionListener copy = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // get the agent id
+            String agentId = event.getActionCommand();
+            // load Kalumet configuration
+            Kalumet kalumet = null;
+            try {
+                kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(agentId);
+                if (agent == null) {
+                    return;
+                }
+                // store an agent clone in the copy component
+                KalumetConsoleApplication.getApplication().setCopyComponent(agent.clone());
+            } catch (Exception e) {
+                return;
+            }
+        }
+    };
+    // status
+    private ActionListener status = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // add an event
+            KalumetConsoleApplication.getApplication().getLogPane().addInfo("Agent " + event.getActionCommand() + " status check in progress ...");
+            // start the status thread
+            final StatusThread statusThread = new StatusThread();
+            statusThread.id = event.getActionCommand();
+            statusThread.start();
+            // sync with the client
+            KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                public void run() {
+                    if (statusThread.ended) {
+                        if (statusThread.failure) {
+                            KalumetConsoleApplication.getApplication().getLogPane().addError(statusThread.message);
+                        } else {
+                            KalumetConsoleApplication.getApplication().getLogPane().addConfirm(statusThread.message);
+                        }
+                    } else {
+                        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                    }
+                }
+            });
+        }
+    };
+
+    /**
+     * Create a new <code>AdminAgentsWindow</code>.
+     */
+    public AdminAgentsWindow() {
+        super();
+
+        // check if the user that try to access this window is the admin
+        if (!KalumetConsoleApplication.getApplication().getUserid().equals("admin")) {
+            KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("agents.restricted"));
+            AdminAgentsWindow.this.userClose();
+            return;
+        }
+
+        // load Kalumet configuration
+        Kalumet kalumet = null;
+        try {
+            kalumet = ConfigurationManager.loadStore();
+        } catch (Exception e) {
+            KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.read") + ": " + e.getMessage());
+            return;
+        }
+        this.agents = kalumet.getAgents();
+        Collections.sort(this.agents);
+
+        setTitle(Messages.getString("agents"));
+        setIcon(Styles.COG);
+        setStyleName("agents");
+        setId("agentswindow");
+        setModal(false);
+        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(refreshActionListener);
+        controlRow.add(refreshButton);
+        // add the save button
+        Button saveButton = new Button(Messages.getString("save"), Styles.DATABASE_SAVE);
+        saveButton.setStyleName("control");
+        saveButton.addActionListener(saveActionListener);
+        controlRow.add(saveButton);
+        // add the close button
+        Button closeButton = new Button(Messages.getString("close"), Styles.CROSS);
+        closeButton.setStyleName("control");
+        closeButton.addActionListener(closeActionListener);
+        controlRow.add(closeButton);
+
+        // add the column main pane
+        Column content = new Column();
+        content.setStyleName("agents");
+        splitPane.add(content);
+
+        // add  button
+        Button addButton = new Button(Messages.getString("agent.add"), Styles.ADD);
+        addButton.addActionListener(addActionListener);
+        content.add(addButton);
+
+        // add the agents list grid
+        agentsGrid = new Grid(3);
+        agentsGrid.setStyleName("border.grid");
+        agentsGrid.setColumnWidth(0, new Extent(18, Extent.PX));
+        agentsGrid.setColumnWidth(1, new Extent(50, Extent.PERCENT));
+        agentsGrid.setColumnWidth(2, new Extent(50, Extent.PERCENT));
+        content.add(agentsGrid);
+
+        // update agents grid
+        update();
+    }
+
+    /**
+     *
+     *
+     */
+    protected void update() {
+        // delete all agents grid child
+        agentsGrid.removeAll();
+
+        // add grid headers
+        Label agentActionHeader = new Label(" ");
+        agentActionHeader.setStyleName("grid.header");
+        agentsGrid.add(agentActionHeader);
+        Label agentIdHeader = new Label(Messages.getString("id"));
+        agentIdHeader.setStyleName("grid.header");
+        agentsGrid.add(agentIdHeader);
+        Label agentHostnameHeader = new Label(Messages.getString("hostname"));
+        agentHostnameHeader.setStyleName("grid.header");
+        agentsGrid.add(agentHostnameHeader);
+
+        // add agents in grid
+        for (Iterator agentIterator = agents.iterator(); agentIterator.hasNext(); ) {
+            Agent agent = (Agent) agentIterator.next();
+            // action row with agent id
+            Row row = new Row();
+            row.setInsets(new Insets(2));
+            row.setCellSpacing(new Extent(2));
+            agentsGrid.add(row);
+            // copy button
+            Button copyButton = new Button(Styles.PAGE_COPY);
+            copyButton.addActionListener(copy);
+            copyButton.setActionCommand(agent.getId());
+            copyButton.setToolTipText(Messages.getString("copy"));
+            row.add(copyButton);
+            // delete button
+            Button deleteButton = new Button(Styles.DELETE);
+            deleteButton.addActionListener(deleteActionListener);
+            deleteButton.setActionCommand(agent.getId());
+            deleteButton.setToolTipText(Messages.getString("delete"));
+            row.add(deleteButton);
+            // status button
+            Button statusButton = new Button(Styles.INFORMATION);
+            statusButton.setActionCommand(agent.getId());
+            statusButton.addActionListener(status);
+            statusButton.setToolTipText(Messages.getString("status"));
+            row.add(statusButton);
+
+            Button idButton = new Button(agent.getId());
+            idButton.addActionListener(editActionListener);
+            idButton.setActionCommand(agent.getId());
+            agentsGrid.add(idButton);
+
+            // hostname label
+            Label hostnameLabel = new Label(agent.getHostname() + ":" + agent.getPort());
+            hostnameLabel.setStyleName("default");
+            agentsGrid.add(hostnameLabel);
+        }
+    }
+
+    /**
+     * Get the agents list
+     *
+     * @return the agents list
+     */
+    protected List getAgents() {
+        return this.agents;
+    }
+
+}

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminConfigurationWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminConfigurationWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminConfigurationWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/AdminConfigurationWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,368 @@
+/*
+ * 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.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.SelectField;
+import nextapp.echo2.app.SplitPane;
+import nextapp.echo2.app.TextField;
+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;
+import org.apache.kalumet.model.Property;
+
+/**
+ * Admin configuration window.
+ */
+public class AdminConfigurationWindow extends WindowPane {
+
+    private TextField consoleLocationField;
+    private SelectField ldapAuthenticationField;
+    private TextField ldapServerField;
+    private TextField ldapBaseDNField;
+    private TextField ldapUidAttributeField;
+    private TextField ldapMailAttributeField;
+    private TextField ldapCnAttributeField;
+
+    // close
+    private ActionListener close = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            AdminConfigurationWindow.this.userClose();
+        }
+    };
+    // refresh
+    private ActionListener refresh = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            update();
+        }
+    };
+    // save
+    private ActionListener save = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            String logEventAppender = consoleLocationField.getText();
+            int ldapAuthentification = ldapAuthenticationField.getSelectedIndex();
+            String ldapServer = ldapServerField.getText();
+            String ldapBaseDN = ldapBaseDNField.getText();
+            String ldapUidAttribute = ldapUidAttributeField.getText();
+            String ldapMailAttribute = ldapMailAttributeField.getText();
+            String ldapCnAttribute = ldapCnAttributeField.getText();
+
+            // check if the user is allowed to do it
+            if (!KalumetConsoleApplication.getApplication().getUserid().equals("admin")) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("configuration.restricted"));
+                return;
+            }
+
+            // load Kalumet configuration
+            Kalumet kalumet = null;
+            try {
+                kalumet = ConfigurationManager.loadStore();
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.read") + ": " + e.getMessage());
+                return;
+            }
+
+            // log event appender
+            Property logEventAppenderProperty = kalumet.getProperty("LogEventAppender");
+            if (logEventAppenderProperty == null) {
+                logEventAppenderProperty = new Property();
+                logEventAppenderProperty.setName("LogEventAppender");
+                try {
+                    kalumet.addProperty(logEventAppenderProperty);
+                } catch (Exception e) {
+                    // ignore
+                }
+            }
+            kalumet.getProperty("LogEventAppender").setValue(logEventAppender);
+            // ldap authentification
+            Property ldapAuthentificationProperty = kalumet.getProperty("LdapAuthentication");
+            if (ldapAuthentificationProperty == null) {
+                ldapAuthentificationProperty = new Property();
+                ldapAuthentificationProperty.setName("LdapAuthentication");
+                try {
+                    kalumet.addProperty(ldapAuthentificationProperty);
+                } catch (Exception e) {
+                    // ignore
+                }
+            }
+            if (ldapAuthentification == 0) {
+                kalumet.getProperty("LdapAuthentication").setValue("true");
+            } else {
+                kalumet.getProperty("LdapAuthentication").setValue("false");
+            }
+            // ldap server
+            Property ldapServerProperty = kalumet.getProperty("LdapServer");
+            if (ldapServerProperty == null) {
+                ldapServerProperty = new Property();
+                ldapServerProperty.setName("LdapServer");
+                try {
+                    kalumet.addProperty(ldapServerProperty);
+                } catch (Exception e) {
+                    // ignore
+                }
+            }
+            kalumet.getProperty("LdapServer").setValue(ldapServer);
+            // ldap base DN
+            Property ldapBaseDNProperty = kalumet.getProperty("LdapBaseDN");
+            if (ldapBaseDNProperty == null) {
+                ldapBaseDNProperty = new Property();
+                ldapBaseDNProperty.setName("LdapBaseDN");
+                try {
+                    kalumet.addProperty(ldapBaseDNProperty);
+                } catch (Exception e) {
+                    // ignore
+                }
+            }
+            kalumet.getProperty("LdapBaseDN").setValue(ldapBaseDN);
+            // ldap uid attribute
+            Property ldapUidAttributeProperty = kalumet.getProperty("LdapUidAttribute");
+            if (ldapUidAttributeProperty == null) {
+                ldapUidAttributeProperty = new Property();
+                ldapUidAttributeProperty.setName("LdapUidAttribute");
+                try {
+                    kalumet.addProperty(ldapUidAttributeProperty);
+                } catch (Exception e) {
+                    // ignore
+                }
+            }
+            kalumet.getProperty("LdapUidAttribute").setValue(ldapUidAttribute);
+            // ldap mail attribute
+            Property ldapMailAttributeProperty = kalumet.getProperty("LdapMailAttribute");
+            if (ldapMailAttributeProperty == null) {
+                ldapMailAttributeProperty = new Property();
+                ldapMailAttributeProperty.setName("LdapMailAttribute");
+                try {
+                    kalumet.addProperty(ldapMailAttributeProperty);
+                } catch (Exception e) {
+                    // ignore
+                }
+            }
+            kalumet.getProperty("LdapMailAttribute").setValue(ldapMailAttribute);
+            // ldap cn attribute
+            Property ldapCnAttributeProperty = kalumet.getProperty("LdapCnAttribute");
+            if (ldapCnAttributeProperty == null) {
+                ldapCnAttributeProperty = new Property();
+                ldapCnAttributeProperty.setName("LdapCnAttribute");
+                try {
+                    kalumet.addProperty(ldapCnAttributeProperty);
+                } catch (Exception e) {
+                    // ignore
+                }
+            }
+
+            // save Kalumet configuration
+            try {
+                ConfigurationManager.writeStore(kalumet);
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.write") + ": " + e.getMessage());
+                return;
+            }
+
+            KalumetConsoleApplication.getApplication().getLogPane().addConfirm(Messages.getString("configuration.saved"));
+        }
+
+    };
+
+    /**
+     * Create a new <code>AdminConfigurationWindow</code>.
+     */
+    public AdminConfigurationWindow() {
+        super();
+
+        // check if the user that try to access this window is the admin
+        if (!KalumetConsoleApplication.getApplication().getUserid().equals("admin")) {
+            KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("configuration.restricted"));
+            AdminConfigurationWindow.this.userClose();
+            return;
+        }
+
+        setTitle(Messages.getString("configuration"));
+        setIcon(Styles.COMPUTER_EDIT);
+        setId("configurationwindow");
+        setStyleName("configuration");
+        setModal(false);
+        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.addActionListener(refresh);
+        refreshButton.setStyleName("control");
+        controlRow.add(refreshButton);
+        // add the save button
+        Button saveButton = new Button(Messages.getString("save"), Styles.DATABASE_SAVE);
+        saveButton.addActionListener(save);
+        saveButton.setStyleName("control");
+        controlRow.add(saveButton);
+        // add the close button
+        Button closeButton = new Button(Messages.getString("close"), Styles.CROSS);
+        closeButton.addActionListener(close);
+        closeButton.setStyleName("control");
+        controlRow.add(closeButton);
+
+
+        // define a grid layout
+        Grid content = new Grid(2);
+        content.setStyleName("default");
+        content.setWidth(new Extent(100, Extent.PERCENT));
+        content.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+        content.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+        splitPane.add(content);
+
+        // create the log event appender field
+        Label logEventAppenderLabel = new Label(Messages.getString("configuration.journal.location"));
+        logEventAppenderLabel.setStyleName("default");
+        content.add(logEventAppenderLabel);
+        consoleLocationField = new TextField();
+        consoleLocationField.setStyleName("default");
+        consoleLocationField.setWidth(new Extent(100, Extent.PERCENT));
+        content.add(consoleLocationField);
+
+        // create the ldap authentication field
+        Label ldapAuthenticationLabel = new Label(Messages.getString("configuration.ldap.authentication"));
+        ldapAuthenticationLabel.setStyleName("default");
+        content.add(ldapAuthenticationLabel);
+        ldapAuthenticationField = new SelectField(MainScreen.LABELS);
+        ldapAuthenticationField.setStyleName("default");
+        content.add(ldapAuthenticationField);
+
+        // create the ldap server field
+        Label ldapServerLabel = new Label(Messages.getString("configuration.ldap.server"));
+        ldapServerLabel.setStyleName("default");
+        content.add(ldapServerLabel);
+        ldapServerField = new TextField();
+        ldapServerField.setStyleName("default");
+        ldapServerField.setWidth(new Extent(100, Extent.PERCENT));
+        content.add(ldapServerField);
+
+        // create the ldap base dn field
+        Label ldapBaseDNLabel = new Label(Messages.getString("configuration.ldap.basedn"));
+        ldapBaseDNLabel.setStyleName("default");
+        content.add(ldapBaseDNLabel);
+        ldapBaseDNField = new TextField();
+        ldapBaseDNField.setStyleName("default");
+        ldapBaseDNField.setWidth(new Extent(100, Extent.PERCENT));
+        content.add(ldapBaseDNField);
+
+        // create the ldap uid attribute field
+        Label ldapUidAttributeLabel = new Label(Messages.getString("configuration.ldap.uid"));
+        ldapUidAttributeLabel.setStyleName("default");
+        content.add(ldapUidAttributeLabel);
+        ldapUidAttributeField = new TextField();
+        ldapUidAttributeField.setStyleName("default");
+        ldapUidAttributeField.setWidth(new Extent(100, Extent.PERCENT));
+        content.add(ldapUidAttributeField);
+
+        // create the ldap mail attribute field
+        Label ldapMailAttributeLabel = new Label(Messages.getString("configuration.ldap.mail"));
+        ldapMailAttributeLabel.setStyleName("default");
+        content.add(ldapMailAttributeLabel);
+        ldapMailAttributeField = new TextField();
+        ldapMailAttributeField.setStyleName("default");
+        ldapMailAttributeField.setWidth(new Extent(100, Extent.PERCENT));
+        content.add(ldapMailAttributeField);
+
+        // create the ldap cn attribute field
+        Label ldapCnAttributeLabel = new Label(Messages.getString("configuration.ldap.cn"));
+        ldapCnAttributeLabel.setStyleName("default");
+        content.add(ldapCnAttributeLabel);
+        ldapCnAttributeField = new TextField();
+        ldapCnAttributeField.setStyleName("default");
+        ldapCnAttributeField.setWidth(new Extent(100, Extent.PERCENT));
+        content.add(ldapCnAttributeField);
+
+        update();
+    }
+
+    /**
+     * Update the window content.
+     */
+    public void update() {
+        // load Kalumet configuration
+        Kalumet kalumet = null;
+        try {
+            kalumet = ConfigurationManager.loadStore();
+        } catch (Exception e) {
+            KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.read") + ": " + e.getMessage());
+            return;
+        }
+
+        Property logEventAppenderProperty = kalumet.getProperty("LogEventAppender");
+        if (logEventAppenderProperty != null) {
+            consoleLocationField.setText(logEventAppenderProperty.getValue());
+        } else {
+            consoleLocationField.setText(null);
+        }
+
+        Property ldapAuthentificationProperty = kalumet.getProperty("LdapAuthentication");
+        if (ldapAuthentificationProperty != null) {
+            if (ldapAuthentificationProperty.getValue().equals("true")) {
+                ldapAuthenticationField.setSelectedIndex(0);
+            } else {
+                ldapAuthenticationField.setSelectedIndex(1);
+            }
+        } else {
+            ldapAuthenticationField.setSelectedIndex(1);
+        }
+        Property ldapServerProperty = kalumet.getProperty("LdapServer");
+        if (ldapServerProperty != null) {
+            ldapServerField.setText(ldapServerProperty.getValue());
+        } else {
+            ldapServerField.setText(null);
+        }
+        Property ldapBaseDNProperty = kalumet.getProperty("LdapBaseDN");
+        if (ldapBaseDNProperty != null) {
+            ldapBaseDNField.setText(ldapBaseDNProperty.getValue());
+        } else {
+            ldapBaseDNField.setText(null);
+        }
+        Property ldapUidAttributeProperty = kalumet.getProperty("LdapUidAttribute");
+        if (ldapUidAttributeProperty != null) {
+            ldapUidAttributeField.setText(ldapUidAttributeProperty.getValue());
+        } else {
+            ldapUidAttributeField.setText(null);
+        }
+        Property ldapMailAttributeProperty = kalumet.getProperty("LdapMailAttribute");
+        if (ldapMailAttributeProperty != null) {
+            ldapMailAttributeField.setText(ldapMailAttributeProperty.getValue());
+        } else {
+            ldapMailAttributeField.setText(null);
+        }
+        Property ldapCnAttributeProperty = kalumet.getProperty("LdapCnAttribute");
+        if (ldapCnAttributeProperty != null) {
+            ldapCnAttributeField.setText(ldapCnAttributeProperty.getValue());
+        } else {
+            ldapCnAttributeField.setText(null);
+        }
+    }
+
+}