You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jl...@apache.org on 2007/06/22 01:18:41 UTC
svn commit: r549644 [6/8] - in /geronimo/sandbox/geronimo-netbeans-plugin:
./ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/geronimo/
src/main/java/org/apache/geronimo/netbeans/ src/main/java/org/ap...
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,422 @@
+package org.apache.geronimo.netbeans.ide.ui;
+
+import java.awt.GridBagConstraints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.io.File;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.openide.util.NbBundle;
+
+public class AddServerPropertiesVisualPanel extends JPanel {
+
+ private final Set listeners = new HashSet();
+
+ private javax.swing.JLabel label1;
+ private javax.swing.JPanel panel1;
+ private javax.swing.JLabel hostLabel;
+ private javax.swing.JTextField hostField;
+ private javax.swing.JLabel portLabel;
+ private javax.swing.JTextField portField;
+ private javax.swing.JLabel userLabel;
+ private javax.swing.JTextField userField;
+ private javax.swing.JLabel passwordLabel;
+ private javax.swing.JPasswordField passwordField;
+ private javax.swing.JComboBox serverType; // Local or Remote
+
+ /** Creates a new instance of AddServerPropertiesVisualPanel */
+ public AddServerPropertiesVisualPanel() {
+ init();
+ setName(NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "TITLE_ServerProperties")); // NOI18N
+ }
+
+ public void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+
+ public void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+
+ public void installLocationChanged() {
+ // TODO
+ }
+
+ private void somethingChanged() {
+ fireChangeEvent();
+ }
+
+ private void fireChangeEvent() {
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ ((ChangeListener) it.next()).stateChanged(ev);
+ }
+ }
+
+ public boolean isLocalServer() {
+ if (serverType.getSelectedItem().equals("Local"))
+ return true;
+ else
+ return false;
+ }
+
+ public String getHost() {
+ return hostField.getText().trim();
+ }
+
+ public String getPort() {
+ return portField.getText().trim();
+ }
+
+ public String getUser() {
+ return userField.getText();
+ }
+
+ public String getPassword() {
+ return new String(passwordField.getPassword());
+ }
+
+ private void serverTypeChanged() {
+
+ if (serverType.getSelectedItem().equals("Local")) { // NOI18N
+ hostField.setEditable(false);
+ } else { // REMOTE
+ hostField.setEditable(true);
+ portField.setEditable(true);
+ }
+
+ somethingChanged();
+ }
+
+ private void init() {
+
+ // Object[] domainsList =
+ // WLPluginUtils.getRegisteredDomains().keySet().toArray(new
+ // String[WLPluginUtils.getRegisteredDomains().keySet().size()]);
+
+ java.awt.GridBagConstraints gridBagConstraints;
+
+ label1 = new JLabel(NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "TXT_PROPERTY_TEXT")); // NOI18N
+
+ serverType = new JComboBox(new String[] { "Local", "Remote" });// NOI18N
+ serverType.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ serverTypeChanged();
+ }
+ });
+
+ panel1 = new JPanel();
+
+ // Domain combobox
+ String serverLocation = GeronimoPluginProperties.getInstance().getInstallLocation();
+
+ hostLabel = new JLabel(NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_Host"));// NOI18N
+ hostField = new JTextField();
+ hostField.setColumns(20);
+ hostField.setEditable(false);
+ hostField.getAccessibleContext().setAccessibleDescription(
+ NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_Host"));
+ hostField.getAccessibleContext().setAccessibleName(
+ NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_Host"));
+ hostField.addKeyListener(new SomeChangesListener());
+
+ hostLabel.setLabelFor(hostField);
+
+ portLabel = new JLabel(NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_Port"));// NOI18N
+ portField = new JTextField();
+ portField.setColumns(20);
+ portField.getAccessibleContext().setAccessibleDescription(
+ NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_Port"));
+ portField.getAccessibleContext().setAccessibleName(
+ NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_Port"));
+ // portField.setEditable(false);
+ portField.addKeyListener(new SomeChangesListener());
+
+ portLabel.setLabelFor(portField);
+
+ userLabel = new JLabel(NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_User"));// NOI18N
+ userField = new JTextField();
+ userField.addKeyListener(new SomeChangesListener());
+
+ passwordLabel = new JLabel(NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_Password"));// NOI18N
+ passwordField = new JPasswordField();
+ passwordField.addKeyListener(new SomeChangesListener());
+
+ setLayout(new java.awt.GridBagLayout());
+
+ setFocusable(false);
+
+ setMinimumSize(new java.awt.Dimension(280, 217));
+ // setNextFocusableComponent(domainPathField);
+
+ // -------------- some label --------------------
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridwidth = 3;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ add(label1, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+
+ add(serverType, gridBagConstraints);
+
+ // -------------- host ---------------
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ add(hostLabel, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ add(hostField, gridBagConstraints);
+
+ // -------------- port ---------------
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ add(portLabel, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 4;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ add(portField, gridBagConstraints);
+
+ // -------------- User ---------------
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ add(userLabel, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 5;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ add(userField, gridBagConstraints);
+
+ // -------------- Password ---------------
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ gridBagConstraints.anchor = GridBagConstraints.WEST;
+ add(passwordLabel, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridy = 6;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 5);
+ add(passwordField, gridBagConstraints);
+
+ // ------------- panell to fill out free space ------------------------
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridwidth = 3;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.weighty = 1.0;
+
+ portField.setEditable(false);
+
+ userField.setVisible(false);
+ userLabel.setVisible(false);
+ passwordField.setVisible(false);
+ passwordLabel.setVisible(false);
+
+ serverType.setVisible(false);
+
+ add(panel1, gridBagConstraints);
+
+ hostField.setText("localhost");// NOI18N
+ // portField.setText(GeronimoPluginUtils.getHTTPConnectorPort(domainPathField.getText()));//NOI18N
+ portField.setText("8080");// NOI18N
+ }
+
+ class SomeChangesListener implements KeyListener {
+
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ somethingChanged();
+ }
+
+ }
+
+ private String browseDomainLocation() {
+ String insLocation = null;
+ JFileChooser chooser = getJFileChooser();
+ int returnValue = chooser.showDialog(this, NbBundle.getMessage(AddServerPropertiesVisualPanel.class,
+ "LBL_ChooseButton")); // NOI18N
+
+ if (returnValue == JFileChooser.APPROVE_OPTION) {
+ insLocation = chooser.getSelectedFile().getAbsolutePath();
+ }
+ return insLocation;
+ }
+
+ private JFileChooser getJFileChooser() {
+ JFileChooser chooser = new JFileChooser();
+
+ chooser.setDialogTitle("LBL_Chooser_Name"); // NOI18N
+ chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
+
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ chooser.setApproveButtonMnemonic("Choose_Button_Mnemonic".charAt(0)); // NOI18N
+ chooser.setMultiSelectionEnabled(false);
+ chooser.addChoosableFileFilter(new dirFilter());
+ chooser.setAcceptAllFileFilterUsed(false);
+ chooser.setApproveButtonToolTipText("LBL_Chooser_Name"); // NOI18N
+
+ chooser.getAccessibleContext().setAccessibleName("LBL_Chooser_Name"); // NOI18N
+ chooser.getAccessibleContext().setAccessibleDescription("LBL_Chooser_Name"); // NOI18N
+
+ return chooser;
+ }
+
+ private static class dirFilter extends javax.swing.filechooser.FileFilter {
+
+ public boolean accept(File f) {
+ if (!f.exists() || !f.canRead() || !f.isDirectory()) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public String getDescription() {
+ return NbBundle.getMessage(AddServerPropertiesVisualPanel.class, "LBL_DirType"); // NOI18N
+ }
+
+ }
+
+}
+
+class DomainComboModel extends AbstractListModel implements ComboBoxModel {
+ private int current = -1;
+ private String[][] domains = null;
+
+ public void addDomain(String domain, String path) {
+ String[][] newDomains = new String[domains.length + 1][2];
+ int i = 0;
+ for (; i < domains.length; i++) {
+ newDomains[i][0] = domains[i][0];
+ newDomains[i][1] = domains[i][1];
+ }
+ newDomains[i][0] = domain;
+ newDomains[i][1] = path;
+ domains = newDomains;
+
+ }
+
+ public DomainComboModel(Hashtable domains) {
+ setDomains(domains);
+ }
+
+ public void setDomains(Hashtable domains) {
+
+ current = -1;
+ this.domains = null;
+
+ int len = domains.size();
+ this.domains = new String[len][2];
+ Enumeration en = domains.keys();
+
+ if (len > 0)
+ current = 0;
+
+ int i = 0;
+ while (en.hasMoreElements()) {
+ this.domains[i][0] = (String) en.nextElement();
+ this.domains[i][1] = (String) domains.get(this.domains[i][0]);
+ if (this.domains[i][0].equalsIgnoreCase("default")) // NOI18N
+ current = i;
+ i++;
+ }
+ }
+
+ public Object getSelectedItem() {
+ if (current == -1)
+ return "";
+ return domains[current][0];
+ }
+
+ public void setSelectedItem(Object anItem) {
+ for (int i = 0; i < getSize(); i++) {
+ if (domains[i][0].equals(anItem)) {
+ current = i;
+ fireContentsChanged(this, -1, -1);
+ return;
+ }
+ }
+ current = -1;
+ // currentVal = (String)anItem;
+ fireContentsChanged(this, -1, -1);
+ }
+
+ public Object getElementAt(int index) {
+ return domains[index][0];
+ }
+
+ public int getSize() {
+ return domains.length;
+ }
+
+ // ----------------------------------------------------
+
+ public String getCurrentPath() {
+ if (current == -1)
+ return "";
+ return domains[current][1];
+ }
+
+ public boolean hasDomain(String domain) {
+ for (int i = 0; i < getSize(); i++) {
+ if (domains[i][0].equals(domain)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/AddServerPropertiesVisualPanel.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,240 @@
+package org.apache.geronimo.netbeans.ide.ui;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.logging.Logger;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.apache.geronimo.netbeans.GeronimoDeploymentFactory;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.openide.DialogDisplayer;
+import org.openide.ErrorManager;
+import org.openide.NotifyDescriptor;
+import org.openide.WizardDescriptor;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.j2ee.deployment.impl.ui.wizard.AddServerInstanceWizard;
+
+public class GeronimoInstantiatingIterator implements WizardDescriptor.InstantiatingIterator, ChangeListener {
+
+ final static Logger logger = Logger.getLogger(GeronimoDeploymentFactory.class.toString());
+
+ /**
+ * skipServerLocationStep allow to skip Select Location step in New Instance Wizard if this step allready was passed
+ */
+ public final boolean skipServerLocationStep = false;
+
+ private transient AddServerLocationPanel locationPanel = null;
+ private transient AddServerPropertiesPanel propertiesPanel = null;
+
+ private WizardDescriptor wizard;
+ private transient int index = 0;
+ private transient WizardDescriptor.Panel[] panels = null;
+
+ // private InstallPanel panel;
+ private transient Set listeners = new HashSet(1);
+
+ public void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+
+ public void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+
+ public void uninitialize(WizardDescriptor wizard) {
+ }
+
+ public void initialize(WizardDescriptor wizard) {
+ this.wizard = wizard;
+ }
+
+ public void previousPanel() {
+ index--;
+ }
+
+ public void nextPanel() {
+ if (!hasNext())
+ throw new NoSuchElementException();
+ index++;
+ }
+
+ public String name() {
+ return "Apache Geronimo 2 AddInstanceIterator"; // NOI18N
+ }
+
+ public static void showInformation(final String msg, final String title) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ NotifyDescriptor d = new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE);
+ d.setTitle(title);
+ DialogDisplayer.getDefault().notify(d);
+ }
+ });
+
+ }
+
+ public Set instantiate() throws IOException {
+ logger.info("instantiate()");
+ Set result = new HashSet();
+
+ String displayName = (String) wizard.getProperty(AddServerInstanceWizard.PROP_DISPLAY_NAME);
+
+ String url = GeronimoDeploymentFactory.URI_PREFIX + host + ":" + port; // NOI18N
+ if (server != null && !server.equals("")) // NOI18N
+ url += "#" + server; // NOI18N
+ url += "&" + installLocation; // NOI18N
+
+ try {
+ InstanceProperties ip = InstanceProperties.createInstanceProperties(url, userName, password, displayName);
+ ip.setProperty(GeronimoPluginProperties.PROPERTY_SERVER, server);
+ ip.setProperty(GeronimoPluginProperties.PROPERTY_DEPLOY_DIR, deployDir);
+ ip.setProperty(GeronimoPluginProperties.PROPERTY_SERVER_DIR, installLocation);
+
+ ip.setProperty(GeronimoPluginProperties.PROPERTY_HOST, host);
+ ip.setProperty(GeronimoPluginProperties.PROPERTY_PORT, port);
+
+ result.add(ip);
+ } catch (InstanceCreationException e) {
+ showInformation(e.getLocalizedMessage(), NbBundle.getMessage(AddServerPropertiesVisualPanel.class,
+ "MSG_INSTANCE_REGISTRATION_FAILED"));
+ ErrorManager.getDefault().log(ErrorManager.EXCEPTION, e.getMessage());
+ }
+
+ return result;
+ }
+
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ public boolean hasNext() {
+ return index < getPanels().length - 1;
+ }
+
+ protected String[] createSteps() {
+ logger.info("createSteps");
+ if (!skipServerLocationStep) {
+ return new String[] { NbBundle.getMessage(GeronimoInstantiatingIterator.class, "STEP_ServerLocation"), // NOI18N
+ NbBundle.getMessage(GeronimoInstantiatingIterator.class, "STEP_Properties") }; // NOI18N
+ } else {
+ if (!GeronimoPluginProperties.getInstance().isCurrentServerLocationValid()) {
+ return new String[] { NbBundle.getMessage(GeronimoInstantiatingIterator.class, "STEP_ServerLocation"), // NOI18N
+ NbBundle.getMessage(GeronimoInstantiatingIterator.class, "STEP_Properties") }; // NOI18N
+ } else {
+ return new String[] { NbBundle.getMessage(GeronimoInstantiatingIterator.class, "STEP_Properties") }; // NOI18N
+ }
+ }
+ }
+
+ protected final String[] getSteps() {
+ if (steps == null) {
+ steps = createSteps();
+ }
+ return steps;
+ }
+
+ protected final WizardDescriptor.Panel[] getPanels() {
+ if (panels == null) {
+ panels = createPanels();
+ }
+ return panels;
+ }
+
+ protected WizardDescriptor.Panel[] createPanels() {
+ if (locationPanel == null) {
+ locationPanel = new AddServerLocationPanel(this);
+ locationPanel.addChangeListener(this);
+ }
+ if (propertiesPanel == null) {
+ propertiesPanel = new AddServerPropertiesPanel(this);
+ propertiesPanel.addChangeListener(this);
+ }
+
+ if (skipServerLocationStep) {
+ if (!GeronimoPluginProperties.getInstance().isCurrentServerLocationValid()) {
+ return new WizardDescriptor.Panel[] { locationPanel, propertiesPanel };
+ } else {
+ return new WizardDescriptor.Panel[] { propertiesPanel };
+ }
+ } else {
+ return new WizardDescriptor.Panel[] { locationPanel, propertiesPanel };
+ }
+ }
+
+ private transient String[] steps = null;
+
+ protected final int getIndex() {
+ return index;
+ }
+
+ public WizardDescriptor.Panel current() {
+ WizardDescriptor.Panel result = getPanels()[index];
+ JComponent component = (JComponent) result.getComponent();
+ component.putClientProperty("WizardPanel_contentData", getSteps()); // NOI18N
+ component.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(getIndex()));// NOI18N
+ return result;
+ }
+
+ public void stateChanged(javax.swing.event.ChangeEvent changeEvent) {
+ fireChangeEvent();
+ }
+
+ protected final void fireChangeEvent() {
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ ((ChangeListener) it.next()).stateChanged(ev);
+ }
+ }
+
+ private String host;
+ private String port;
+ private String userName = "";
+ private String password = "";
+ private String server;
+ private String installLocation;
+ private String deployDir;
+ private String serverPath;
+
+ public void setHost(String host) {
+ this.host = host.trim();
+ }
+
+ public void setPort(String port) {
+ this.port = port.trim();
+ }
+
+ public void setServer(String server) {
+ this.server = server;
+ }
+
+ public void setServerPath(String serverPath) {
+ this.serverPath = serverPath;
+ }
+
+ public void setDeployDir(String deployDir) {
+ this.deployDir = deployDir;
+ }
+
+ public void setInstallLocation(String installLocation) {
+ this.installLocation = installLocation;
+ propertiesPanel.installLocationChanged();
+ }
+
+ public String getInstallLocation() {
+ return this.installLocation;
+ }
+}
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoInstantiatingIterator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,149 @@
+package org.apache.geronimo.netbeans.ide.ui;
+
+import java.io.File;
+import java.util.Properties;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.Repository;
+import org.openide.ErrorManager;
+
+public class GeronimoPluginProperties {
+
+ // @TODO: Take a look at
+ // serverplugins/weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLPluginProperties.java
+ private static final boolean verboseRegistration = System.getProperty("netbeans.geronimo.registration") != null;
+
+ public static final String PROPERTY_DISPLAY_NAME = "displayName";// NOI18N
+ public static final String PROPERTY_SERVER = "server";// NOI18N
+ public static final String PROPERTY_DEPLOY_DIR = "deploy-dir";// NOI18N
+ public static final String PROPERTY_SERVER_DIR = "server-dir";// NOI18N
+ public static final String PROPERTY_HOST = "host";// NOI18N
+ public static final String PROPERTY_PORT = "port";// NOI18N
+
+ private static GeronimoPluginProperties pluginProperties = null;
+ private String installLocation;
+ private String domainLocation;
+
+ public static GeronimoPluginProperties getInstance() {
+ if (pluginProperties == null) {
+ pluginProperties = new GeronimoPluginProperties();
+ }
+ return pluginProperties;
+ }
+
+ /** Creates a new instance of */
+ private GeronimoPluginProperties() {
+ java.io.InputStream inStream = null;
+ try {
+ try {
+ propertiesFile = getPropertiesFile();
+ if (null != propertiesFile)
+ inStream = propertiesFile.getInputStream();
+ } catch (java.io.FileNotFoundException e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ } catch (java.io.IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ } finally {
+ loadPluginProperties(inStream);
+ if (null != inStream)
+ inStream.close();
+ }
+ } catch (java.io.IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+
+ }
+
+ void loadPluginProperties(java.io.InputStream inStream) {
+ Properties inProps = new Properties();
+ if (null != inStream)
+ try {
+ inProps.load(inStream);
+ } catch (java.io.IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+ String loc = inProps.getProperty(INSTALL_ROOT_KEY);
+ if (loc != null) {// try to get the default value
+ setInstallLocation(loc);
+ }
+ }
+
+ private static final String INSTALL_ROOT_KEY = "installRoot"; // NOI18N
+ public static final String INSTALL_ROOT_PROP_NAME = "com.sun.aas.installRoot"; // NOI18N
+
+ private FileObject propertiesFile = null;
+
+ private FileObject getPropertiesFile() throws java.io.IOException {
+ FileSystem fs = Repository.getDefault().getDefaultFileSystem();
+ FileObject dir = fs.findResource("J2EE");
+ FileObject retVal = null;
+ if (null != dir) {
+ retVal = dir.getFileObject("geronimo", "properties"); // NOI18N
+ if (null == retVal) {
+ retVal = dir.createData("geronimo", "properties"); // NOI18N
+ }
+ }
+ return retVal;
+ }
+
+ public void saveProperties() {
+ Properties outProp = new Properties();
+ String installRoot = getInstallLocation();
+ if (installRoot != null)
+ outProp.setProperty(INSTALL_ROOT_KEY, installRoot);
+
+ FileLock l = null;
+ java.io.OutputStream outStream = null;
+ try {
+ if (null != propertiesFile) {
+ try {
+ l = propertiesFile.lock();
+ outStream = propertiesFile.getOutputStream(l);
+ if (null != outStream)
+ outProp.store(outStream, "");
+ } catch (java.io.IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ } finally {
+ if (null != outStream)
+ outStream.close();
+ if (null != l)
+ l.releaseLock();
+ }
+ }
+ } catch (java.io.IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+ }
+
+ public boolean isCurrentServerLocationValid() {
+ if (getInstallLocation() != null)
+ return GeronimoPluginUtils.isGoodServerLocation(new File(getInstallLocation()));
+ else
+ return false;
+ }
+
+ public void setInstallLocation(String installLocation) {
+ if (installLocation.endsWith("/") || installLocation.endsWith("\\")) {
+ installLocation = installLocation.substring(0, installLocation.length() - 1);
+ }
+
+ this.installLocation = installLocation;
+ }
+
+ public String getInstallLocation() {
+ return this.installLocation;
+ }
+
+ public void setDomainLocation(String domainLocation) {
+ if (domainLocation.endsWith("/") || domainLocation.endsWith("\\")) {
+ domainLocation = domainLocation.substring(0, domainLocation.length() - 1);
+ }
+
+ this.domainLocation = domainLocation;
+ }
+
+ public String getDomainLocation() {
+ return domainLocation;
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginProperties.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,230 @@
+package org.apache.geronimo.netbeans.ide.ui;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.ServerSocket;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.openide.ErrorManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class GeronimoPluginUtils {
+
+ private static boolean isGoodInstanceLocation(File candidate, List<String> requirements) {
+ if (null == candidate || !candidate.exists() || !candidate.canRead() || !candidate.isDirectory()
+ || !hasRequiredChildren(candidate, requirements)) {
+ return false;
+ }
+ return true;
+ }
+
+ // --------------- checking for possible server directory -------------
+ private static List<String> serverRequirements = new LinkedList<String>();
+
+ static {
+ serverRequirements.add("bin");
+ serverRequirements.add("lib");
+ serverRequirements.add("repository");
+ serverRequirements.add("schema");
+ serverRequirements.add("var");
+ serverRequirements.add("bin/deployer.jar");
+ serverRequirements.add("bin/server.jar");
+ serverRequirements.add("lib/geronimo-kernel-2.0-M6.jar");
+ // used in GeronimoDeploymentFactory
+ serverRequirements
+ .add("repository/org/apache/geronimo/modules/geronimo-deploy-jsr88/2.0-M6/geronimo-deploy-jsr88-2.0-M6.jar");
+ }
+
+ private static boolean isGoodServerLocation(File candidate, List<String> requirements) {
+ if (null == candidate || !candidate.exists() || !candidate.canRead() || !candidate.isDirectory()
+ || !hasRequiredChildren(candidate, requirements)) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean isGoodServerLocation(File candidate) {
+ return isGoodServerLocation(candidate, serverRequirements);
+ }
+
+ private static boolean hasRequiredChildren(File candidate, List<String> requiredChildren) {
+ if (null == candidate)
+ return false;
+ String[] children = candidate.list();
+ if (null == children)
+ return false;
+ if (null == requiredChildren)
+ return true;
+ Iterator iter = requiredChildren.iterator();
+ while (iter.hasNext()) {
+ String next = (String) iter.next();
+ File test = new File(candidate.getPath() + File.separator + next);
+ if (!test.exists())
+ return false;
+ }
+ return true;
+ }
+
+ public static String getDeployDir(String installDir) {
+ // todo: get real deploy path
+ String result = "";
+ result = installDir + File.separator + "deploy"; // NOI18N
+ return result;
+ }
+
+ public static String getHTTPConnectorPort(String domainDir) {
+ String defaultPort = "8080";
+ String serverXml = domainDir; // FIXME
+
+ File serverXmlFile = new File(serverXml);
+ if (!serverXmlFile.exists()) {
+ return defaultPort;
+ }
+
+ InputStream inputStream = null;
+ Document document = null;
+ try {
+ inputStream = new FileInputStream(serverXmlFile);
+ document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
+
+ // get the root element
+ Element root = document.getDocumentElement();
+
+ NodeList children = root.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeName().equals("Service")) { // NOI18N
+ NodeList nl = child.getChildNodes();
+ for (int j = 0; j < nl.getLength(); j++) {
+ Node ch = nl.item(j);
+
+ if (ch.getNodeName().equals("Connector")) { // NOI18N
+ return ch.getAttributes().getNamedItem("port").getNodeValue();
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ // it is ok
+ // it optional functionality so we don't need to look at any
+ // exception
+ }
+
+ return defaultPort;
+ }
+
+ public static String getJnpPort(String domainDir) {
+ // FIXME
+ return "";
+ }
+
+ public static String getRMINamingServicePort(String domainDir) {
+
+ String serviceXml = domainDir; // FIXME
+ File xmlFile = new File(serviceXml);
+ if (!xmlFile.exists())
+ return "";
+
+ InputStream inputStream = null;
+ Document document = null;
+ try {
+ inputStream = new FileInputStream(xmlFile);
+ document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
+
+ // get the root element
+ Element root = document.getDocumentElement();
+
+ // get the child nodes
+ NodeList children = root.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeName().equals("mbean")) { // NOI18N
+ NodeList nl = child.getChildNodes();
+ if (!child.getAttributes().getNamedItem("name").getNodeValue().equals("geronimo:service=Naming")) // NOI18N
+ continue;
+ for (int j = 0; j < nl.getLength(); j++) {
+ Node ch = nl.item(j);
+
+ if (ch.getNodeName().equals("attribute")) { // NOI18N
+ if (!ch.getAttributes().getNamedItem("name").getNodeValue().equals("RmiPort")) // NOI18N
+ continue;
+ return ch.getFirstChild().getNodeValue();
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+ return "";
+ }
+
+ public static String getRMIInvokerPort(String domainDir) {
+
+ String serviceXml = domainDir; // FIXME
+ File xmlFile = new File(serviceXml);
+ if (!xmlFile.exists())
+ return "";
+
+ InputStream inputStream = null;
+ Document document = null;
+ try {
+ inputStream = new FileInputStream(xmlFile);
+ document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
+
+ // get the root element
+ Element root = document.getDocumentElement();
+
+ // get the child nodes
+ NodeList children = root.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeName().equals("mbean")) { // NOI18N
+ NodeList nl = child.getChildNodes();
+ if (!child.getAttributes().getNamedItem("name").getNodeValue().equals(
+ "geronimo:service=invoker,type=jrmp")) // NOI18N
+ continue;
+ for (int j = 0; j < nl.getLength(); j++) {
+ Node ch = nl.item(j);
+
+ if (ch.getNodeName().equals("attribute")) { // NOI18N
+ if (!ch.getAttributes().getNamedItem("name").getNodeValue().equals("RMIObjectPort")) // NOI18N
+ continue;
+ return ch.getFirstChild().getNodeValue();
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+ return "";
+ }
+
+ /** Return true if the specified port is free, false otherwise. */
+ public static boolean isPortFree(int port) {
+ ServerSocket soc = null;
+ try {
+ soc = new ServerSocket(port);
+ } catch (IOException ioe) {
+ return false;
+ } finally {
+ if (soc != null)
+ try {
+ soc.close();
+ } catch (IOException ex) {
+ } // noop
+ }
+
+ return true;
+ }
+
+}
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/ide/ui/GeronimoPluginUtils.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,54 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import javax.enterprise.deploy.shared.ModuleType;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+
+public class GeronimoApplicationsChildren extends Children.Keys<GeronimoItemNode> {
+
+ GeronimoApplicationsChildren(Lookup lookup) {
+ setKeys(new GeronimoItemNode[] { createEarApplicationsNode(lookup), createEjbModulesNode(lookup),
+ createWebApplicationsNode(lookup) });
+ }
+
+ protected void addNotify() {
+ }
+
+ protected void removeNotify() {
+ }
+
+ protected Node[] createNodes(GeronimoItemNode key) {
+ if (key instanceof AbstractNode) {
+ return new Node[] { (AbstractNode) key };
+ }
+
+ return null;
+ }
+
+ /*
+ * Creates an EAR Applications parent node
+ */
+ public static GeronimoItemNode createEarApplicationsNode(Lookup lookup) {
+ return new GeronimoItemNode(new GeronimoEarApplicationsChildren(lookup), NbBundle.getMessage(
+ GeronimoTargetNode.class, "LBL_EarApps"), ModuleType.EAR);
+ }
+
+ /*
+ * Creates an Web Applications parent node
+ */
+ public static GeronimoItemNode createWebApplicationsNode(Lookup lookup) {
+ return new GeronimoItemNode(new GeronimoWebApplicationsChildren(lookup), NbBundle.getMessage(
+ GeronimoTargetNode.class, "LBL_WebApps"), ModuleType.WAR);
+ }
+
+ /*
+ * Creates an EJB Modules parent node
+ */
+ public static GeronimoItemNode createEjbModulesNode(Lookup lookup) {
+ return new GeronimoItemNode(new GeronimoEjbModulesChildren(lookup), NbBundle.getMessage(
+ GeronimoTargetNode.class, "LBL_EjbModules"), ModuleType.EJB);
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoApplicationsChildren.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,36 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import java.awt.Image;
+import javax.enterprise.deploy.shared.ModuleType;
+import javax.swing.Action;
+import org.apache.geronimo.netbeans.nodes.actions.UndeployModuleAction;
+import org.apache.geronimo.netbeans.nodes.actions.UndeployModuleCookieImpl;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport.ServerIcon;
+import org.openide.nodes.AbstractNode;
+import org.openide.util.Lookup;
+import org.openide.util.actions.SystemAction;
+
+/**
+ * Node which describes enterprise application.
+ */
+public class GeronimoEarApplicationNode extends AbstractNode {
+
+ public GeronimoEarApplicationNode(String fileName, Lookup lookup) {
+ super(new GeronimoEarModulesChildren(lookup, fileName));
+ setDisplayName(fileName.substring(0, fileName.indexOf('.')));
+ getCookieSet().add(new UndeployModuleCookieImpl(fileName, ModuleType.EAR, lookup));
+ }
+
+ public Action[] getActions(boolean context) {
+ return new SystemAction[] { SystemAction.get(UndeployModuleAction.class) };
+ }
+
+ public Image getIcon(int type) {
+ return UISupport.getIcon(ServerIcon.EAR_ARCHIVE);
+ }
+
+ public Image getOpenedIcon(int type) {
+ return getIcon(type);
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,101 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.QueryExp;
+import org.apache.geronimo.netbeans.nodes.actions.Refreshable;
+import org.openide.ErrorManager;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.RequestProcessor;
+
+/**
+ * It describes children nodes of the EJB Modules node. Implements Refreshable interface and due to it can be refreshed
+ * via ResreshModulesAction.
+ */
+public class GeronimoEarApplicationsChildren extends Children.Keys implements Refreshable {
+
+ private Lookup lookup;
+ private Boolean remoteManagementSupported = null;
+
+ GeronimoEarApplicationsChildren(Lookup lookup) {
+ this.lookup = lookup;
+ }
+
+ public void updateKeys() {
+ setKeys(new Object[] { Util.WAIT_NODE });
+
+ RequestProcessor.getDefault().post(new Runnable() {
+ Vector keys = new Vector();
+
+ public void run() {
+ try {
+ ObjectName searchPattern;
+ String propertyName;
+ if (isRemoteManagementSupported()) {
+ searchPattern = new ObjectName("geronimo.management.local:j2eeType=J2EEApplication,*"); // NOI18N
+ propertyName = "name"; // NOI18N
+ } else {
+ searchPattern = new ObjectName("geronimo.j2ee:service=EARDeployment,*"); // NOI18N
+ propertyName = "url"; // NOI18N
+ }
+ Object server = Util.getRMIServer(lookup);
+ Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
+ new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
+ new Object[] { searchPattern, null });
+
+ Iterator it = managedObj.iterator();
+
+ while (it.hasNext()) {
+ try {
+ ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
+ String name = elem.getKeyProperty(propertyName);
+
+ name = name.substring(1, name.length() - 1);
+
+ keys.add(new GeronimoEarApplicationNode(name, lookup));
+ } catch (Exception ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+ } catch (Exception ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+
+ setKeys(keys);
+ }
+ }, 0);
+
+ }
+
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ protected void removeNotify() {
+ setKeys(java.util.Collections.EMPTY_SET);
+ }
+
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof GeronimoEarApplicationNode) {
+ return new Node[] { (GeronimoEarApplicationNode) key };
+ }
+
+ if (key instanceof String && key.equals(Util.WAIT_NODE)) {
+ return new Node[] { Util.createWaitNode() };
+ }
+
+ return null;
+ }
+
+ private boolean isRemoteManagementSupported() {
+ if (remoteManagementSupported == null) {
+ remoteManagementSupported = Util.isRemoteManagementSupported(lookup);
+ }
+ return remoteManagementSupported;
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,99 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.QueryExp;
+import org.apache.geronimo.netbeans.GeronimoDeploymentManager;
+import org.openide.ErrorManager;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.RequestProcessor;
+
+/**
+ * It describes children nodes of the enterprise application node.
+ */
+public class GeronimoEarModulesChildren extends Children.Keys {
+
+ private Lookup lookup;
+ private String j2eeAppName;
+
+ public GeronimoEarModulesChildren(Lookup lookup, String j2eeAppName) {
+ this.lookup = lookup;
+ this.j2eeAppName = j2eeAppName;
+ }
+
+ public void updateKeys() {
+ setKeys(new Object[] { Util.WAIT_NODE });
+
+ RequestProcessor.getDefault().post(new Runnable() {
+ Vector keys = new Vector();
+ GeronimoDeploymentManager dm = (GeronimoDeploymentManager) lookup.lookup(GeronimoDeploymentManager.class);
+
+ public void run() {
+ try {
+ Object server = Util.getRMIServer(lookup);
+ ObjectName searchPattern = new ObjectName("geronimo.management.local:J2EEApplication="
+ + j2eeAppName + ",*");
+ Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
+ new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
+ new Object[] { searchPattern, null });
+
+ Iterator it = managedObj.iterator();
+
+ // Query results processing
+ while (it.hasNext()) {
+ try {
+ ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
+ String name = elem.getKeyProperty("name");
+
+ if (elem.getKeyProperty("j2eeType").equals("EJBModule"))
+ keys.add(new GeronimoEjbModuleNode(name, lookup));
+ else if (elem.getKeyProperty("j2eeType").equals("WebModule")) {
+ String url = "http://" + dm.getHost() + ":" + dm.getPort();
+ String context = Util.getWebContextRoot((String) Util.getMBeanParameter(dm,
+ "geronimoWebDeploymentDescriptor", elem.getCanonicalName()));
+ keys.add(new GeronimoWebModuleNode(name, lookup, (context == null) ? null : url
+ + context));
+ }
+ } catch (Exception ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+ } catch (Exception ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+
+ setKeys(keys);
+ }
+ }, 0);
+
+ }
+
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ protected void removeNotify() {
+ setKeys(java.util.Collections.EMPTY_SET);
+ }
+
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof GeronimoEjbModuleNode) {
+ return new Node[] { (GeronimoEjbModuleNode) key };
+ }
+
+ if (key instanceof GeronimoWebModuleNode) {
+ return new Node[] { (GeronimoWebModuleNode) key };
+ }
+
+ if (key instanceof String && key.equals(Util.WAIT_NODE)) {
+ return new Node[] { Util.createWaitNode() };
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,48 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import java.awt.Image;
+import javax.enterprise.deploy.shared.ModuleType;
+import javax.swing.Action;
+import org.apache.geronimo.netbeans.nodes.actions.UndeployModuleAction;
+import org.apache.geronimo.netbeans.nodes.actions.UndeployModuleCookieImpl;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport.ServerIcon;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.util.Lookup;
+import org.openide.util.actions.SystemAction;
+
+/**
+ * Node which describes Web Module.
+ */
+public class GeronimoEjbModuleNode extends AbstractNode {
+
+ public GeronimoEjbModuleNode(String fileName, Lookup lookup) {
+ this(fileName, lookup, false);
+ }
+
+ public GeronimoEjbModuleNode(String fileName, Lookup lookup, boolean isEJB3) {
+ super(Children.LEAF);
+ setDisplayName(fileName.substring(0, fileName.indexOf('.')));
+ if (isEJB3) {
+ getCookieSet().add(new UndeployModuleCookieImpl(fileName, lookup));
+ } else {
+ getCookieSet().add(new UndeployModuleCookieImpl(fileName, ModuleType.EJB, lookup));
+ }
+ }
+
+ public Action[] getActions(boolean context) {
+ if (getParentNode() instanceof GeronimoEarApplicationNode)
+ return new SystemAction[] {};
+ else
+ return new SystemAction[] { SystemAction.get(UndeployModuleAction.class) };
+ }
+
+ public Image getIcon(int type) {
+ return UISupport.getIcon(ServerIcon.EJB_ARCHIVE);
+ }
+
+ public Image getOpenedIcon(int type) {
+ return getIcon(type);
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,127 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.QueryExp;
+import org.apache.geronimo.netbeans.nodes.actions.Refreshable;
+import org.openide.ErrorManager;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.RequestProcessor;
+
+/**
+ * It describes children nodes of the EJB Modules node. Implements Refreshable interface and due to it can be refreshed
+ * via ResreshModulesAction.
+ */
+public class GeronimoEjbModulesChildren extends Children.Keys implements Refreshable {
+
+ private Lookup lookup;
+ private Boolean remoteManagementSupported = null;
+
+ public GeronimoEjbModulesChildren(Lookup lookup) {
+ this.lookup = lookup;
+ }
+
+ public void updateKeys() {
+ setKeys(new Object[] { Util.WAIT_NODE });
+
+ RequestProcessor.getDefault().post(new Runnable() {
+ public void run() {
+ List keys = new LinkedList();
+ Object server = Util.getRMIServer(lookup);
+ addEjbModules(server, keys);
+ addEJB3Modules(server, keys);
+
+ setKeys(keys);
+ }
+ }, 0);
+
+ }
+
+ private void addEjbModules(Object server, List keys) {
+
+ try {
+ String propertyName;
+ Object searchPattern;
+ if (isRemoteManagementSupported()) {
+ propertyName = "name"; // NOI18N
+ searchPattern = new ObjectName("geronimo.management.local:j2eeType=EJBModule,J2EEApplication=null,*"); // NOI18N
+ } else {
+ propertyName = "module"; // NOI18N
+ searchPattern = new ObjectName("geronimo.j2ee:service=EjbModule,*"); // NOI18N
+ }
+ Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
+ new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
+ new Object[] { searchPattern, null }); // NOI18N
+
+ Iterator it = managedObj.iterator();
+
+ // Query results processing
+ while (it.hasNext()) {
+ ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
+ String name = elem.getKeyProperty(propertyName);
+ keys.add(new GeronimoEjbModuleNode(name, lookup));
+ }
+
+ } catch (Exception ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+
+ private void addEJB3Modules(Object server, List keys) {
+
+ try {
+ ObjectName searchPattern = new ObjectName("geronimo.j2ee:service=EJB3,*"); // NOI18N
+ Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
+ new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
+ new Object[] { searchPattern, null }); // NOI18N
+
+ Iterator it = managedObj.iterator();
+
+ // Query results processing
+ while (it.hasNext()) {
+ try {
+ ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
+ String name = elem.getKeyProperty("module"); // NOI18N
+ keys.add(new GeronimoEjbModuleNode(name, lookup, true));
+ } catch (Exception ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+ } catch (Exception ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ protected void removeNotify() {
+ setKeys(java.util.Collections.EMPTY_SET);
+ }
+
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof GeronimoEjbModuleNode) {
+ return new Node[] { (GeronimoEjbModuleNode) key };
+ }
+
+ if (key instanceof String && key.equals(Util.WAIT_NODE)) {
+ return new Node[] { Util.createWaitNode() };
+ }
+
+ return null;
+ }
+
+ private boolean isRemoteManagementSupported() {
+ if (remoteManagementSupported == null) {
+ remoteManagementSupported = Util.isRemoteManagementSupported(lookup);
+ }
+ return remoteManagementSupported;
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,85 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import java.awt.Image;
+import javax.enterprise.deploy.shared.ModuleType;
+import org.apache.geronimo.netbeans.nodes.actions.RefreshModulesAction;
+import org.apache.geronimo.netbeans.nodes.actions.RefreshModulesCookie;
+import org.apache.geronimo.netbeans.nodes.actions.Refreshable;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport.ServerIcon;
+import org.openide.filesystems.Repository;
+import org.openide.loaders.DataFolder;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.actions.SystemAction;
+
+/**
+ * Default Node which can have refresh action enabled and which has deafault icon.
+ */
+public class GeronimoItemNode extends AbstractNode {
+
+ private ModuleType moduleType;
+
+ public GeronimoItemNode(Children children, String name) {
+ super(children);
+ setDisplayName(name);
+ if (getChildren() instanceof Refreshable)
+ getCookieSet().add(new RefreshModulesCookieImpl((Refreshable) getChildren()));
+ }
+
+ public GeronimoItemNode(Children children, String name, ModuleType moduleType) {
+ this(children, name);
+ this.moduleType = moduleType;
+ }
+
+ public Image getIcon(int type) {
+ if (ModuleType.WAR.equals(moduleType)) {
+ return UISupport.getIcon(ServerIcon.WAR_FOLDER);
+ } else if (ModuleType.EAR.equals(moduleType)) {
+ return UISupport.getIcon(ServerIcon.EAR_FOLDER);
+ } else if (ModuleType.EJB.equals(moduleType)) {
+ return UISupport.getIcon(ServerIcon.EJB_FOLDER);
+ } else {
+ return getIconDelegate().getIcon(type);
+ }
+ }
+
+ public Image getOpenedIcon(int type) {
+ if (ModuleType.WAR.equals(moduleType)) {
+ return UISupport.getIcon(ServerIcon.WAR_OPENED_FOLDER);
+ } else if (ModuleType.EAR.equals(moduleType)) {
+ return UISupport.getIcon(ServerIcon.EAR_OPENED_FOLDER);
+ } else if (ModuleType.EJB.equals(moduleType)) {
+ return UISupport.getIcon(ServerIcon.EJB_OPENED_FOLDER);
+ } else {
+ return getIconDelegate().getOpenedIcon(type);
+ }
+ }
+
+ private Node getIconDelegate() {
+ return DataFolder.findFolder(Repository.getDefault().getDefaultFileSystem().getRoot()).getNodeDelegate();
+ }
+
+ public javax.swing.Action[] getActions(boolean context) {
+ if (getChildren() instanceof Refreshable)
+ return new SystemAction[] { SystemAction.get(RefreshModulesAction.class) };
+
+ return new SystemAction[] {};
+ }
+
+ /**
+ * Implementation of the RefreshModulesCookie
+ */
+ private static class RefreshModulesCookieImpl implements RefreshModulesCookie {
+ Refreshable children;
+
+ public RefreshModulesCookieImpl(Refreshable children) {
+ this.children = children;
+ }
+
+ public void refresh() {
+ children.updateKeys();
+ }
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoItemNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,166 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import java.awt.Component;
+import java.awt.Image;
+import java.beans.BeanInfo;
+
+import org.apache.geronimo.netbeans.GeronimoDeploymentManager;
+import org.apache.geronimo.netbeans.customizer.Customizer;
+import org.apache.geronimo.netbeans.customizer.CustomizerDataSupport;
+import org.apache.geronimo.netbeans.ide.GeronimoJ2eePlatformFactory;
+import org.apache.geronimo.netbeans.ide.ui.GeronimoPluginProperties;
+import org.apache.geronimo.netbeans.nodes.actions.OpenServerLogAction;
+import org.apache.geronimo.netbeans.nodes.actions.ShowAdminToolAction;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.nodes.PropertySupport;
+import org.openide.nodes.Sheet;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.openide.util.actions.SystemAction;
+
+public class GeronimoManagerNode extends AbstractNode implements Node.Cookie {
+
+ private Lookup lookup;
+
+ private static final String ADMIN_URL = "/console/";
+ private static final String HTTP_HEADER = "http://";
+
+ public GeronimoManagerNode(Children children, Lookup lookup) {
+ super(children);
+ this.lookup = lookup;
+ getCookieSet().add(this);
+ }
+
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return new org.openide.util.HelpCtx("j2eeplugins_property_sheet_server_node_geronimo"); // NOI18N
+ }
+
+ public boolean hasCustomizer() {
+ return true;
+ }
+
+ public Component getCustomizer() {
+ CustomizerDataSupport dataSup = new CustomizerDataSupport(getDeploymentManager().getProperties());
+ return new Customizer(dataSup, new GeronimoJ2eePlatformFactory().getJ2eePlatformImpl(getDeploymentManager()));
+ }
+
+ public String getAdminURL() {
+ return HTTP_HEADER + getDeploymentManager().getHost() + ":" + getDeploymentManager().getPort() + ADMIN_URL;
+ }
+
+ public javax.swing.Action[] getActions(boolean context) {
+ javax.swing.Action[] actions = new javax.swing.Action[] { null, SystemAction.get(ShowAdminToolAction.class),
+ SystemAction.get(OpenServerLogAction.class) };
+ return actions;
+ }
+
+ public Sheet createSheet() {
+ Sheet sheet = super.createSheet();
+ Sheet.Set properties = sheet.get(Sheet.PROPERTIES);
+ if (properties == null) {
+ properties = Sheet.createPropertiesSet();
+ sheet.put(properties);
+ }
+ final InstanceProperties ip = getDeploymentManager().getInstanceProperties();
+
+ Node.Property property = null;
+
+ // DISPLAY NAME
+
+ // DISPLAY NAME
+ property = new PropertySupport.ReadWrite(NbBundle.getMessage(GeronimoManagerNode.class, "LBL_DISPLAY_NAME"), // NOI18N
+ String.class, NbBundle.getMessage(GeronimoManagerNode.class, "LBL_DISPLAY_NAME"), // NOI18N
+ NbBundle.getMessage(GeronimoManagerNode.class, "HINT_DISPLAY_NAME") // NOI18N
+ ) {
+ public Object getValue() {
+ return ip.getProperty(GeronimoPluginProperties.PROPERTY_DISPLAY_NAME);
+ }
+
+ public void setValue(Object val) {
+ ip.setProperty(GeronimoPluginProperties.PROPERTY_DISPLAY_NAME, (String) val);
+ }
+ };
+
+ properties.put(property);
+
+ // servewr name
+
+ // servewr name
+ property = new PropertySupport.ReadOnly(NbBundle.getMessage(GeronimoManagerNode.class, "LBL_SERVER_NAME"), // NOI18N
+ String.class, NbBundle.getMessage(GeronimoManagerNode.class, "LBL_SERVER_NAME"), // NOI18N
+ NbBundle.getMessage(GeronimoManagerNode.class, "HINT_SERVER_NAME") // NOI18N
+ ) {
+ public Object getValue() {
+ return ip.getProperty(GeronimoPluginProperties.PROPERTY_SERVER);
+ }
+ };
+ properties.put(property);
+
+ // server location
+
+ // server location
+ property = new PropertySupport.ReadOnly(NbBundle.getMessage(GeronimoManagerNode.class, "LBL_SERVER_PATH"), // NOI18N
+ String.class, NbBundle.getMessage(GeronimoManagerNode.class, "LBL_SERVER_PATH"), // NOI18N
+ NbBundle.getMessage(GeronimoManagerNode.class, "HINT_SERVER_PATH") // NOI18N
+ ) {
+ public Object getValue() {
+ return ip.getProperty(GeronimoPluginProperties.PROPERTY_SERVER_DIR);
+ }
+ };
+ properties.put(property);
+
+ // host
+
+ // host
+ property = new PropertySupport.ReadOnly(NbBundle.getMessage(GeronimoManagerNode.class, "LBL_HOST"), // NOI18N
+ String.class, NbBundle.getMessage(GeronimoManagerNode.class, "LBL_HOST"), // NOI18N
+ NbBundle.getMessage(GeronimoManagerNode.class, "HINT_HOST") // NOI18N
+ ) {
+ public Object getValue() {
+ return ip.getProperty(GeronimoPluginProperties.PROPERTY_HOST);
+ }
+ };
+ properties.put(property);
+
+ // port
+
+ // port
+ property = new PropertySupport.ReadOnly(NbBundle.getMessage(GeronimoManagerNode.class, "LBL_PORT"), // NOI18N
+ Integer.TYPE, NbBundle.getMessage(GeronimoManagerNode.class, "LBL_PORT"), // NOI18N
+ NbBundle.getMessage(GeronimoManagerNode.class, "HINT_PORT") // NOI18N
+ ) {
+ public Object getValue() {
+ return new Integer(ip.getProperty(GeronimoPluginProperties.PROPERTY_PORT));
+ }
+ };
+ properties.put(property);
+
+ return sheet;
+ }
+
+ public Image getIcon(int type) {
+ if (type == BeanInfo.ICON_COLOR_16x16) {
+ return Utilities.loadImage("org/apache/geronimo/netbeans/resources/16x16.gif");
+ }
+ return super.getIcon(type);
+ }
+
+ public Image getOpenedIcon(int type) {
+ return getIcon(type);
+ }
+
+ public String getShortDescription() {
+ InstanceProperties ip = InstanceProperties.getInstanceProperties(getDeploymentManager().getUrl());
+ String host = ip.getProperty(GeronimoPluginProperties.PROPERTY_HOST);
+ String port = ip.getProperty(GeronimoPluginProperties.PROPERTY_PORT);
+ return HTTP_HEADER + host + ":" + port + "/"; // NOI18N
+ }
+
+ public GeronimoDeploymentManager getDeploymentManager() {
+ return ((GeronimoDeploymentManager) lookup.lookup(GeronimoDeploymentManager.class));
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoManagerNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,18 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import org.netbeans.modules.j2ee.deployment.plugins.spi.RegistryNodeFactory;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+
+public class GeronimoRegistryNodeFactory implements RegistryNodeFactory {
+
+ public Node getTargetNode(Lookup lookup) {
+ return new GeronimoTargetNode(lookup);
+ }
+
+ public Node getManagerNode(Lookup lookup) {
+ return new GeronimoManagerNode(new Children.Map(), lookup);
+ }
+
+}
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoRegistryNodeFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java?view=auto&rev=549644
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java (added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java Thu Jun 21 16:18:31 2007
@@ -0,0 +1,18 @@
+package org.apache.geronimo.netbeans.nodes;
+
+import javax.swing.Action;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.util.actions.SystemAction;
+
+public class GeronimoServletNode extends AbstractNode {
+ public GeronimoServletNode(String name) {
+ super(Children.LEAF);
+ setDisplayName(name);
+ setIconBaseWithExtension("org/apache/geronimo/netbeans/resources/Object.gif"); // NOI18N
+ }
+
+ public Action[] getActions(boolean context) {
+ return new SystemAction[] {};
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain