geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r429789 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ org.apache.geronimo.st.ui/ org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/ org.apache.geronimo.st.ui/src/org...
Date Tue, 08 Aug 2006 19:30:17 GMT
Author: sppatel
Date: Tue Aug  8 12:30:17 2006
New Revision: 429789

URL: http://svn.apache.org/viewvc?rev=429789&view=rev
Log:
GERONIMODEVTOOLS-69 fix can't specifiy remote servers, move away from genericserverwizardfragment
and provide own impl

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServer.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/Activator.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServer.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServer.java?rev=429789&r1=429788&r2=429789&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServer.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServer.java
Tue Aug  8 12:30:17 2006
@@ -17,29 +17,31 @@
 
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 
+import org.apache.geronimo.st.core.internal.Trace;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jst.server.core.IWebModule;
 import org.eclipse.jst.server.generic.core.internal.GenericServer;
-import org.eclipse.jst.server.generic.core.internal.Trace;
 import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.ServerPort;
 import org.eclipse.wst.server.core.internal.ServerMonitorManager;
 
-public abstract class GenericGeronimoServer extends GenericServer implements
-		IGeronimoServer {
+public abstract class GenericGeronimoServer extends GenericServer implements IGeronimoServer
{
 
 	public static final String PROPERTY_ADMIN_ID = "adminID";
 
 	public static final String PROPERTY_ADMIN_PW = "adminPassword";
 
-	public static final String PROPERTY_RMI_PORT = "rmiport";
+	public static final String PROPERTY_RMI_PORT = "RMIRegistry";
 
-	public static final String PROPERTY_HTTP_PORT = "port";
+	public static final String PROPERTY_HTTP_PORT = "WebConnector";
 
 	public static final String PROPERTY_LOG_LEVEL = "logLevel";
 
@@ -49,6 +51,13 @@
 
 	public abstract String getContextRoot(IModule module);
 
+	public ServerPort[] getServerPorts() {
+		List ports = new ArrayList();
+		ports.add(new ServerPort(PROPERTY_HTTP_PORT, "Web Connector",  Integer.parseInt(getHTTPPort()),
"http"));
+		ports.add(new ServerPort(PROPERTY_RMI_PORT, "RMI Naming", Integer.parseInt(getRMINamingPort()),
"rmi"));
+		return (ServerPort[]) ports.toArray(new ServerPort[ports.size()]);
+	}
+
 	public URL getModuleRootURL(IModule module) {
 		try {
 			if (module == null
@@ -74,30 +83,30 @@
 
 			return new URL(url);
 		} catch (Exception e) {
-			Trace.trace("Could not get root URL", e);
+			Trace.trace(Trace.SEVERE, "Could not get root URL", e);
 			return null;
 		}
 
 	}
 
 	public String getAdminID() {
-		return (String) getServerInstanceProperties().get(PROPERTY_ADMIN_ID);
+		return getInstanceProperty(PROPERTY_ADMIN_ID);
 	}
 
 	public String getAdminPassword() {
-		return (String) getServerInstanceProperties().get(PROPERTY_ADMIN_PW);
+		return getInstanceProperty(PROPERTY_ADMIN_PW);
 	}
 
 	public String getRMINamingPort() {
-		return (String) getServerInstanceProperties().get(PROPERTY_RMI_PORT);
+		return getInstanceProperty(PROPERTY_RMI_PORT);
 	}
 
 	public String getHTTPPort() {
-		return (String) getServerInstanceProperties().get(PROPERTY_HTTP_PORT);
+		return getInstanceProperty(PROPERTY_HTTP_PORT);
 	}
 
 	public String getConsoleLogLevel() {
-		return (String) getServerInstanceProperties().get(PROPERTY_LOG_LEVEL);
+		return getInstanceProperty(PROPERTY_LOG_LEVEL);
 	}
 
 	public void setAdminID(String value) {
@@ -131,15 +140,25 @@
 		}
 		return null;
 	}
-	
-	/* (non-Javadoc)
+
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.eclipse.jst.server.generic.core.internal.GenericServer#setDefaults(org.eclipse.core.runtime.IProgressMonitor)
 	 */
 	public void setDefaults(IProgressMonitor monitor) {
+		setAdminID("system");
+		setAdminPassword("manager");
+		setHTTPPort("8080");
+		setRMINamingPort("1099");
 		setConsoleLogLevel(CONSOLE_INFO);
 	}
-	
-	private void setInstanceProperty(String name, String value) {
+
+	public String getInstanceProperty(String name) {
+		return (String) getServerInstanceProperties().get(name);
+	}
+
+	public void setInstanceProperty(String name, String value) {
 		Map map = getServerInstanceProperties();
 		map.put(name, value);
 		setServerInstanceProperties(map);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml?rev=429789&r1=429788&r2=429789&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml Tue
Aug  8 12:30:17 2006
@@ -32,13 +32,13 @@
             class="org.apache.geronimo.st.ui.internal.GeronimoServerRuntimeWizardFragment"/>
         <fragment id="org.eclipse.jst.server.generic.server"
             typeIds="org.apache.geronimo.generic.server.10"
-            class="org.eclipse.jst.server.generic.ui.internal.GenericServerWizardFragment"/>
+            class="org.apache.geronimo.st.ui.internal.GeronimoServerWizardFragment"/>
         <fragment id="org.eclipse.jst.server.generic.runtime"
             typeIds="org.apache.geronimo.generic.runtime.11"
             class="org.apache.geronimo.st.ui.internal.GeronimoServerRuntimeWizardFragment"/>
         <fragment id="org.eclipse.jst.server.generic.server"
             typeIds="org.apache.geronimo.generic.server.11"
-            class="org.eclipse.jst.server.generic.ui.internal.GenericServerWizardFragment"/>
+            class="org.apache.geronimo.st.ui.internal.GeronimoServerWizardFragment"/>
     </extension>
 
 	<extension point="org.eclipse.ui.popupMenus">

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/Activator.java?rev=429789&r1=429788&r2=429789&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/Activator.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/Activator.java
Tue Aug  8 12:30:17 2006
@@ -31,6 +31,7 @@
 
 	public static final String ICONS_DIRECTORY = "icons/";
 	public static final String IMG_WIZ_GERONIMO = "gServer";
+	public static final String IMG_PORT = "port";
 
 	/**
 	 * The constructor
@@ -113,6 +114,7 @@
 	 */
 	protected void initializeImageRegistry(ImageRegistry reg) {
 		registerImage(reg, IMG_WIZ_GERONIMO, "g_server.gif");
+		registerImage(reg, IMG_PORT, "obj16/port.gif");
 	}
 
 	private void registerImage(ImageRegistry registry, String key,

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java?rev=429789&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java
Tue Aug  8 12:30:17 2006
@@ -0,0 +1,249 @@
+/**
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.geronimo.st.ui.internal;
+
+import org.apache.geronimo.st.core.GenericGeronimoServer;
+import org.apache.geronimo.st.ui.Activator;
+import org.apache.geronimo.st.ui.commands.SetUsernameCommand;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jst.server.generic.ui.internal.GenericServerUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerPort;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+public class GeronimoServerWizardFragment extends WizardFragment {
+
+	protected Text hostName;
+
+	protected Text adminId;
+
+	protected Text password;
+
+	protected Table ports;
+
+	protected TableViewer viewer;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jst.server.generic.ui.internal.ServerDefinitionTypeAwareWizardFragment#hasComposite()
+	 */
+	public boolean hasComposite() {
+		return true;
+	}
+
+	public Composite createComposite(Composite parent, IWizardHandle handle) {
+		Composite container = new Composite(parent, SWT.NONE);
+		GridLayout grid = new GridLayout(2, false);
+		grid.marginWidth = 0;
+		container.setLayout(grid);
+		container.setLayoutData(new GridData(GridData.FILL_BOTH));
+		handle.setImageDescriptor(Activator.getImageDescriptor(Activator.IMG_WIZ_GERONIMO));
+		handle.setTitle(GenericServerUIMessages.bind(GenericServerUIMessages.serverWizardTitle,
getServerName()));
+		handle.setDescription(GenericServerUIMessages.bind(GenericServerUIMessages.serverWizardDescription,
getServerName()));
+		createContent(container, handle);
+		return container;
+	}
+
+	public void createContent(Composite parent, IWizardHandle handle) {
+		Label label = new Label(parent, SWT.NONE);
+		label.setText(Messages.hostName);
+		label.setLayoutData(new GridData());
+
+		hostName = new Text(parent, SWT.BORDER);
+		hostName.setLayoutData(createTextGridData());
+		hostName.setText(getServer().getHost());
+
+		hostName.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				getServer().setHost(hostName.getText());
+			}
+		});
+
+		label = new Label(parent, SWT.NONE);
+		label.setText(Messages.adminId);
+		label.setLayoutData(new GridData());
+
+		adminId = new Text(parent, SWT.BORDER);
+		adminId.setLayoutData(createTextGridData());
+		adminId.setText(getGeronimoServer().getAdminID());
+
+		adminId.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				getGeronimoServer().setAdminID(adminId.getText());
+			}
+		});
+
+		label = new Label(parent, SWT.NONE);
+		label.setText(Messages.adminPassword);
+		label.setLayoutData(new GridData());
+
+		password = new Text(parent, SWT.BORDER | SWT.PASSWORD);
+		password.setLayoutData(createTextGridData());
+		password.setText(getGeronimoServer().getAdminPassword());
+
+		password.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				getGeronimoServer().setAdminPassword(password.getText());
+			}
+		});
+
+		label = new Label(parent, SWT.NONE);
+		label.setText(Messages.specifyPorts);
+		GridData data = createTextGridData();
+		data.verticalIndent = 15;
+		data.horizontalSpan = 2;
+		label.setLayoutData(data);
+
+		// ports
+		ports = new Table(parent, SWT.V_SCROLL | SWT.H_SCROLL
+				| SWT.FULL_SELECTION);
+		ports.setHeaderVisible(true);
+		ports.setLinesVisible(false);
+
+		TableColumn col = new TableColumn(ports, SWT.NONE);
+		col.setText(Messages.portName);
+		col.setResizable(false);
+		ColumnWeightData colData = new ColumnWeightData(15, 150, false);
+		TableLayout tableLayout = new TableLayout();
+		tableLayout.addColumnData(colData);
+
+		col = new TableColumn(ports, SWT.NONE);
+		col.setText(Messages.portValue);
+		col.setResizable(false);
+		colData = new ColumnWeightData(8, 80, false);
+		tableLayout.addColumnData(colData);
+
+		data = new GridData(GridData.FILL_HORIZONTAL
+				| GridData.VERTICAL_ALIGN_FILL);
+		data.horizontalSpan = 2;
+		data.heightHint = 100;
+		ports.setLayoutData(data);
+		ports.setLayout(tableLayout);
+
+		viewer = new TableViewer(ports);
+		viewer.setColumnProperties(new String[] { "name", "port" });
+
+		fillTable(ports);
+		addCellEditor(ports);
+	}
+
+	private void addCellEditor(Table ports) {
+		viewer.setCellEditors(new CellEditor[] { null,
+				new TextCellEditor(ports) });
+
+		ICellModifier cellModifier = new ICellModifier() {
+			public Object getValue(Object element, String property) {
+				ServerPort sp = (ServerPort) element;
+				return sp.getPort() + "";
+			}
+
+			public boolean canModify(Object element, String property) {
+				return "port".equals(property);
+			}
+
+			public void modify(Object element, String property, Object value) {
+				Item item = (Item) element;
+				ServerPort sp = (ServerPort) item.getData();
+				GenericGeronimoServer gs = getGeronimoServer();
+				gs.setInstanceProperty(sp.getId(), (String) value);
+				changePortNumber(sp.getId(), Integer.parseInt((String) value));
+			}
+		};
+
+		viewer.setCellModifier(cellModifier);
+	}
+
+	private void fillTable(Table ports) {
+		ServerPort[] serverPorts = getServer().getServerPorts(null);
+		if (serverPorts != null) {
+			for (int i = 0; i < serverPorts.length; i++) {
+				ServerPort port = serverPorts[i];
+				TableItem item = new TableItem(ports, SWT.NONE);
+				String[] s = new String[] { port.getName(),
+						Integer.toString(port.getPort()) };
+				item.setText(s);
+				item.setImage(Activator.getImage(Activator.IMG_PORT));
+				item.setData(port);
+			}
+		}
+	}
+
+	protected void changePortNumber(String id, int port) {
+		TableItem[] items = ports.getItems();
+		int size = items.length;
+		for (int i = 0; i < size; i++) {
+			ServerPort sp = (ServerPort) items[i].getData();
+			if (sp.getId().equals(id)) {
+				items[i].setData(new ServerPort(id, sp.getName(), port, sp.getProtocol()));
+				items[i].setText(1, port + "");
+				return;
+			}
+		}
+	}
+
+	private String getServerName() {
+		if (getServer() != null && getServer().getRuntime() != null)
+			return getServer().getRuntime().getRuntimeType().getName();
+		return null;
+	}
+
+	private IServerWorkingCopy getServer() {
+		return (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#isComplete()
+	 */
+	public boolean isComplete() {
+		GenericGeronimoServer gs = getGeronimoServer();
+		IStatus status = gs.validate();
+		return (status != null && status.isOK());
+	}
+
+	private GenericGeronimoServer getGeronimoServer() {
+		GenericGeronimoServer gs = (GenericGeronimoServer) getServer().getAdapter(GenericGeronimoServer.class);
+		if (gs == null)
+			gs = (GenericGeronimoServer) getServer().loadAdapter(GenericGeronimoServer.class, null);
+		return gs;
+	}
+
+	private GridData createTextGridData() {
+		return new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+	}
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoServerWizardFragment.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java?rev=429789&r1=429788&r2=429789&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java
Tue Aug  8 12:30:17 2006
@@ -45,6 +45,13 @@
 	public static String tooltipInstall;
 	public static String tooltipJetty;
 	public static String tooltipTomcat;
+	
+	public static String hostName;
+	public static String adminId;
+	public static String adminPassword;
+	public static String specifyPorts;
+	public static String portName;
+	public static String portValue;
 
 	static {
 		NLS.initializeMessages(Activator.PLUGIN_ID + ".internal.Messages", Messages.class);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties?rev=429789&r1=429788&r2=429789&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties
Tue Aug  8 12:30:17 2006
@@ -166,4 +166,11 @@
 tooltipLoc=A location of an existing Geronimo installation or a path to install to.
 tooltipInstall=Downloads the selected Geronimo distribution and installs it to the specified
location.
 tooltipJetty=Selects the Jetty distribution of Geronimo to install.
-tooltipTomcat=Selects the Tomcat distribution of Geronimo to install.
\ No newline at end of file
+tooltipTomcat=Selects the Tomcat distribution of Geronimo to install.
+
+hostName=Hostname:
+adminId=Administrator id:
+adminPassword=Administrator password:
+specifyPorts=Specify the configured ports for this server.
+portName=Port Name
+portValue=Port Value
\ No newline at end of file



Mime
View raw message