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 [10/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/
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionFactoriesPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionFactoriesPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionFactoriesPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionFactoriesPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,708 @@
+/*
+ * 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.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.Agent;
+import org.apache.kalumet.model.J2EEApplicationServer;
+import org.apache.kalumet.model.JMSConnectionFactory;
+import org.apache.kalumet.model.Kalumet;
+import org.apache.kalumet.ws.client.JMSConnectionFactoryClient;
+
+/**
+ * Environment JMS connection factories pane.
+ */
+public class ConnectionFactoriesPane extends ContentPane {
+
+ private EnvironmentWindow parent;
+ private SelectField scopeField;
+ private Grid grid;
+ private boolean newIsActive = true;
+ private boolean newIsBlocker = false;
+ private TextField newNameField;
+
+ // status thread
+ class StatusThread extends Thread {
+
+ public String serverName;
+ public String connectionFactoryName;
+ 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
+ JMSConnectionFactoryClient client = new JMSConnectionFactoryClient(agent.getHostname(), agent.getPort());
+ boolean uptodate = client.check(parent.getEnvironmentName(), serverName, connectionFactoryName);
+ if (uptodate) {
+ message = "JMS connection factory " + connectionFactoryName + " is up to date.";
+ } else {
+ failure = true;
+ message = "JMS connection factory " + connectionFactoryName + " is not up to date.";
+ }
+ } catch (Exception e) {
+ failure = true;
+ message = "JMS connection factory " + connectionFactoryName + " status check failed: " + e.getMessage();
+ } finally {
+ ended = true;
+ }
+ }
+ }
+
+ // update thread
+ class UpdateThread extends Thread {
+
+ public String serverName;
+ public String connectionFactoryName;
+ 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
+ JMSConnectionFactoryClient client = new JMSConnectionFactoryClient(agent.getHostname(), agent.getPort());
+ client.update(parent.getEnvironmentName(), serverName, connectionFactoryName);
+ } catch (Exception e) {
+ failure = true;
+ message = "JMS connection factory " + connectionFactoryName + " update failed: " + e.getMessage();
+ } finally {
+ ended = true;
+ }
+ }
+ }
+
+ // scope select
+ private ActionListener scopeSelect = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ update();
+ }
+ };
+ // edit
+ private ActionListener edit = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check the user has the environment lock
+ if (!getEnvironementWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // check if the user can do it
+ if (!getEnvironementWindow().adminPermission
+ && !getEnvironementWindow().jeeResourcesPermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restrictied"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // get the JMS connection factory name
+ String name = event.getActionCommand();
+ // get the JMS connection factory name field
+ TextField nameField = (TextField) ConnectionFactoriesPane.this.getComponent("cfname_" + parent.getEnvironmentName() + "_" + (String) scopeField.getSelectedItem() + "_"
+ + name);
+ String nameFieldValue = nameField.getText();
+ // check the field value
+ if (nameFieldValue == null || nameFieldValue.trim().length() < 1) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.mandatory"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // if the use change the JMS connection factory name, check if the name
+ // if not already in use
+ if (!name.equals(nameFieldValue)) {
+ if (parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSConnectionFactory(nameFieldValue) != null) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.exists"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ }
+ // looking for the JMS connection factory object
+ JMSConnectionFactory connectionFactory = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSConnectionFactory(name);
+ if (connectionFactory == null) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.notfound"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // add a change event
+ parent.getChangeEvents().add("Change JMS connection factory " + connectionFactory.getName());
+ // update the JMS connection factory object
+ connectionFactory.setName(nameFieldValue);
+ // change the updated flag
+ parent.setUpdated(true);
+ // update the journal log tab pane
+ parent.updateJournalPane();
+ // update only the pane
+ update();
+ }
+ };
+ // create
+ private ActionListener create = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check if the user has the environment lock
+ if (!getEnvironementWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // check if the user can do it
+ if (!getEnvironementWindow().adminPermission
+ && !getEnvironementWindow().jeeResourcesPermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // get the new JMS connection factory name field value
+ String newNameFieldValue = newNameField.getText();
+ // check the mandatory field
+ if (newNameFieldValue == null || newNameFieldValue.trim().length() < 1) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.mandatory"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // create a new JMS connection factory object
+ JMSConnectionFactory connectionFactory = new JMSConnectionFactory();
+ connectionFactory.setName(newNameFieldValue);
+ connectionFactory.setActive(newIsActive);
+ // add the JMS connection factory
+ try {
+ parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).addJMSConnectionFactory(connectionFactory);
+ } catch (Exception e) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.exists"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // add a change event
+ parent.getChangeEvents().add("Create JMS connection factory " + connectionFactory.getName());
+ // change the updated flag
+ parent.setUpdated(true);
+ // update the journal log tab pane
+ parent.updateJournalPane();
+ // update only the pane
+ update();
+ }
+ };
+ // delete
+ private ActionListener delete = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check if the user has the environment lock
+ if (!getEnvironementWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // check if the user can do it
+ if (!getEnvironementWindow().adminPermission
+ && !getEnvironementWindow().jeeResourcesPermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // get the JMS connection factory name
+ final String name = event.getActionCommand();
+ // display confirm window
+ KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // looking for the JMS connection factory object
+ JMSConnectionFactory connectionFactory = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSConnectionFactory(name);
+ if (connectionFactory == null) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.notfound"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // delete the JMS connection factory
+ parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSConnectionFactories().remove(connectionFactory);
+ // add a change event
+ parent.getChangeEvents().add("Delete JMS connection factory " + connectionFactory.getName());
+ // change the updated flag
+ parent.setUpdated(true);
+ // update the journal log tab pane
+ parent.updateJournalPane();
+ // update only the pane
+ update();
+ }
+ }));
+ }
+ };
+ // toggle active
+ private ActionListener toggleActive = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check if the user has the environment lock
+ if (!getEnvironementWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // check if the user can do it
+ if (!getEnvironementWindow().adminPermission
+ && !getEnvironementWindow().jeeResourcesPermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // looking for the JMS connection factory object
+ JMSConnectionFactory connectionFactory = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSConnectionFactory(event.getActionCommand());
+ if (connectionFactory == null) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.notfound"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // change the jms connection factory state and add a change event
+ if (connectionFactory.isActive()) {
+ connectionFactory.setActive(false);
+ parent.getChangeEvents().add("Disable JMS connection factory " + connectionFactory.getName());
+ } else {
+ connectionFactory.setActive(true);
+ parent.getChangeEvents().add("Enable JMS connection factory " + connectionFactory.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 (!getEnvironementWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // check if the user can do it
+ if (!getEnvironementWindow().adminPermission
+ && !getEnvironementWindow().jeeResourcesPermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // looking for the JMS connection factory object
+ JMSConnectionFactory connectionFactory = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSConnectionFactory(event.getActionCommand());
+ if (connectionFactory == null) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionfactory.notfound"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // change the jms connection factory blocker state and add a change
+ // event
+ if (connectionFactory.isBlocker()) {
+ connectionFactory.setBlocker(false);
+ parent.getChangeEvents().add("Set not blocker for JMS connection factory " + connectionFactory.getName());
+ } else {
+ connectionFactory.setBlocker(true);
+ parent.getChangeEvents().add("Set blocker for JMS connection factory " + connectionFactory.getName());
+ }
+ // change the updated flag
+ parent.setUpdated(true);
+ // update the journal log tab pane
+ parent.updateJournalPane();
+ // update the pane
+ update();
+ }
+ };
+ // new toggle active
+ private ActionListener newToggleActive = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // toggle the state
+ if (newIsActive) {
+ newIsActive = false;
+ } else {
+ newIsActive = true;
+ }
+ // update the pane
+ update();
+ }
+ };
+ // new toggle blocker
+ private ActionListener newToggleBlocker = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // toggle the blocker state
+ if (newIsBlocker) {
+ newIsBlocker = false;
+ } else {
+ newIsBlocker = true;
+ }
+ // update the pane
+ update();
+ }
+ };
+ // copy
+ private ActionListener copy = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // looking for the JMS connection factory
+ JMSConnectionFactory connectionFactory = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSConnectionFactory(event.getActionCommand());
+ if (connectionFactory == null) {
+ return;
+ }
+ try {
+ KalumetConsoleApplication.getApplication().setCopyComponent(connectionFactory.clone());
+ } catch (Exception e) {
+ return;
+ }
+ }
+ };
+ // paste
+ private ActionListener paste = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ Object copy = KalumetConsoleApplication.getApplication().getCopyComponent();
+ // check if the copy object is correct
+ if (copy == null || !(copy instanceof JMSConnectionFactory)) {
+ return;
+ }
+ // update the new fields
+ newNameField.setText(((JMSConnectionFactory) copy).getName());
+ }
+ };
+ // status
+ private ActionListener status = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check if some has not yet been saved
+ if (getEnvironementWindow().isUpdated()) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // get the connection factory
+ String connectionFactoryName = event.getActionCommand();
+ String serverName = (String) scopeField.getSelectedItem();
+ // add a message into the log pane and the journal
+ KalumetConsoleApplication.getApplication().getLogPane().addInfo("JMS connection factory " + connectionFactoryName + " status check in progress...", parent.getEnvironmentName());
+ parent.getChangeEvents().add("JMS connection factory " + connectionFactoryName + " status check requested.");
+ // start the status thread
+ final StatusThread statusThread = new StatusThread();
+ statusThread.serverName = serverName;
+ statusThread.connectionFactoryName = connectionFactoryName;
+ 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().addWarning(statusThread.message, parent.getEnvironmentName());
+ } else {
+ KalumetConsoleApplication.getApplication().getLogPane().addInfo(statusThread.message, parent.getEnvironmentName());
+ }
+ parent.getChangeEvents().add(statusThread.message);
+ } else {
+ KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+ }
+ }
+ });
+ }
+ };
+ // update
+ private ActionListener update = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check if the user has the lock
+ if (!getEnvironementWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // check if the user can do it
+ if (!getEnvironementWindow().adminPermission
+ && !getEnvironementWindow().jeeResourcesUpdatePermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // check if some change has not been saved
+ if (getEnvironementWindow().isUpdated()) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironementWindow().getEnvironmentName());
+ return;
+ }
+ // get the connection factory and server name
+ final String serverName = (String) scopeField.getSelectedItem();
+ final String connectionFactoryName = 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("JMS connection factory " + connectionFactoryName + " update in progress...", parent.getEnvironmentName());
+ parent.getChangeEvents().add("JMS connection factory " + connectionFactoryName + " update requested.");
+ // start the update thread
+ final UpdateThread updateThread = new UpdateThread();
+ updateThread.serverName = serverName;
+ updateThread.connectionFactoryName = connectionFactoryName;
+ 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("JMS connection factory " + connectionFactoryName + " updated.", parent.getEnvironmentName());
+ parent.getChangeEvents().add("JMS connection factory " + connectionFactoryName + " updated.");
+ }
+ } else {
+ KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+ }
+ }
+ });
+ }
+ }));
+ }
+ };
+
+ /**
+ * Create a new <code>ConnectionFactoriesPane</code>.
+ *
+ * @param parent the parent <code>EnvironmentWindow</code>.
+ */
+ public ConnectionFactoriesPane(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 select 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"));
+ scopeLabel.setStyleName("default");
+ 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 JMS connection factories grid
+ grid = new Grid(2);
+ grid.setStyleName("border.grid");
+ grid.setColumnWidth(0, new Extent(50, Extent.PX));
+ grid.setColumnWidth(1, new Extent(100, Extent.PERCENT));
+ content.add(grid);
+
+ // update
+ 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 JMS connection factories grid children
+ grid.removeAll();
+
+ if (scopeListModel.size() < 1) {
+ // no application server present
+ 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 JMS connection factories grid header
+ Label connectionFactoryHeader = new Label(" ");
+ connectionFactoryHeader.setStyleName("grid.header");
+ grid.add(connectionFactoryHeader);
+ Label connectionFactoryNameHeader = new Label(Messages.getString("name"));
+ connectionFactoryNameHeader.setStyleName("grid.header");
+ grid.add(connectionFactoryNameHeader);
+ // add the jms connection factories
+ for (Iterator jmsConnectionFactoryIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(applicationServerName).getJMSConnectionFactories().iterator(); jmsConnectionFactoryIterator.hasNext(); ) {
+ JMSConnectionFactory connectionFactory = (JMSConnectionFactory) jmsConnectionFactoryIterator.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(connectionFactory.getName());
+ copyButton.addActionListener(copy);
+ row.add(copyButton);
+ // active
+ Button activeButton;
+ if (connectionFactory.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 (getEnvironementWindow().adminPermission
+ || getEnvironementWindow().jeeResourcesPermission) {
+ activeButton.setActionCommand(connectionFactory.getName());
+ activeButton.addActionListener(toggleActive);
+ }
+ row.add(activeButton);
+ // blocker
+ Button blockerButton;
+ if (connectionFactory.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 (getEnvironementWindow().adminPermission
+ || getEnvironementWindow().jeeResourcesPermission) {
+ blockerButton.setActionCommand(connectionFactory.getName());
+ blockerButton.addActionListener(toggleBlocker);
+ }
+ row.add(blockerButton);
+ // status
+ Button statusButton = new Button(Styles.INFORMATION);
+ statusButton.setToolTipText(Messages.getString("status"));
+ statusButton.setActionCommand(connectionFactory.getName());
+ statusButton.addActionListener(status);
+ row.add(statusButton);
+ if (getEnvironementWindow().adminPermission
+ || getEnvironementWindow().jeeResourcesUpdatePermission) {
+ // update
+ Button updateButton = new Button(Styles.COG);
+ updateButton.setToolTipText(Messages.getString("update"));
+ updateButton.setActionCommand(connectionFactory.getName());
+ updateButton.addActionListener(update);
+ row.add(updateButton);
+ }
+ if (getEnvironementWindow().adminPermission
+ || getEnvironementWindow().jeeResourcesPermission) {
+ // edit
+ Button editButton = new Button(Styles.ACCEPT);
+ editButton.setToolTipText(Messages.getString("apply"));
+ editButton.setActionCommand(connectionFactory.getName());
+ editButton.addActionListener(edit);
+ row.add(editButton);
+ // delete
+ Button deleteButton = new Button(Styles.DELETE);
+ deleteButton.setToolTipText(Messages.getString("delete"));
+ deleteButton.setActionCommand(connectionFactory.getName());
+ deleteButton.addActionListener(delete);
+ row.add(deleteButton);
+ }
+ // name
+ TextField nameField = new TextField();
+ nameField.setId("cfname_" + parent.getEnvironmentName() + "_" + applicationServerName + "_" + connectionFactory.getName());
+ nameField.setStyleName("default");
+ nameField.setWidth(new Extent(100, Extent.PERCENT));
+ nameField.setText(connectionFactory.getName());
+ grid.add(nameField);
+ }
+
+ // add the blank row to create a new JMS connection factory
+ if (getEnvironementWindow().adminPermission
+ || getEnvironementWindow().jeeResourcesPermission) {
+ // row
+ Row row = new Row();
+ row.setInsets(new Insets(2));
+ row.setCellSpacing(new Extent(2));
+ grid.add(row);
+ // paste
+ Button pasteButton = new Button(Styles.PAGE_PASTE);
+ pasteButton.setToolTipText(Messages.getString("paste"));
+ pasteButton.addActionListener(paste);
+ row.add(pasteButton);
+ // active
+ Button activeButton;
+ if (newIsActive) {
+ activeButton = new Button(Styles.LIGHTBULB);
+ activeButton.setToolTipText(Messages.getString("switch.disable"));
+ } else {
+ activeButton = new Button(Styles.LIGHTBULB_OFF);
+ activeButton.setToolTipText(Messages.getString("switch.enable"));
+ }
+ activeButton.addActionListener(newToggleActive);
+ row.add(activeButton);
+ // blocker
+ Button blockerButton;
+ if (newIsBlocker) {
+ blockerButton = new Button(Styles.PLUGIN);
+ blockerButton.setToolTipText(Messages.getString("switch.notblocker"));
+ } else {
+ blockerButton = new Button(Styles.PLUGIN_DISABLED);
+ blockerButton.setToolTipText(Messages.getString("switch.blocker"));
+ }
+ blockerButton.addActionListener(newToggleBlocker);
+ row.add(blockerButton);
+ // add
+ Button addButton = new Button(Styles.ADD);
+ addButton.setToolTipText(Messages.getString("add"));
+ addButton.addActionListener(create);
+ row.add(addButton);
+ // name
+ newNameField = new TextField();
+ newNameField.setStyleName("default");
+ newNameField.setWidth(new Extent(100, Extent.PERCENT));
+ grid.add(newNameField);
+ }
+ }
+
+ public EnvironmentWindow getEnvironementWindow() {
+ return parent;
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolCapacityPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolCapacityPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolCapacityPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolCapacityPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.TextField;
+
+/**
+ * JDBC connection pool capacity tab pane.
+ */
+public class ConnectionPoolCapacityPane extends ContentPane {
+
+ private ConnectionPoolWindow parent;
+
+ private TextField initialField;
+ private TextField maximalField;
+ private TextField incrementField;
+
+ /**
+ * Create a new <code>JDBCConnectionPoolCapacityTabPane</code>.
+ *
+ * @param parent the parent <code>JDBCConnectionPoolWindow</code>.
+ */
+ public ConnectionPoolCapacityPane(ConnectionPoolWindow parent) {
+ super();
+ setStyleName("tab.content");
+
+ // update parent
+ this.parent = parent;
+
+ // add the capacity layout grid
+ Grid layout = new Grid(2);
+ layout.setStyleName("default");
+ layout.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+ layout.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+ add(layout);
+
+ // add the initial field
+ Label initialLabel = new Label(Messages.getString("initial"));
+ initialLabel.setStyleName("grid.cell");
+ layout.add(initialLabel);
+ initialField = new TextField();
+ initialField.setStyleName("default");
+ initialField.setWidth(new Extent(10, Extent.EX));
+ layout.add(initialField);
+
+ // add the maximal field
+ Label maximalLabel = new Label(Messages.getString("maximal"));
+ maximalLabel.setStyleName("grid.cell");
+ layout.add(maximalLabel);
+ maximalField = new TextField();
+ maximalField.setStyleName("default");
+ maximalField.setWidth(new Extent(10, Extent.EX));
+ layout.add(maximalField);
+
+ // add the increment field
+ Label incrementLabel = new Label(Messages.getString("increment"));
+ incrementLabel.setStyleName("grid.cell");
+ layout.add(incrementLabel);
+ incrementField = new TextField();
+ incrementField.setStyleName("default");
+ incrementField.setWidth(new Extent(10, Extent.EX));
+ layout.add(incrementField);
+
+ // update the pane
+ update();
+ }
+
+ /**
+ * Update the pane
+ */
+ public void update() {
+ // update the JDBC connection pool initial field
+ initialField.setText(new Integer(parent.getConnectionPool().getInitial()).toString());
+ // update the JDBC connection pool maximal field
+ maximalField.setText(new Integer(parent.getConnectionPool().getMaximal()).toString());
+ // update the JDBC connection pool increment field
+ incrementField.setText(new Integer(parent.getConnectionPool().getIncrement()).toString());
+ }
+
+ public TextField getInitialField() {
+ return this.initialField;
+ }
+
+ public TextField getMaximalField() {
+ return this.maximalField;
+ }
+
+ public TextField getIncrementField() {
+ return this.incrementField;
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDatabasePane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDatabasePane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDatabasePane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDatabasePane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.PasswordField;
+import nextapp.echo2.app.TextField;
+
+/**
+ * JDBC connection pool database tab <code>ContentPane</code>.
+ */
+public class ConnectionPoolDatabasePane extends ContentPane {
+
+ // attributes
+ private ConnectionPoolWindow parent;
+
+ private TextField urlField;
+ private TextField userField;
+ private PasswordField passwordField;
+ private PasswordField confirmPasswordField;
+
+ /**
+ * Create a new <code>JDBCConnectionPoolDatabaseTabPane</code>.<
+ *
+ * @param parent the parent <code>JDBCConnectionPoolWindow</code>.
+ */
+ public ConnectionPoolDatabasePane(ConnectionPoolWindow parent) {
+ super();
+ setStyleName("tab.content");
+
+ // update parent
+ this.parent = parent;
+
+ // add the database layout grid
+ Grid layout = new Grid(2);
+ layout.setStyleName("default");
+ layout.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+ layout.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+ add(layout);
+
+ // add the URL field
+ Label urlLabel = new Label(Messages.getString("jdbc"));
+ urlLabel.setStyleName("grid.cell");
+ layout.add(urlLabel);
+ urlField = new TextField();
+ urlField.setStyleName("default");
+ urlField.setWidth(new Extent(100, Extent.PERCENT));
+ layout.add(urlField);
+
+ // add the user field
+ Label userLabel = new Label(Messages.getString("user"));
+ userLabel.setStyleName("grid.cell");
+ layout.add(userLabel);
+ userField = new TextField();
+ userField.setStyleName("default");
+ userField.setWidth(new Extent(100, Extent.PERCENT));
+ layout.add(userField);
+
+ // add the password field
+ Label passwordLabel = new Label(Messages.getString("password"));
+ passwordLabel.setStyleName("grid.cell");
+ layout.add(passwordLabel);
+ passwordField = new PasswordField();
+ passwordField.setStyleName("default");
+ passwordField.setWidth(new Extent(100, Extent.PERCENT));
+ layout.add(passwordField);
+
+ // add the confirm password field
+ Label confirmPasswordLabel = new Label(Messages.getString("password.confirm"));
+ confirmPasswordLabel.setStyleName("grid.cell");
+ layout.add(confirmPasswordLabel);
+ confirmPasswordField = new PasswordField();
+ confirmPasswordField.setStyleName("default");
+ confirmPasswordField.setWidth(new Extent(100, Extent.PERCENT));
+ layout.add(confirmPasswordField);
+
+ // update the pane
+ update();
+ }
+
+ /**
+ * Update the pane
+ */
+ public void update() {
+ // update the JDBC connection pool URL field
+ urlField.setText(parent.getConnectionPool().getUrl());
+ // update the JDBC connection pool user field
+ userField.setText(parent.getConnectionPool().getUser());
+ // update the JDBC connection pool password field
+ passwordField.setText(parent.getConnectionPool().getPassword());
+ confirmPasswordField.setText(parent.getConnectionPool().getPassword());
+ }
+
+ public TextField getUrlField() {
+ return this.urlField;
+ }
+
+ public TextField getUserField() {
+ return this.userField;
+ }
+
+ public PasswordField getPasswordField() {
+ return this.passwordField;
+ }
+
+ public PasswordField getConfirmPasswordField() {
+ return this.confirmPasswordField;
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDriverPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDriverPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDriverPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolDriverPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.SelectField;
+import nextapp.echo2.app.TextField;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * JDBC connection pool driver tab <code>ContentPane</code>
+ */
+public class ConnectionPoolDriverPane extends ContentPane {
+
+ // constants
+ private static String[] DRIVERS = new String[]{Messages.getString("jdbc.driver.oracle.thin"), Messages.getString("jdbc.driver.oracle.xa"),
+ Messages.getString("jdbc.driver.ibm.db2"), Messages.getString("jdbc.driver.mysql"), Messages.getString("jdbc.driver.postgresql")};
+ private static String[] HELPERS = new String[]{" ", Messages.getString("jdbc.helper.websphere.generic"),
+ Messages.getString("jdbc.helper.websphere.oracle")};
+
+ // attributes
+ private ConnectionPoolWindow parent;
+
+ private SelectField driverField;
+ private SelectField helperField;
+ private TextField classpathField;
+
+ /**
+ * Create a new <code>JDBCConnectionPoolDriverTabPane</code>.
+ *
+ * @param parent the parent <code>JDBCConnectionPoolWindow</code>.
+ */
+ public ConnectionPoolDriverPane(ConnectionPoolWindow parent) {
+ super();
+ setStyleName("tab;content");
+
+ // update parent
+ this.parent = parent;
+
+ // add the driver layout grid
+ Grid layout = new Grid(2);
+ layout.setStyleName("default");
+ layout.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+ layout.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+ add(layout);
+
+ // add the driver field
+ Label driverLabel = new Label(Messages.getString("jdbc.driver"));
+ driverLabel.setStyleName("grid.cell");
+ layout.add(driverLabel);
+ driverField = new SelectField(ConnectionPoolDriverPane.DRIVERS);
+ driverField.setStyleName("default");
+ driverField.setWidth(new Extent(50, Extent.EX));
+ driverField.setSelectedIndex(0);
+ layout.add(driverField);
+
+ // add the helper field
+ Label helperLabel = new Label(Messages.getString("jdbc.helper"));
+ helperLabel.setStyleName("grid.cell");
+ layout.add(helperLabel);
+ helperField = new SelectField(ConnectionPoolDriverPane.HELPERS);
+ helperField.setStyleName("default");
+ helperField.setWidth(new Extent(50, Extent.EX));
+ helperField.setSelectedIndex(0);
+ layout.add(helperField);
+
+ // add the classpath field
+ Label classpathLabel = new Label(Messages.getString("classpath"));
+ classpathLabel.setStyleName("grid.cell");
+ layout.add(classpathLabel);
+ classpathField = new TextField();
+ classpathField.setStyleName("default");
+ classpathField.setWidth(new Extent(100, Extent.PERCENT));
+ layout.add(classpathField);
+
+ // update the pane
+ update();
+ }
+
+ /**
+ * Update the pane
+ */
+ public void update() {
+ // update the JDBC connection pool driver field
+ if (StringUtils.containsIgnoreCase(parent.getConnectionPool().getDriver(), "oracle")) {
+ if (StringUtils.containsIgnoreCase(parent.getConnectionPool().getDriver(), "xa")) {
+ driverField.setSelectedIndex(1);
+ } else {
+ driverField.setSelectedIndex(0);
+ }
+ }
+ if (StringUtils.containsIgnoreCase(parent.getConnectionPool().getDriver(), "db2")) {
+ driverField.setSelectedIndex(2);
+ }
+ if (StringUtils.containsIgnoreCase(parent.getConnectionPool().getDriver(), "mysql")) {
+ driverField.setSelectedIndex(3);
+ }
+ if (StringUtils.containsIgnoreCase(parent.getConnectionPool().getDriver(), "postgres")) {
+ driverField.setSelectedIndex(4);
+ }
+ // update the JDBC connection pool helper field
+ helperField.setSelectedIndex(0);
+ if (StringUtils.containsIgnoreCase(parent.getConnectionPool().getHelperclass(), "generic")) {
+ helperField.setSelectedIndex(1);
+ }
+ if (StringUtils.containsIgnoreCase(parent.getConnectionPool().getHelperclass(), "oracle")) {
+ helperField.setSelectedIndex(2);
+ }
+ // update the JDBC connection pool classpath field
+ classpathField.setText(parent.getConnectionPool().getClasspath());
+ }
+
+ public SelectField getDriverField() {
+ return this.driverField;
+ }
+
+ public SelectField getHelperField() {
+ return this.helperField;
+ }
+
+ public TextField getClasspathField() {
+ return this.classpathField;
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolGeneralPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolGeneralPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolGeneralPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolGeneralPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.SelectField;
+import nextapp.echo2.app.TextField;
+
+/**
+ * JDBC connection pool general tab <code>ContentPane</code>.
+ */
+public class ConnectionPoolGeneralPane extends ContentPane {
+
+ // attributes
+ private ConnectionPoolWindow parent;
+
+ private TextField nameField;
+ private SelectField activeField;
+ private SelectField blockerField;
+
+ /**
+ * Create a new <code>JDBCConnectionPoolGeneralTabPane</code>.
+ *
+ * @param parent the parent <code>JDBCConnectionPoolWindow</code>.
+ */
+ public ConnectionPoolGeneralPane(ConnectionPoolWindow parent) {
+ super();
+ setStyleName("tab.content");
+
+ // update parent
+ this.parent = parent;
+
+ // add the general grid layout
+ Grid layout = new Grid(2);
+ layout.setStyleName("default");
+ layout.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+ layout.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+ add(layout);
+
+ // add the name field
+ Label nameLabel = new Label(Messages.getString("name"));
+ nameLabel.setStyleName("grid.cell");
+ layout.add(nameLabel);
+ nameField = new TextField();
+ nameField.setStyleName("default");
+ nameField.setWidth(new Extent(100, Extent.PERCENT));
+ layout.add(nameField);
+
+ // add the active field
+ Label jdbcConnectionPoolActiveLabel = new Label(Messages.getString("active"));
+ jdbcConnectionPoolActiveLabel.setStyleName("grid.cell");
+ layout.add(jdbcConnectionPoolActiveLabel);
+ activeField = new SelectField(MainScreen.LABELS);
+ activeField.setStyleName("default");
+ activeField.setWidth(new Extent(10, Extent.EX));
+ activeField.setSelectedIndex(0);
+ layout.add(activeField);
+
+ // add the blocker field
+ Label jdbcConnectionPoolBlockerLabel = new Label(Messages.getString("blocker"));
+ jdbcConnectionPoolBlockerLabel.setStyleName("grid.cell");
+ layout.add(jdbcConnectionPoolBlockerLabel);
+ blockerField = new SelectField(MainScreen.LABELS);
+ blockerField.setStyleName("default");
+ blockerField.setWidth(new Extent(10, Extent.EX));
+ blockerField.setSelectedIndex(0);
+ layout.add(blockerField);
+
+ // update the pane
+ update();
+ }
+
+ /**
+ * Update the pane.
+ */
+ public void update() {
+ // update the JDBC connection pool name field
+ nameField.setText(parent.getConnectionPool().getName());
+ // update the JDBC connection pool active field
+ if (parent.getConnectionPool().isActive()) {
+ activeField.setSelectedIndex(0);
+ } else {
+ activeField.setSelectedIndex(1);
+ }
+ // update the JDBC connection pool blocker field
+ if (parent.getConnectionPool().isBlocker()) {
+ blockerField.setSelectedIndex(0);
+ } else {
+ blockerField.setSelectedIndex(1);
+ }
+ }
+
+ public TextField getNameField() {
+ return this.nameField;
+ }
+
+ public SelectField getActiveField() {
+ return this.activeField;
+ }
+
+ public SelectField getBlockerField() {
+ return this.blockerField;
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ConnectionPoolWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,550 @@
+/*
+ * 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.Row;
+import nextapp.echo2.app.SplitPane;
+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.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.Agent;
+import org.apache.kalumet.model.JDBCConnectionPool;
+import org.apache.kalumet.model.Kalumet;
+import org.apache.kalumet.ws.client.JDBCConnectionPoolClient;
+
+/**
+ * JDBC connection pool window.
+ */
+public class ConnectionPoolWindow extends WindowPane {
+
+ private String connectionPoolName;
+ private String applicationServerName;
+ private JDBCConnectionPool connectionPool = null;
+ private ConnectionPoolsPane parent;
+ private ConnectionPoolGeneralPane generalPane;
+ private ConnectionPoolDriverPane driverPane;
+ private ConnectionPoolDatabasePane databasePane;
+ private ConnectionPoolCapacityPane capacityPane;
+
+ // status thread
+ class StatusThread 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.getEnvironmentWindow().getEnvironment().getAgent());
+ if (agent == null) {
+ throw new IllegalArgumentException("agent not found.");
+ }
+ // call the webservice
+ JDBCConnectionPoolClient client = new JDBCConnectionPoolClient(agent.getHostname(), agent.getPort());
+ boolean uptodate = client.check(parent.getEnvironmentWindow().getEnvironmentName(), applicationServerName, connectionPoolName);
+ if (uptodate) {
+ message = "JDBC connection pool " + connectionPoolName + " is up to date.";
+ } else {
+ failure = true;
+ message = "JDBC connection pool " + connectionPoolName + " is not up to date.";
+ }
+ } catch (Exception e) {
+ failure = true;
+ message = "JDBC connection pool " + connectionPoolName + " status check failed: " + e.getMessage();
+ } finally {
+ ended = true;
+ }
+ }
+ }
+
+ // 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.getEnvironmentWindow().getEnvironment().getAgent());
+ if (agent == null) {
+ throw new IllegalArgumentException("agent not found.");
+ }
+ // call the webservice
+ JDBCConnectionPoolClient client = new JDBCConnectionPoolClient(agent.getHostname(), agent.getPort());
+ client.update(parent.getEnvironmentWindow().getEnvironmentName(), applicationServerName, connectionPoolName);
+ } catch (Exception e) {
+ failure = true;
+ message = "JDBC connection pool " + connectionPoolName + " update failed: " + e.getMessage();
+ } finally {
+ ended = true;
+ }
+ }
+ }
+
+ // close
+ private ActionListener close = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ ConnectionPoolWindow.this.userClose();
+ }
+ };
+ // refresh
+ private ActionListener refresh = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // looking for original JDBC connection pool object
+ connectionPool = parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(applicationServerName).getJDBCConnectionPool(connectionPoolName);
+ if (connectionPool == null) {
+ connectionPool = new JDBCConnectionPool();
+ }
+ // update the window
+ 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().jeeResourcesPermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+ return;
+ }
+ // display confirm window
+ KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // remove the connection pool
+ parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(applicationServerName).getJDBCConnectionPools().remove(connectionPool);
+ // add a change event
+ parent.getEnvironmentWindow().getChangeEvents().add("Delete JDBC connection pool " + connectionPool.getName());
+ // change the updated flag
+ parent.getEnvironmentWindow().setUpdated(true);
+ // update the whole parent window
+ parent.getEnvironmentWindow().update();
+ // close the window
+ ConnectionPoolWindow.this.userClose();
+ }
+ }));
+ }
+ };
+ // 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().jeeResourcesPermission) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricited"), getEnvironmentWindow().getEnvironmentName());
+ return;
+ }
+ // get fields value
+ String nameFieldValue = generalPane.getNameField().getText();
+ int activeFieldIndex = generalPane.getActiveField().getSelectedIndex();
+ int blockerFieldIndex = generalPane.getBlockerField().getSelectedIndex();
+ int driverFieldIndex = driverPane.getDriverField().getSelectedIndex();
+ int helperFieldIndex = driverPane.getHelperField().getSelectedIndex();
+ String classpathFieldValue = driverPane.getClasspathField().getText();
+ String urlFieldValue = databasePane.getUrlField().getText();
+ String userFieldValue = databasePane.getUserField().getText();
+ String passwordFieldValue = databasePane.getPasswordField().getText();
+ String confirmPasswordFieldValue = databasePane.getConfirmPasswordField().getText();
+ String initialFieldValue = capacityPane.getInitialField().getText();
+ String maximalFieldValue = capacityPane.getMaximalField().getText();
+ String incrementFieldValue = capacityPane.getIncrementField().getText();
+ // check select fields
+ if (activeFieldIndex < 0 || driverFieldIndex < 0 || helperFieldIndex < 0) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionpool.selected"));
+ return;
+ }
+ // check name, url, user are mandatory
+ if (nameFieldValue == null || nameFieldValue.trim().length() < 1 || urlFieldValue == null || urlFieldValue.trim().length() < 1 || userFieldValue == null
+ || userFieldValue.trim().length() < 1) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionpool.mandatory"));
+ return;
+ }
+ // check number value
+ int jdbcConnectionPoolInitialFieldNumber;
+ int jdbcConnectionPoolMaximalFieldNumber;
+ int jdbcConnectionPoolIncrementFieldNumber;
+ try {
+ jdbcConnectionPoolInitialFieldNumber = new Integer(initialFieldValue).intValue();
+ jdbcConnectionPoolMaximalFieldNumber = new Integer(maximalFieldValue).intValue();
+ jdbcConnectionPoolIncrementFieldNumber = new Integer(incrementFieldValue).intValue();
+ } catch (Exception e) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionpool.notinteger"));
+ return;
+ }
+ // check password matching
+ if (!passwordFieldValue.equals(confirmPasswordFieldValue)) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionpool.passwordmatch"));
+ return;
+ }
+ // if the user change the JDBC connection pool name, check if the JDBC
+ // connection pool name doesn't already exist
+ if (connectionPoolName == null || (connectionPoolName != null && !connectionPoolName.equals(nameFieldValue))) {
+ if (parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(applicationServerName).getJDBCConnectionPool(nameFieldValue) != null) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionpool.exists"));
+ return;
+ }
+ }
+ // add a change event
+ if (connectionPoolName != null) {
+ parent.getEnvironmentWindow().getChangeEvents().add("Change JDBC connection pool " + connectionPool.getName());
+ }
+ // update the connection pool object
+ connectionPool.setName(nameFieldValue);
+ if (activeFieldIndex == 0) {
+ connectionPool.setActive(true);
+ } else {
+ connectionPool.setActive(false);
+ }
+ if (blockerFieldIndex == 0) {
+ connectionPool.setBlocker(true);
+ } else {
+ connectionPool.setBlocker(false);
+ }
+ if (driverFieldIndex == 0) {
+ connectionPool.setDriver("oracle.jdbc.driver.OracleDriver");
+ }
+ if (driverFieldIndex == 1) {
+ connectionPool.setDriver("oracle.jdbc.xa.client.OracleXADataSource");
+ }
+ if (driverFieldIndex == 2) {
+ connectionPool.setDriver("com.ibm.db2.jcc.DB2Driver");
+ }
+ if (driverFieldIndex == 3) {
+ connectionPool.setDriver("com.mysql.jdbc.Driver");
+ }
+ if (driverFieldIndex == 4) {
+ connectionPool.setDriver("org.postgresql.Driver");
+ }
+ if (helperFieldIndex == 0) {
+ connectionPool.setHelperclass(null);
+ }
+ if (helperFieldIndex == 1) {
+ connectionPool.setHelperclass("com.ibm.websphere.rsadapter.GenericDataStoreHelper");
+ }
+ if (helperFieldIndex == 2) {
+ connectionPool.setHelperclass("com.ibm.websphere.rsadapter.OracleDataStoreHelper");
+ }
+ connectionPool.setClasspath(classpathFieldValue);
+ connectionPool.setUrl(urlFieldValue);
+ connectionPool.setUser(userFieldValue);
+ connectionPool.setPassword(passwordFieldValue);
+ connectionPool.setInitial(jdbcConnectionPoolInitialFieldNumber);
+ connectionPool.setMaximal(jdbcConnectionPoolMaximalFieldNumber);
+ connectionPool.setIncrement(jdbcConnectionPoolIncrementFieldNumber);
+ // add the application server object if needed
+ if (connectionPoolName == null) {
+ try {
+ parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(applicationServerName).addJDBCConnectionPool(connectionPool);
+ parent.getEnvironmentWindow().getChangeEvents().add("Add JDBC connection pool " + connectionPool.getName());
+ } catch (Exception e) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("connectionpool.exists"));
+ return;
+ }
+ }
+ // update the window definition
+ setTitle(Messages.getString("connectionpool") + " " + connectionPool.getName());
+ setId("connectionpoolwindow_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + applicationServerName + "_" + connectionPool.getName());
+ connectionPoolName = connectionPool.getName();
+ // change the updated flag
+ parent.getEnvironmentWindow().setUpdated(true);
+ // update the window
+ update();
+ // update the whole environment window
+ parent.getEnvironmentWindow().update();
+ }
+ };
+ // copy
+ private ActionListener copy = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ try {
+ KalumetConsoleApplication.getApplication().setCopyComponent(connectionPool.clone());
+ } catch (Exception e) {
+ return;
+ }
+ }
+ };
+ // paste
+ private ActionListener paste = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check if the copy is correct
+ Object copy = KalumetConsoleApplication.getApplication().getCopyComponent();
+ if (copy == null || !(copy instanceof JDBCConnectionPool)) {
+ return;
+ }
+ connectionPool = (JDBCConnectionPool) copy;
+ connectionPoolName = null;
+ // update the parent pane
+ parent.update();
+ // update the window
+ update();
+ }
+ };
+ // status
+ private ActionListener status = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ // check if some change has not yet been saved
+ if (getEnvironmentWindow().isUpdated()) {
+ KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironmentWindow().getEnvironmentName());
+ return;
+ }
+ // add a message into the log pane and the journal
+ KalumetConsoleApplication.getApplication().getLogPane().addInfo("JDBC connection pool " + connectionPoolName + " status check in progress...", parent.getEnvironmentWindow().getEnvironmentName());
+ parent.getEnvironmentWindow().getChangeEvents().add("JDBC connection pool " + connectionPoolName + " status check requested.");
+ // 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().addWarning(statusThread.message, parent.getEnvironmentWindow().getEnvironmentName());
+ } else {
+ KalumetConsoleApplication.getApplication().getLogPane().addInfo(statusThread.message, parent.getEnvironmentWindow().getEnvironmentName());
+ }
+ parent.getEnvironmentWindow().getChangeEvents().add(statusThread.message);
+ } else {
+ KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+ }
+ }
+ });
+ }
+ };
+ // 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().jeeResourcesUpdatePermission) {
+ 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;
+ }
+ // 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("JDBC connection pool " + connectionPoolName + " update in progress...", parent.getEnvironmentWindow().getEnvironmentName());
+ parent.getEnvironmentWindow().getChangeEvents().add("JDBC connection pool " + connectionPoolName + " update requested.");
+ // start the update thread
+ final UpdateThread updateThread = new UpdateThread();
+ 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.getEnvironmentWindow().getEnvironmentName());
+ parent.getEnvironmentWindow().getChangeEvents().add(updateThread.message);
+ } else {
+ KalumetConsoleApplication.getApplication().getLogPane().addConfirm("JDBC connection pool " + connectionPoolName + " updated.", parent.getEnvironmentWindow().getEnvironmentName());
+ parent.getEnvironmentWindow().getChangeEvents().add("JDBC connection pool " + connectionPoolName + " updated.");
+ }
+ } else {
+ KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+ }
+ }
+ });
+ }
+ }));
+ }
+ };
+
+ /**
+ * Create a new <code>ConnectionPoolWindow</code>.
+ *
+ * @param parent the <code>ConnectionPoolsPane</code>.
+ * @param applicationServerName the original J2EE application server name.
+ * @param connectionPoolName the original JDBC connection pool name.
+ */
+ public ConnectionPoolWindow(ConnectionPoolsPane parent, String applicationServerName, String connectionPoolName) {
+ super();
+
+ // update the parent tab pane
+ this.parent = parent;
+
+ // update the connection pool name
+ this.connectionPoolName = connectionPoolName;
+ this.applicationServerName = applicationServerName;
+
+ // update the connection pool object from the parent environment
+ this.connectionPool = parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(this.applicationServerName).getJDBCConnectionPool(connectionPoolName);
+ if (this.connectionPool == null) {
+ this.connectionPool = new JDBCConnectionPool();
+ }
+
+ if (this.connectionPoolName == null) {
+ setTitle(Messages.getString("connectionpool"));
+ } else {
+ setTitle(Messages.getString("connectionpool") + " " + this.connectionPoolName);
+ }
+ setId("connectionpoolwindow_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + this.applicationServerName + "_" + this.connectionPoolName);
+ setStyleName("default");
+ setWidth(new Extent(600, Extent.PX));
+ setHeight(new Extent(400, Extent.PX));
+ setModal(false);
+ setDefaultCloseOperation(WindowPane.DISPOSE_ON_CLOSE);
+
+ // create a split pane for the control button
+ 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 copy button
+ Button copyButton = new Button(Messages.getString("copy"), Styles.PAGE_COPY);
+ copyButton.setStyleName("control");
+ copyButton.addActionListener(copy);
+ controlRow.add(copyButton);
+ if (getEnvironmentWindow().adminPermission
+ || getEnvironmentWindow().jeeResourcesPermission) {
+ // 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 apply button
+ Button applyButton = new Button(Messages.getString("apply"), Styles.ACCEPT);
+ applyButton.setStyleName("control");
+ applyButton.addActionListener(apply);
+ controlRow.add(applyButton);
+ }
+ // add the status button
+ Button statusButton = new Button(Messages.getString("status"), Styles.INFORMATION);
+ statusButton.setStyleName("control");
+ statusButton.addActionListener(status);
+ controlRow.add(statusButton);
+ if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesUpdatePermission) {
+ // add the update button
+ Button updateButton = new Button(Messages.getString("update"), Styles.COG);
+ updateButton.setStyleName("control");
+ updateButton.addActionListener(update);
+ controlRow.add(updateButton);
+ }
+ if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+ // add the delete button
+ Button deleteButton = new Button(Messages.getString("delete"), Styles.DELETE);
+ deleteButton.setStyleName("control");
+ deleteButton.addActionListener(delete);
+ controlRow.add(deleteButton);
+ }
+ // 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"));
+ generalPane = new ConnectionPoolGeneralPane(this);
+ generalPane.setLayoutData(tabLayoutData);
+ tabPane.add(generalPane);
+
+ // add the driver tab
+ tabLayoutData = new TabPaneLayoutData();
+ tabLayoutData.setTitle(Messages.getString("driver"));
+ driverPane = new ConnectionPoolDriverPane(this);
+ driverPane.setLayoutData(tabLayoutData);
+ tabPane.add(driverPane);
+
+ // add the database tab
+ tabLayoutData = new TabPaneLayoutData();
+ tabLayoutData.setTitle(Messages.getString("database"));
+ databasePane = new ConnectionPoolDatabasePane(this);
+ databasePane.setLayoutData(tabLayoutData);
+ tabPane.add(databasePane);
+
+ // add the capacity tab
+ tabLayoutData = new TabPaneLayoutData();
+ tabLayoutData.setTitle(Messages.getString("capacity"));
+ capacityPane = new ConnectionPoolCapacityPane(this);
+ capacityPane.setLayoutData(tabLayoutData);
+ tabPane.add(capacityPane);
+
+ // update the window
+ update();
+ }
+
+ /**
+ * Update the pane.
+ */
+ public void update() {
+ generalPane.update();
+ driverPane.update();
+ databasePane.update();
+ capacityPane.update();
+ }
+
+ public JDBCConnectionPool getConnectionPool() {
+ return this.connectionPool;
+ }
+
+ public String getConnectionPoolName() {
+ return this.connectionPoolName;
+ }
+
+ public EnvironmentWindow getEnvironmentWindow() {
+ return parent.getEnvironmentWindow();
+ }
+
+}
\ No newline at end of file