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 [9/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/ApplicationsPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationsPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationsPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationsPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,645 @@
+/*
+ * 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.SelectField;
+import nextapp.echo2.app.TextField;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import nextapp.echo2.app.list.DefaultListModel;
+import org.apache.kalumet.FileManipulator;
+import org.apache.kalumet.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.Agent;
+import org.apache.kalumet.model.J2EEApplication;
+import org.apache.kalumet.model.J2EEApplicationServer;
+import org.apache.kalumet.model.Kalumet;
+import org.apache.kalumet.ws.client.J2EEApplicationClient;
+
+/**
+ * Environment J2EE applications pane.
+ */
+public class ApplicationsPane extends ContentPane {
+
+    private EnvironmentWindow parent;
+    private SelectField scopeField;
+    private Grid grid;
+
+    // update thread
+    class UpdateThread extends Thread {
+
+        public String serverName;
+        public String applicationName;
+        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
+                J2EEApplicationClient client = new J2EEApplicationClient(agent.getHostname(), agent.getPort());
+                client.update(parent.getEnvironmentName(), serverName, applicationName, false);
+            } catch (Exception e) {
+                failure = true;
+                message = "J2EE application " + applicationName + " update failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // scope select
+    private ActionListener scopeSelect = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            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().jeeApplicationsPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the J2EE application object
+            J2EEApplication application = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplication(event.getActionCommand());
+            if (application == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("application.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // change the J2EE application state and add a change event
+            if (application.isActive()) {
+                application.setActive(false);
+                parent.getChangeEvents().add("Disable J2EE application " + application.getName());
+            } else {
+                application.setActive(true);
+                parent.getChangeEvents().add("Enable J2EE application " + application.getName());
+            }
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log tab pane
+            parent.updateJournalPane();
+            // update the pane
+            update();
+        }
+    };
+    // 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().jeeApplicationsPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the jee application object
+            J2EEApplication application = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplication(event.getActionCommand());
+            if (application == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("application.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // change the jee application blocker and add a change event
+            if (application.isBlocker()) {
+                application.setBlocker(false);
+                parent.getChangeEvents().add("Set not blocker for J2EE application " + application.getName());
+            } else {
+                application.setBlocker(true);
+                parent.getChangeEvents().add("Set blocker for J2EE application " + application.getName());
+            }
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log tab pane
+            parent.updateJournalPane();
+            // update the 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().jeeApplicationsPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the jee application object
+            final J2EEApplication application = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplication(event.getActionCommand());
+            if (application == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("application.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // delete the j2ee application object
+                    parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().remove(application);
+                    // add a change event
+                    parent.getChangeEvents().add("Delete J2EE application " + application.getName());
+                    // change the updated flag
+                    parent.setUpdated(true);
+                    // update the journal log tab pane
+                    parent.updateJournalPane();
+                    // update the pane
+                    update();
+                }
+            }));
+        }
+    };
+    // edit
+    private ActionListener edit = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            if (KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().getComponent("applicationwindow_" + parent.getEnvironmentName() + "_" + (String) scopeField.getSelectedItem() + "_" + event.getActionCommand()) == null) {
+                KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ApplicationWindow(ApplicationsPane.this, (String) scopeField.getSelectedItem(), event.getActionCommand()));
+            }
+        }
+    };
+    // create
+    private ActionListener create = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ApplicationWindow(ApplicationsPane.this, (String) scopeField.getSelectedItem(), 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().jeeApplicationsPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the j2ee application object
+            J2EEApplication application = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplication(event.getActionCommand());
+            if (application == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("application.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the j2ee application index
+            int index = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().indexOf(application);
+            // if the j2ee application index is the first one or the object is not
+            // found, do nothing, the size of the list must constains at least 2
+            // j2ee applications
+            if (index == 0 || index == -1 || parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().size() < 2) {
+                return;
+            }
+            // get the previous application
+            J2EEApplication previous = (J2EEApplication) parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().get(index - 1);
+            // switch the application
+            parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().set(index, previous);
+            parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().set(index - 1, application);
+            // 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().jeeApplicationsPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the j2ee application object
+            J2EEApplication application = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplication(event.getActionCommand());
+            if (application == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("application.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the j2ee application index
+            int index = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().indexOf(application);
+            // if the j2ee application index is the last one or the object is not
+            // found, the size of the list must contains at least 2 j2ee
+            // applications
+            if (index == -1 || index == parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().size() - 1
+                    || parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().size() < 2) {
+                return;
+            }
+            // get the next application
+            J2EEApplication next = (J2EEApplication) parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().get(index + 1);
+            // switch the application
+            parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().set(index + 1, application);
+            parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplications().set(index, next);
+            // update the pane
+            update();
+        }
+    };
+    // copy
+    private ActionListener copy = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // looking for the j2ee application object
+            J2EEApplication application = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplication(event.getActionCommand());
+            if (application == null) {
+                return;
+            }
+            try {
+                KalumetConsoleApplication.getApplication().setCopyComponent(application.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().jeeApplicationsPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the j2ee application name
+            String name = event.getActionCommand();
+            // get the j2ee application uri field
+            TextField uriField = (TextField) ApplicationsPane.this.getComponent("applicationuri_" + parent.getEnvironmentName() + "_" + (String) scopeField.getSelectedItem() + "_" + name);
+            // get the URI field value
+            String uriValue = uriField.getText();
+            // looking for the j2ee application object
+            J2EEApplication application = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJ2EEApplication(name);
+            if (application == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("application.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // add a change event
+            parent.getChangeEvents().add("Change J2EE application " + application.getName() + " URI to " + uriValue);
+            // change the j2ee application object
+            application.setUri(uriValue);
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log tab pane
+            parent.updateJournalPane();
+            // update the pane
+            update();
+        }
+    };
+    // 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().jeeApplicationsUpdatePermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if some change has not been saved
+            if (getEnvironmentWindow().isUpdated()) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the selected J2EE server and application
+            final String serverName = (String) scopeField.getSelectedItem();
+            final String applicationName = event.getActionCommand();
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // add a message into the log pane and the journal
+                    KalumetConsoleApplication.getApplication().getLogPane().addInfo("J2EE application " + applicationName + " update in progress...", parent.getEnvironmentName());
+                    parent.getChangeEvents().add("J2EE application " + applicationName + " update requested.");
+                    // start the update thread
+                    final UpdateThread updateThread = new UpdateThread();
+                    updateThread.serverName = serverName;
+                    updateThread.applicationName = applicationName;
+                    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("J2EE application " + applicationName + " updated.", parent.getEnvironmentName());
+                                    parent.getChangeEvents().add("J2EE application " + applicationName + " 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) ApplicationsPane.this.getComponent("applicationuri_" + parent.getEnvironmentName() + "_" + (String) scopeField.getSelectedItem() + "_" + 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>ApplicationsPane</code>.
+     *
+     * @param parent the parent <code>EnvironmentWindow</code>.
+     */
+    public ApplicationsPane(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 scope field
+        Grid layoutGrid = new Grid(2);
+        layoutGrid.setStyleName("default");
+        layoutGrid.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+        layoutGrid.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+        content.add(layoutGrid);
+        Label scopeLabel = new Label(Messages.getString("scope"));
+        layoutGrid.add(scopeLabel);
+        scopeField = new SelectField();
+        scopeField.addActionListener(scopeSelect);
+        scopeField.setStyleName("default");
+        layoutGrid.add(scopeField);
+        DefaultListModel scopeListModel = (DefaultListModel) scopeField.getModel();
+        scopeListModel.removeAll();
+        // add application servers in the scope select field
+        for (Iterator applicationServerIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServers().iterator(); applicationServerIterator.hasNext(); ) {
+            J2EEApplicationServer applicationServer = (J2EEApplicationServer) applicationServerIterator.next();
+            scopeListModel.add(applicationServer.getName());
+        }
+        if (scopeListModel.size() > 0) {
+            scopeField.setSelectedIndex(0);
+        }
+
+        // add the create button
+        if (getEnvironmentWindow().adminPermission
+                || getEnvironmentWindow().jeeApplicationsPermission) {
+            Button createButton = new Button(Messages.getString("application.add"), Styles.ADD);
+            createButton.addActionListener(create);
+            content.add(createButton);
+        }
+
+        // add J2EE applications grid
+        grid = new Grid(4);
+        grid.setStyleName("border.grid");
+        grid.setColumnWidth(0, new Extent(50, Extent.PX));
+        grid.setColumnWidth(1, new Extent(10, Extent.PERCENT));
+        grid.setColumnWidth(2, new Extent(80, Extent.PERCENT));
+        grid.setColumnWidth(3, new Extent(10, Extent.PERCENT));
+        content.add(grid);
+
+        // update the pane
+        update();
+    }
+
+    /**
+     * Update the pane
+     */
+    public void update() {
+        String applicationServerName = null;
+        // update the scope select field
+        DefaultListModel scopeListModel = (DefaultListModel) scopeField.getModel();
+        if (scopeListModel.size() > 0) {
+            applicationServerName = (String) scopeField.getSelectedItem();
+        }
+        scopeListModel.removeAll();
+        int scopeIndex = 0;
+        int found = -1;
+        for (Iterator applicationServerIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServers().iterator(); applicationServerIterator.hasNext(); ) {
+            J2EEApplicationServer applicationServer = (J2EEApplicationServer) applicationServerIterator.next();
+            scopeListModel.add(applicationServer.getName());
+            if (applicationServer.getName().equals(applicationServerName)) {
+                found = scopeIndex;
+            }
+            scopeIndex++;
+        }
+        // remove all J2EE applications grid children
+        grid.removeAll();
+        // check if at least one application server is present
+        if (scopeListModel.size() < 1) {
+            return;
+        }
+        // update the scope select field selected index
+        if (found == -1) {
+            scopeField.setSelectedIndex(0);
+        } else {
+            scopeField.setSelectedIndex(found);
+        }
+        // update the application server name from the scope (in case of
+        // application server deletion)
+        applicationServerName = (String) scopeField.getSelectedItem();
+
+        // add JEE applications 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 JEE applications
+        for (Iterator applicationIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(applicationServerName).getJ2EEApplications().iterator(); applicationIterator.hasNext(); ) {
+            J2EEApplication application = (J2EEApplication) applicationIterator.next();
+            // row
+            Row row = new Row();
+            row.setInsets(new Insets(2));
+            row.setCellSpacing(new Extent(2));
+            grid.add(row);
+            // copy
+            Button copyButton = new Button(Styles.PAGE_COPY);
+            copyButton.setToolTipText(Messages.getString("copy"));
+            copyButton.setActionCommand(application.getName());
+            copyButton.addActionListener(copy);
+            row.add(copyButton);
+            // active
+            Button activeButton;
+            if (application.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().jeeApplicationsPermission) {
+                activeButton.setActionCommand(application.getName());
+                activeButton.addActionListener(toggleActive);
+            }
+            row.add(activeButton);
+            // blocker
+            Button blockerButton;
+            if (application.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().jeeApplicationsPermission) {
+                blockerButton.setActionCommand(application.getName());
+                blockerButton.addActionListener(toggleBlocker);
+            }
+            row.add(blockerButton);
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().jeeApplicationsPermission) {
+                // up
+                Button upButton = new Button(Styles.ARROW_UP);
+                upButton.setToolTipText(Messages.getString("up"));
+                upButton.setActionCommand(application.getName());
+                upButton.addActionListener(up);
+                row.add(upButton);
+                // down
+                Button downButton = new Button(Styles.ARROW_DOWN);
+                downButton.setToolTipText(Messages.getString("down"));
+                downButton.setActionCommand(application.getName());
+                downButton.addActionListener(down);
+                row.add(downButton);
+            }
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().jeeApplicationsUpdatePermission) {
+                // update
+                Button updateButton = new Button(Styles.COG);
+                updateButton.setToolTipText(Messages.getString("update"));
+                updateButton.setActionCommand(application.getName());
+                updateButton.addActionListener(update);
+                row.add(updateButton);
+            }
+            if (getEnvironmentWindow().adminPermission
+                    || getEnvironmentWindow().jeeApplicationsPermission) {
+                // apply
+                Button applyButton = new Button(Styles.ACCEPT);
+                applyButton.setToolTipText(Messages.getString("apply"));
+                applyButton.setActionCommand(application.getName());
+                applyButton.addActionListener(apply);
+                row.add(applyButton);
+                // delete
+                Button deleteButton = new Button(Styles.DELETE);
+                deleteButton.setToolTipText(Messages.getString("delete"));
+                deleteButton.setActionCommand(application.getName());
+                deleteButton.addActionListener(delete);
+                row.add(deleteButton);
+            }
+            // name
+            Button nameField = new Button(application.getName());
+            nameField.setStyleName("default");
+            nameField.setActionCommand(application.getName());
+            nameField.addActionListener(edit);
+            grid.add(nameField);
+            // uri
+            Row uriRow = new Row();
+            grid.add(uriRow);
+            TextField uriField = new TextField();
+            uriField.setStyleName("default");
+            uriField.setWidth(new Extent(500, Extent.PX));
+            uriField.setId("applicationuri_" + parent.getEnvironmentName() + "_" + applicationServerName + "_" + application.getName());
+            uriField.setText(application.getUri());
+            uriRow.add(uriField);
+            // test
+            Button testUriButton = new Button(Styles.WORLD);
+            testUriButton.setToolTipText(Messages.getString("uri.test"));
+            testUriButton.setActionCommand(application.getName());
+            testUriButton.addActionListener(testUri);
+            uriRow.add(testUriButton);
+            // agent
+            Label agent = new Label(application.getAgent());
+            agent.setStyleName("default");
+            grid.add(agent);
+        }
+    }
+
+    /**
+     * Return the parent <code>EnvironmentWindow</code>.
+     *
+     * @return the parent <code>EnvironmentWindow</code>.
+     */
+    public EnvironmentWindow getEnvironmentWindow() {
+        return this.parent;
+    }
+
+}
\ No newline at end of file

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/CheckerPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/CheckerPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/CheckerPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/CheckerPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,988 @@
+/*
+ * 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.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import org.apache.kalumet.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.*;
+import org.apache.kalumet.ws.client.*;
+
+// Version Thread
+class VersionThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private String version;
+
+    public VersionThread(String hostname, int port) {
+        this.hostname = hostname;
+        this.port = port;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public String getVersion() {
+        return this.version;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            AgentClient webServiceClient = new AgentClient(hostname, port);
+            version = webServiceClient.getVersion();
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// ApplicationServerStatusThread
+class ApplicationServerStatusThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private String status;
+
+    public ApplicationServerStatusThread(String hostname, int port, String environmentName, String applicationServerName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public String getStatus() {
+        return this.status;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            J2EEApplicationServerClient webServiceClient = new J2EEApplicationServerClient(hostname, port);
+            status = webServiceClient.status(environmentName, applicationServerName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// ConnectionPoolCheckThread
+class ConnectionPoolCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String connectionPoolName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public ConnectionPoolCheckThread(String hostname, int port, String environmentName, String applicationServerName, String connectionPoolName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.connectionPoolName = connectionPoolName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            JDBCConnectionPoolClient webServiceClient = new JDBCConnectionPoolClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, connectionPoolName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// DataSourceCheckThread
+class DataSourceCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String dataSourceName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public DataSourceCheckThread(String hostname, int port, String environmentName, String applicationServerName, String dataSourceName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.dataSourceName = dataSourceName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            JDBCDataSourceClient webServiceClient = new JDBCDataSourceClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, dataSourceName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// JMSConnectionFactoryCheckThread
+class JMSConnectionFactoryCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String jmsConnectionFactoryName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public JMSConnectionFactoryCheckThread(String hostname, int port, String environmentName, String applicationServerName, String jmsConnectionFactoryName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.jmsConnectionFactoryName = jmsConnectionFactoryName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            JMSConnectionFactoryClient webServiceClient = new JMSConnectionFactoryClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, jmsConnectionFactoryName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// JMSServerCheckThread
+class JMSServerCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String jmsServerName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public JMSServerCheckThread(String hostname, int port, String environmentName, String applicationServerName, String jmsServerName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.jmsServerName = jmsServerName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            JMSServerClient webServiceClient = new JMSServerClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, jmsServerName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// JNDIBindingCheckThread
+class JNDIBindingCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String nameSpaceBindingName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public JNDIBindingCheckThread(String hostname, int port, String environmentName, String applicationServerName, String nameSpaceBindingName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.nameSpaceBindingName = nameSpaceBindingName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            JNDIBindingClient webServiceClient = new JNDIBindingClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, nameSpaceBindingName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// SharedLibraryCheckThread
+class SharedLibraryCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String sharedLibraryName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public SharedLibraryCheckThread(String hostname, int port, String environmentName, String applicationServerName, String sharedLibraryName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.sharedLibraryName = sharedLibraryName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            SharedLibraryClient webServiceClient = new SharedLibraryClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, sharedLibraryName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+
+}
+
+// J2EEApplicationArchiveCheckThread
+class J2EEApplicationArchiveCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String applicationName;
+    private String archiveName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public J2EEApplicationArchiveCheckThread(String hostname, int port, String environmentName, String applicationServerName, String applicationName, String archiveName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.applicationName = applicationName;
+        this.archiveName = archiveName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            ArchiveClient webServiceClient = new ArchiveClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, applicationName, archiveName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+}
+
+// J2EEApplicationConfigurationFileCheckThread
+class J2EEApplicationConfigurationFileCheckThread extends Thread {
+
+    private String hostname;
+    private int port;
+    private String environmentName;
+    private String applicationServerName;
+    private String applicationName;
+    private String configurationFileName;
+    private boolean completed = false;
+    private boolean failure = false;
+    private String errorMessage;
+    private boolean uptodate;
+
+    public J2EEApplicationConfigurationFileCheckThread(String hostname, int port, String environmentName, String applicationServerName, String applicationName, String configurationFileName) {
+        this.hostname = hostname;
+        this.port = port;
+        this.environmentName = environmentName;
+        this.applicationServerName = applicationServerName;
+        this.applicationName = applicationName;
+        this.configurationFileName = configurationFileName;
+    }
+
+    public boolean getCompleted() {
+        return this.completed;
+    }
+
+    public boolean getFailure() {
+        return this.failure;
+    }
+
+    public String getErrorMessage() {
+        return this.errorMessage;
+    }
+
+    public boolean getUptodate() {
+        return this.uptodate;
+    }
+
+    public void run() {
+        try {
+            // call the webservice
+            ConfigurationFileClient webServiceClient = new ConfigurationFileClient(hostname, port);
+            uptodate = webServiceClient.check(environmentName, applicationServerName, applicationName, configurationFileName);
+            completed = true;
+        } catch (Exception e) {
+            errorMessage = e.getMessage();
+            completed = true;
+            failure = true;
+        }
+    }
+}
+
+/**
+ * Environment checker pane.
+ */
+public class CheckerPane extends ContentPane {
+
+    private EnvironmentWindow parent;
+    private Grid grid;
+
+    // launch
+    private ActionListener launch = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if no modifications are in progress
+            if (parent.isUpdated()) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"));
+                return;
+            }
+            // get the agent for the environment
+            // load Kalumet configuration
+            Kalumet kalumet;
+            try {
+                kalumet = ConfigurationManager.loadStore();
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addError(Messages.getString("db.read") + ": " + e.getMessage());
+                return;
+            }
+            // looking for the agent
+            Agent agent = kalumet.getAgent(parent.getEnvironment().getAgent());
+            if (agent == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("agent.notfound"));
+                return;
+            }
+            // put message in the action log pane
+            KalumetConsoleApplication.getApplication().getLogPane().addInfo("Check in progress ...");
+            // clean the results grid
+            grid.removeAll();
+            // agent check
+            Label agentCheck = new Label("Kalumet agent check");
+            agentCheck.setStyleName("default");
+            grid.add(agentCheck);
+            final Label agentVersionLabel = new Label();
+            agentVersionLabel.setStyleName("default");
+            grid.add(agentVersionLabel);
+            final Label agentButton = new Label();
+            grid.add(agentButton);
+            // launch the version thread
+            final VersionThread versionThread = new VersionThread(agent.getHostname(), agent.getPort());
+            versionThread.start();
+            // launch the synchronization task for the agent version
+            KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                public void run() {
+                    if (versionThread.getCompleted()) {
+                        if (versionThread.getFailure()) {
+                            agentVersionLabel.setText("Agent error: " + versionThread.getErrorMessage());
+                            agentButton.setIcon(Styles.EXCLAMATION);
+                        } else {
+                            agentVersionLabel.setText(versionThread.getVersion());
+                            agentButton.setIcon(Styles.ACCEPT);
+                        }
+                    } else {
+                        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                    }
+                }
+            });
+            // application servers check
+            for (Iterator applicationServerIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServers().iterator(); applicationServerIterator.hasNext(); ) {
+                J2EEApplicationServer applicationServer = (J2EEApplicationServer) applicationServerIterator.next();
+                Label applicationServerLabel = new Label("JEE server " + applicationServer.getName() + " check");
+                applicationServerLabel.setStyleName("default");
+                grid.add(applicationServerLabel);
+                final Label applicationServerStatusLabel = new Label();
+                applicationServerStatusLabel.setStyleName("default");
+                grid.add(applicationServerStatusLabel);
+                final Label applicationServerStatusButton = new Label();
+                applicationServerStatusButton.setStyleName("default");
+                grid.add(applicationServerStatusButton);
+                // launch the application server status thread
+                final ApplicationServerStatusThread applicationServerStatusThread = new ApplicationServerStatusThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName());
+                applicationServerStatusThread.start();
+                // launch the synchronisation status thread
+                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                    public void run() {
+                        if (applicationServerStatusThread.getCompleted()) {
+                            if (applicationServerStatusThread.getFailure()) {
+                                applicationServerStatusLabel.setText("J2EE application server error: " + applicationServerStatusThread.getErrorMessage());
+                                applicationServerStatusButton.setIcon(Styles.EXCLAMATION);
+                            } else {
+                                applicationServerStatusLabel.setText(applicationServerStatusThread.getStatus());
+                                applicationServerStatusButton.setIcon(Styles.ACCEPT);
+                            }
+                        } else {
+                            KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                        }
+                    }
+                });
+                // check connection pool
+                for (Iterator connectionPoolIterator = applicationServer.getJDBCConnectionPools().iterator(); connectionPoolIterator.hasNext(); ) {
+                    JDBCConnectionPool connectionPool = (JDBCConnectionPool) connectionPoolIterator.next();
+                    Label connectionPoolLabel = new Label(" JDBC connection pool " + connectionPool.getName() + " check");
+                    connectionPoolLabel.setStyleName("default");
+                    grid.add(connectionPoolLabel);
+                    final Label connectionPoolStatusLabel = new Label();
+                    connectionPoolStatusLabel.setStyleName("default");
+                    grid.add(connectionPoolStatusLabel);
+                    final Label connectionPoolButton = new Label();
+                    grid.add(connectionPoolButton);
+                    // launch the connection pool check thread
+                    final ConnectionPoolCheckThread connectionPoolCheckThread = new ConnectionPoolCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(), connectionPool.getName());
+                    connectionPoolCheckThread.start();
+                    // launch the synchronisation thread
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (connectionPoolCheckThread.getCompleted()) {
+                                if (connectionPoolCheckThread.getFailure()) {
+                                    connectionPoolStatusLabel.setText("JDBC connection pool check error: " + connectionPoolCheckThread.getErrorMessage());
+                                    connectionPoolButton.setIcon(Styles.EXCLAMATION);
+                                } else {
+                                    if (connectionPoolCheckThread.getUptodate()) {
+                                        connectionPoolStatusLabel.setText("OK");
+                                        connectionPoolButton.setIcon(Styles.ACCEPT);
+                                    } else {
+                                        connectionPoolStatusLabel.setText("JDBC Connection Pool is not deployed or not up to date");
+                                        connectionPoolButton.setIcon(Styles.EXCLAMATION);
+                                    }
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+                // check datasources
+                for (Iterator dataSourceIterator = applicationServer.getJDBCDataSources().iterator(); dataSourceIterator.hasNext(); ) {
+                    JDBCDataSource dataSource = (JDBCDataSource) dataSourceIterator.next();
+                    Label dataSourceLabel = new Label(" JDBC data source " + dataSource.getName() + " check");
+                    dataSourceLabel.setStyleName("default");
+                    grid.add(dataSourceLabel);
+                    final Label dataSourceStatusLabel = new Label();
+                    dataSourceStatusLabel.setStyleName("Default");
+                    grid.add(dataSourceStatusLabel);
+                    final Label dataSourceButton = new Label();
+                    grid.add(dataSourceButton);
+                    // launch the datasource check thread
+                    final DataSourceCheckThread dataSourceCheckThread = new DataSourceCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(), dataSource.getName());
+                    dataSourceCheckThread.start();
+                    // launch the synchronisation thread
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (dataSourceCheckThread.getCompleted()) {
+                                if (dataSourceCheckThread.getFailure()) {
+                                    dataSourceStatusLabel.setText("JDBC data source check error: " + dataSourceCheckThread.getErrorMessage());
+                                    dataSourceButton.setIcon(Styles.EXCLAMATION);
+                                } else {
+                                    if (dataSourceCheckThread.getUptodate()) {
+                                        dataSourceStatusLabel.setText("OK");
+                                        dataSourceButton.setIcon(Styles.ACCEPT);
+                                    } else {
+                                        dataSourceStatusLabel.setText("JDBC data source is not deployed or not up to date.");
+                                        dataSourceButton.setIcon(Styles.EXCLAMATION);
+                                    }
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+                // check JMS connection factories
+                for (Iterator jmsConnectionFactoryIterator = applicationServer.getJMSConnectionFactories().iterator(); jmsConnectionFactoryIterator.hasNext(); ) {
+                    JMSConnectionFactory jmsConnectionFactory = (JMSConnectionFactory) jmsConnectionFactoryIterator.next();
+                    Label jmsConnectionFactoryLabel = new Label(" JMS connection factory " + jmsConnectionFactory.getName() + " check");
+                    jmsConnectionFactoryLabel.setStyleName("Default");
+                    grid.add(jmsConnectionFactoryLabel);
+                    final Label jmsConnectionFactoryStatusLabel = new Label();
+                    jmsConnectionFactoryStatusLabel.setStyleName("Default");
+                    grid.add(jmsConnectionFactoryStatusLabel);
+                    final Label jmsConnectionFactoryButton = new Label();
+                    grid.add(jmsConnectionFactoryButton);
+                    // launch the jms connection factory check thread
+                    final JMSConnectionFactoryCheckThread jmsConnectionFactoryCheckThread = new JMSConnectionFactoryCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(), jmsConnectionFactory.getName());
+                    jmsConnectionFactoryCheckThread.start();
+                    // launch the synchronisation thread
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (jmsConnectionFactoryCheckThread.getCompleted()) {
+                                if (jmsConnectionFactoryCheckThread.getFailure()) {
+                                    jmsConnectionFactoryStatusLabel.setText("JMS connection factory check error: " + jmsConnectionFactoryCheckThread.getErrorMessage());
+                                    jmsConnectionFactoryButton.setIcon(Styles.EXCLAMATION);
+                                } else {
+                                    if (jmsConnectionFactoryCheckThread.getUptodate()) {
+                                        jmsConnectionFactoryStatusLabel.setText("OK");
+                                        jmsConnectionFactoryButton.setIcon(Styles.ACCEPT);
+                                    } else {
+                                        jmsConnectionFactoryStatusLabel.setText("JMS connection factory is not deployed or not up to date");
+                                        jmsConnectionFactoryButton.setIcon(Styles.EXCLAMATION);
+                                    }
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+                // check JMS servers
+                for (Iterator jmsServerIterator = applicationServer.getJMSServers().iterator(); jmsServerIterator.hasNext(); ) {
+                    JMSServer jmsServer = (JMSServer) jmsServerIterator.next();
+                    Label jmsServerLabel = new Label(" JMS server " + jmsServer.getName() + " check");
+                    jmsServerLabel.setStyleName("Default");
+                    grid.add(jmsServerLabel);
+                    final Label jmsServerStatusLabel = new Label();
+                    jmsServerStatusLabel.setStyleName("Default");
+                    grid.add(jmsServerStatusLabel);
+                    final Label jmsServerButton = new Label();
+                    grid.add(jmsServerButton);
+                    // launch the jms server check thread
+                    final JMSServerCheckThread jmsServerCheckThread = new JMSServerCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(), jmsServer.getName());
+                    jmsServerCheckThread.start();
+                    // launch the synchronisation thread
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (jmsServerCheckThread.getCompleted()) {
+                                if (jmsServerCheckThread.getFailure()) {
+                                    jmsServerStatusLabel.setText("JMS server check error: " + jmsServerCheckThread.getErrorMessage());
+                                    jmsServerButton.setIcon(Styles.EXCLAMATION);
+                                } else {
+                                    if (jmsServerCheckThread.getUptodate()) {
+                                        jmsServerStatusLabel.setText("OK");
+                                        jmsServerButton.setIcon(Styles.ACCEPT);
+                                    } else {
+                                        jmsServerStatusLabel.setText("JMS server is not deployed or not up to date");
+                                        jmsServerButton.setIcon(Styles.EXCLAMATION);
+                                    }
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+                // check JNDI bindings
+                for (Iterator jndiBindingIterator = applicationServer.getJNDIBindings().iterator(); jndiBindingIterator.hasNext(); ) {
+                    JNDIBinding jndiBinding = (JNDIBinding) jndiBindingIterator.next();
+                    Label nameSpaceBindingLabel = new Label(" JNDI binding " + jndiBinding.getName() + " check");
+                    nameSpaceBindingLabel.setStyleName("Default");
+                    grid.add(nameSpaceBindingLabel);
+                    final Label nameSpaceBindingStatusLabel = new Label();
+                    nameSpaceBindingStatusLabel.setStyleName("Default");
+                    grid.add(nameSpaceBindingStatusLabel);
+                    final Label nameSpaceBindingButton = new Label();
+                    grid.add(nameSpaceBindingButton);
+                    // launch the name space binding check thread
+                    final JNDIBindingCheckThread JNDIBindingCheckThread = new JNDIBindingCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(), jndiBinding.getName());
+                    JNDIBindingCheckThread.start();
+                    // launch the synchronisation thread
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (JNDIBindingCheckThread.getCompleted()) {
+                                if (JNDIBindingCheckThread.getFailure()) {
+                                    nameSpaceBindingStatusLabel.setText("JNDI binding check error: " + JNDIBindingCheckThread.getErrorMessage());
+                                    nameSpaceBindingButton.setIcon(Styles.EXCLAMATION);
+                                } else {
+                                    if (JNDIBindingCheckThread.getUptodate()) {
+                                        nameSpaceBindingStatusLabel.setText("OK");
+                                        nameSpaceBindingButton.setIcon(Styles.ACCEPT);
+                                    } else {
+                                        nameSpaceBindingStatusLabel.setText("JNDI binding is not deployed or not up to date");
+                                        nameSpaceBindingButton.setIcon(Styles.EXCLAMATION);
+                                    }
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+                // check shared libraries
+                for (Iterator sharedLibraryIterator = applicationServer.getSharedLibraries().iterator(); sharedLibraryIterator.hasNext(); ) {
+                    SharedLibrary sharedLibrary = (SharedLibrary) sharedLibraryIterator.next();
+                    Label sharedLibraryLabel = new Label(" Shared library " + sharedLibrary.getName() + " check");
+                    sharedLibraryLabel.setStyleName("Default");
+                    grid.add(sharedLibraryLabel);
+                    final Label sharedLibraryStatusLabel = new Label();
+                    sharedLibraryStatusLabel.setStyleName("Default");
+                    grid.add(sharedLibraryLabel);
+                    final Label sharedLibraryButton = new Label();
+                    grid.add(sharedLibraryButton);
+                    // launch the shared library check thread
+                    final SharedLibraryCheckThread sharedLibraryCheckThread = new SharedLibraryCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(), sharedLibrary.getName());
+                    sharedLibraryCheckThread.start();
+                    // launch the synchronisation thread
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (sharedLibraryCheckThread.getCompleted()) {
+                                if (sharedLibraryCheckThread.getFailure()) {
+                                    sharedLibraryStatusLabel.setText("Shared library check error: " + sharedLibraryCheckThread.getErrorMessage());
+                                    sharedLibraryButton.setIcon(Styles.EXCLAMATION);
+                                } else {
+                                    if (sharedLibraryCheckThread.getUptodate()) {
+                                        sharedLibraryStatusLabel.setText("OK");
+                                        sharedLibraryButton.setIcon(Styles.ACCEPT);
+                                    } else {
+                                        sharedLibraryStatusLabel.setText("Shared library is not deployed or not up to date");
+                                        sharedLibraryButton.setIcon(Styles.EXCLAMATION);
+                                    }
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+                // check J2EE applications
+                for (Iterator applicationIterator = applicationServer.getJ2EEApplications().iterator(); applicationIterator.hasNext(); ) {
+                    J2EEApplication application = (J2EEApplication) applicationIterator.next();
+                    Label applicationLabel = new Label(" J2EE application " + application.getName() + " check");
+                    applicationLabel.setStyleName("Default");
+                    grid.add(applicationLabel);
+                    Label blankLabel = new Label(" ");
+                    grid.add(blankLabel);
+                    blankLabel = new Label(" ");
+                    grid.add(blankLabel);
+                    // check J2EE application archives
+                    for (Iterator archiveIterator = application.getArchives().iterator(); archiveIterator.hasNext(); ) {
+                        Archive archive = (Archive) archiveIterator.next();
+                        Label archiveLabel = new Label(" J2EE application archive " + archive.getName() + " check");
+                        archiveLabel.setStyleName("Default");
+                        grid.add(archiveLabel);
+                        final Label archiveStatusLabel = new Label();
+                        archiveStatusLabel.setStyleName("Default");
+                        grid.add(archiveStatusLabel);
+                        final Label archiveButton = new Label();
+                        grid.add(archiveButton);
+                        // launch the application archive check thread
+                        final J2EEApplicationArchiveCheckThread j2EEApplicationArchiveCheckThread = new J2EEApplicationArchiveCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(), application.getName(), archive
+                                .getName());
+                        j2EEApplicationArchiveCheckThread.start();
+                        // launch the synchronisation thread
+                        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                            public void run() {
+                                if (j2EEApplicationArchiveCheckThread.getCompleted()) {
+                                    if (j2EEApplicationArchiveCheckThread.getFailure()) {
+                                        archiveStatusLabel.setText("J2EE application archive check error: " + j2EEApplicationArchiveCheckThread.getErrorMessage());
+                                        archiveButton.setIcon(Styles.EXCLAMATION);
+                                    } else {
+                                        if (j2EEApplicationArchiveCheckThread.getUptodate()) {
+                                            archiveStatusLabel.setText("OK");
+                                            archiveButton.setIcon(Styles.ACCEPT);
+                                        } else {
+                                            archiveStatusLabel.setText("J2EE application archive is not deployed or not up to date");
+                                            archiveButton.setIcon(Styles.EXCLAMATION);
+                                        }
+                                    }
+                                } else {
+                                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                                }
+                            }
+                        });
+                    }
+                    // check J2EE application configuration files
+                    for (Iterator configurationFileIterator = application.getConfigurationFiles().iterator(); configurationFileIterator.hasNext(); ) {
+                        ConfigurationFile configurationFile = (ConfigurationFile) configurationFileIterator.next();
+                        Label configurationFileLabel = new Label(" J2EE application configuration file " + configurationFile.getName() + " check");
+                        configurationFileLabel.setStyleName("Default");
+                        grid.add(configurationFileLabel);
+                        final Label configurationFileStatusLabel = new Label();
+                        configurationFileStatusLabel.setStyleName("Default");
+                        grid.add(configurationFileStatusLabel);
+                        final Label configurationFileButton = new Label();
+                        grid.add(configurationFileButton);
+                        // launch the application configuration file check thread
+                        final J2EEApplicationConfigurationFileCheckThread j2EEApplicationConfigurationFileCheckThread = new J2EEApplicationConfigurationFileCheckThread(agent.getHostname(), agent.getPort(), parent.getEnvironmentName(), applicationServer.getName(),
+                                application.getName(), configurationFile.getName());
+                        j2EEApplicationConfigurationFileCheckThread.start();
+                        // launch the synchronisation thread
+                        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                            public void run() {
+                                if (j2EEApplicationConfigurationFileCheckThread.getCompleted()) {
+                                    if (j2EEApplicationConfigurationFileCheckThread.getFailure()) {
+                                        configurationFileStatusLabel.setText("J2EE application configuration file check error: " + j2EEApplicationConfigurationFileCheckThread.getErrorMessage());
+                                        configurationFileButton.setIcon(Styles.EXCLAMATION);
+                                    } else {
+                                        if (j2EEApplicationConfigurationFileCheckThread.getUptodate()) {
+                                            configurationFileStatusLabel.setText("OK");
+                                            configurationFileButton.setIcon(Styles.ACCEPT);
+                                        } else {
+                                            configurationFileStatusLabel.setText("J2EE application configuration file is not up to date");
+                                            configurationFileButton.setIcon(Styles.EXCLAMATION);
+                                        }
+                                    }
+                                } else {
+                                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                                }
+                            }
+                        });
+                    }
+                }
+            }
+        }
+    };
+
+    /**
+     * Create a new <code>EnvironmentCheckerTabPane</code>
+     *
+     * @param parent the parent <code>EnvironmentWindow</code>
+     */
+    public CheckerPane(EnvironmentWindow parent) {
+        super();
+        setStyleName("tab.content");
+
+        // update parent
+        this.parent = parent;
+
+        // column layout
+        Column content = new Column();
+        content.setCellSpacing(new Extent(2));
+        content.setInsets(new Insets(2));
+        add(content);
+
+        // add the launch button
+        Button launchButton = new Button(Messages.getString("status"), Styles.INFORMATION);
+        launchButton.addActionListener(launch);
+        content.add(launchButton);
+
+        // add results grid
+        grid = new Grid(3);
+        grid.setStyleName("border.grid");
+        content.add(grid);
+
+        // update the pane
+        update();
+    }
+
+    /**
+     * Update the pane
+     */
+    public void update() {
+        // nothing to do
+    }
+
+}
\ No newline at end of file

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConfirmWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConfirmWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConfirmWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConfirmWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,81 @@
+/*
+ * 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.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;
+
+/**
+ * Confirm window to interact with the user.
+ */
+public class ConfirmWindow extends WindowPane {
+
+    public ConfirmWindow(final ActionListener callback) {
+        super();
+
+        this.setStyleName("default");
+        this.setTitle(Messages.getString("confirm"));
+        this.setWidth(new Extent(220, Extent.PX));
+        this.setHeight(new Extent(120, Extent.PX));
+        this.setModal(true);
+
+        SplitPane content = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new Extent(32));
+        this.add(content);
+
+        // control row
+        Row controlRow = new Row();
+        controlRow.setStyleName("control");
+        content.add(controlRow);
+
+        // add yes button
+        Button yesButton = new Button(Messages.getString("yes"), Styles.ACCEPT);
+        yesButton.setStyleName("control");
+        yesButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                // call the callback
+                callback.actionPerformed(null);
+                // close the confirm window
+                ConfirmWindow.this.userClose();
+            }
+        });
+        controlRow.add(yesButton);
+
+        // add the no button
+        Button noButton = new Button(Messages.getString("no"), Styles.CROSS);
+        noButton.setStyleName("control");
+        noButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                ConfirmWindow.this.userClose();
+            }
+        });
+        controlRow.add(noButton);
+
+        // add the main label
+        Label mainLabel = new Label(Messages.getString("sure.question"));
+        content.add(mainLabel);
+
+    }
+
+}
\ No newline at end of file



Mime
View raw message