You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ge...@apache.org on 2005/08/26 13:32:11 UTC
svn commit: r240205 - in /geronimo/trunk/sandbox/eclipse-plugin:
org.apache.geronimo.core/META-INF/
org.apache.geronimo.core/src/org/apache/geronimo/core/internal/
org.apache.geronimo.ui/src/org/apache/geronimo/ui/actions/
org.apache.geronimo.ui/src/or...
Author: geirm
Date: Fri Aug 26 04:32:04 2005
New Revision: 240205
URL: http://svn.apache.org/viewcvs?rev=240205&view=rev
Log:
GERONIMO-914 : applied patch
Added:
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetPasswordCommand.java
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetUsernameCommand.java
Modified:
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/META-INF/MANIFEST.MF
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServer.java
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/actions/LaunchGeronimoConsoleAction.java
geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerSecurityEditorSection.java
Modified: geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/META-INF/MANIFEST.MF?rev=240205&r1=240204&r2=240205&view=diff
==============================================================================
--- geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/META-INF/MANIFEST.MF (original)
+++ geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/META-INF/MANIFEST.MF Fri Aug 26 04:32:04 2005
@@ -26,6 +26,7 @@
org.eclipse.wst.common.frameworks,
org.eclipse.core.commands,
org.apache.geronimo.deployment.model,
- org.eclipse.jem.util
+ org.eclipse.jem.util,
+ org.eclipse.wst.server.core
Eclipse-AutoStart: true
Export-Package: org.apache.geronimo.core.internal;x-friends:="org.apache.geronimo.ui"
Modified: geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServer.java?rev=240205&r1=240204&r2=240205&view=diff
==============================================================================
--- geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServer.java (original)
+++ geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServer.java Fri Aug 26 04:32:04 2005
@@ -16,6 +16,7 @@
package org.apache.geronimo.core.internal;
import java.net.URL;
+
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;
@@ -24,35 +25,59 @@
public class GeronimoServer extends GenericServer {
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IURLProvider#getModuleRootURL(org.eclipse.wst.server.core.IModule)
- */
- public URL getModuleRootURL(IModule module) {
- try {
- if (module == null || module.loadAdapter(IWebModule.class, null)==null )
- return null;
-
- String url = "http://localhost";
- int port = 0;
-
- port = getHttpPort();
- port =ServerMonitorManager.getInstance().getMonitoredPort(getServer(), port, "web");
- if (port != 80)
- url += ":" + port;
-
- String moduleId=GeronimoUtils.getContextRoot(module);
- if (!moduleId.startsWith("/"))
- url += "/";
- url += moduleId;
-
- if (!url.endsWith("/"))
- url += "/";
-
- return new URL(url);
- } catch (Exception e) {
- Trace.trace("Could not get root URL", e);
- return null;
- }
+ public static final String PROPERTY_ADMIN_ID = "adminID";
+
+ public static final String PROPERTY_ADMIN_PW = "adminPassword";
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.core.model.IURLProvider#getModuleRootURL(org.eclipse.wst.server.core.IModule)
+ */
+ public URL getModuleRootURL(IModule module) {
+ try {
+ if (module == null
+ || module.loadAdapter(IWebModule.class, null) == null)
+ return null;
+
+ String url = "http://localhost";
+ int port = 0;
+
+ port = getHttpPort();
+ port = ServerMonitorManager.getInstance().getMonitoredPort(
+ getServer(), port, "web");
+ if (port != 80)
+ url += ":" + port;
+
+ String moduleId = GeronimoUtils.getContextRoot(module);
+ if (!moduleId.startsWith("/"))
+ url += "/";
+ url += moduleId;
+
+ if (!url.endsWith("/"))
+ url += "/";
+
+ return new URL(url);
+ } catch (Exception e) {
+ Trace.trace("Could not get root URL", e);
+ return null;
+ }
+
+ }
+
+ public String getAdminID() {
+ return (String) getServerInstancePropertiesImpl().get(PROPERTY_ADMIN_ID);
+ }
+
+ public String getAdminPassword() {
+ return (String) getServerInstancePropertiesImpl().get(PROPERTY_ADMIN_PW);
+ }
+
+ public void setAdminID(String value) {
+ getServerInstancePropertiesImpl().put(PROPERTY_ADMIN_ID, value);
+ }
+
+ public void setAdminPassword(String value) {
+ getServerInstancePropertiesImpl().put(PROPERTY_ADMIN_PW, value);
+ }
}
Modified: geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java?rev=240205&r1=240204&r2=240205&view=diff
==============================================================================
--- geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java (original)
+++ geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java Fri Aug 26 04:32:04 2005
@@ -127,12 +127,14 @@
return dm;
}
- private String getUserName() {
- return "system";
+ private String getUserName() {
+ GeronimoServer server = (GeronimoServer) getServer().getAdapter(GeronimoServer.class);
+ return server.getAdminID();
}
private String getPassword() {
- return "manager";
+ GeronimoServer server = (GeronimoServer) getServer().getAdapter(GeronimoServer.class);
+ return server.getAdminPassword();
}
/* (non-Javadoc)
Modified: geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/actions/LaunchGeronimoConsoleAction.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/actions/LaunchGeronimoConsoleAction.java?rev=240205&r1=240204&r2=240205&view=diff
==============================================================================
--- geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/actions/LaunchGeronimoConsoleAction.java (original)
+++ geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/actions/LaunchGeronimoConsoleAction.java Fri Aug 26 04:32:04 2005
@@ -84,7 +84,8 @@
IServer server = (IServer) ((StructuredSelection) selection)
.getFirstElement();
- boolean enable = serverID.equals(server.getServerType().getId())
+
+ boolean enable = server != null && serverID.equals(server.getServerType().getId())
&& server.getServerState() == IServer.STATE_STARTED;
action.setEnabled(enable);
Added: geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetPasswordCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetPasswordCommand.java?rev=240205&view=auto
==============================================================================
--- geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetPasswordCommand.java (added)
+++ geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetPasswordCommand.java Fri Aug 26 04:32:04 2005
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.ui.commands;
+
+import org.apache.geronimo.core.internal.GeronimoServer;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+
+/**
+ *
+ *
+ */
+public class SetPasswordCommand extends ServerCommand {
+
+ protected String name;
+
+ protected String oldName;
+
+ GeronimoServer gs;
+
+ /**
+ * @param server
+ * @param name
+ */
+ public SetPasswordCommand(IServerWorkingCopy server, String name) {
+ super(server, name);
+ this.name = name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#execute()
+ */
+ public void execute() {
+ gs = (GeronimoServer) server.getAdapter(GeronimoServer.class);
+ if (gs == null) {
+ gs = (GeronimoServer) server.loadAdapter(GeronimoServer.class,
+ new NullProgressMonitor());
+ }
+ oldName = gs.getAdminPassword();
+ gs.setAdminPassword(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#undo()
+ */
+ public void undo() {
+ if (gs != null) {
+ gs.setAdminPassword(oldName);
+ }
+ }
+
+}
Added: geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetUsernameCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetUsernameCommand.java?rev=240205&view=auto
==============================================================================
--- geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetUsernameCommand.java (added)
+++ geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/commands/SetUsernameCommand.java Fri Aug 26 04:32:04 2005
@@ -0,0 +1,71 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.ui.commands;
+
+import org.apache.geronimo.core.internal.GeronimoServer;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+
+/**
+ *
+ *
+ */
+public class SetUsernameCommand extends ServerCommand {
+
+ protected String name;
+
+ protected String oldName;
+
+ GeronimoServer gs;
+
+ /**
+ * @param server
+ * @param name
+ */
+ public SetUsernameCommand(IServerWorkingCopy server, String name) {
+ super(server, name);
+ this.name = name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#execute()
+ */
+ public void execute() {
+ gs = (GeronimoServer) server.getAdapter(GeronimoServer.class);
+ if (gs == null) {
+ gs = (GeronimoServer) server.loadAdapter(GeronimoServer.class,
+ new NullProgressMonitor());
+ }
+ oldName = gs.getAdminID();
+ gs.setAdminID(name);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.ui.internal.command.ServerCommand#undo()
+ */
+ public void undo() {
+ if (gs != null) {
+ gs.setAdminID(oldName);
+ }
+ }
+
+}
Modified: geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerSecurityEditorSection.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerSecurityEditorSection.java?rev=240205&r1=240204&r2=240205&view=diff
==============================================================================
--- geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerSecurityEditorSection.java (original)
+++ geronimo/trunk/sandbox/eclipse-plugin/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ServerSecurityEditorSection.java Fri Aug 26 04:32:04 2005
@@ -15,7 +15,11 @@
*/
package org.apache.geronimo.ui.sections;
+import org.apache.geronimo.core.internal.GeronimoServer;
+import org.apache.geronimo.ui.commands.SetPasswordCommand;
+import org.apache.geronimo.ui.commands.SetUsernameCommand;
import org.apache.geronimo.ui.internal.Messages;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -24,6 +28,8 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -34,7 +40,13 @@
*
*
*/
-public class ServerSecurityEditorSection extends ServerEditorSection {
+public class ServerSecurityEditorSection extends ServerEditorSection {
+
+ Text username;
+
+ Text password;
+
+ GeronimoServer gs;
/**
*
@@ -76,23 +88,23 @@
// ------- Label and text field for the username -------
createLabel(composite, Messages.username, toolkit);
- Text username = toolkit.createText(composite, "system", SWT.BORDER);
+ username = toolkit.createText(composite, getUserName(), SWT.BORDER);
username.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
username.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
-
+ execute(new SetUsernameCommand(server, username.getText()));
}
});
// ------- Label and text field for the password -------
createLabel(composite, Messages.password, toolkit);
- Text password = toolkit.createText(composite, "password", SWT.BORDER);
+ password = toolkit.createText(composite, getPassword(), SWT.BORDER);
password
.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
password.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
-
+ execute(new SetPasswordCommand(server, password.getText()));
}
});
@@ -104,6 +116,35 @@
label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
return label;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.ui.editor.ServerEditorSection#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ gs = (GeronimoServer) server.getAdapter(GeronimoServer.class);
+ if (gs == null) {
+ gs = (GeronimoServer) server.loadAdapter(GeronimoServer.class,
+ new NullProgressMonitor());
+ }
+ }
+
+ private String getUserName() {
+ if (gs != null) {
+ return gs.getAdminID();
+ }
+ return "";
+ }
+
+ private String getPassword() {
+ if (gs != null) {
+ return gs.getAdminPassword();
+ }
+ return "";
}
}