geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r611355 [2/5] - in /geronimo/devtools/eclipse-plugin/trunk/plugins: ./ org.apache.geronimo.runtime.v21/ org.apache.geronimo.runtime.v21/META-INF/ org.apache.geronimo.st.core/ org.apache.geronimo.st.ui/ org.apache.geronimo.st.ui/src/org/apac...
Date Sat, 12 Jan 2008 02:38:27 GMT
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.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/GeronimoRuntimeWizardFragment.java?rev=611355&r1=611354&r2=611355&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java Fri Jan 11 18:38:22 2008
@@ -76,436 +76,447 @@
  */
 public class GeronimoRuntimeWizardFragment extends WizardFragment {
 
-	private GeronimoRuntimeDelegate geronimoRuntime;
+    private GeronimoRuntimeDelegate geronimoRuntime;
 
-	protected Text installDir;
+    protected Text installDir;
 
-	private Button tomcat;
+    private Button tomcat;
 
-	private Button jetty;
+    private Button jetty;
 
-	protected Group group;
-
-	private IWizardHandle fWizard;
-
-	protected List<IVMInstall> installedJREs;
-
-	protected String[] jreNames;
-
-	protected Combo combo;
-
-	public GeronimoRuntimeWizardFragment() {
-		super();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#hasComposite()
-	 */
-	public boolean hasComposite() {
-		return true;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#createComposite(org.eclipse.swt.widgets.Composite,
-	 *      org.eclipse.wst.server.ui.wizard.IWizardHandle)
-	 */
-	public Composite createComposite(Composite parent, IWizardHandle handle) {
-		this.fWizard = handle;
-		Composite container = new Composite(parent, SWT.NONE);
-		GridLayout grid = new GridLayout(1, false);
-		grid.marginWidth = 0;
-		container.setLayout(grid);
-		container.setLayoutData(new GridData(GridData.FILL_BOTH));
-		handle.setImageDescriptor(Activator.getImageDescriptor((Activator.IMG_WIZ_GERONIMO)));
-		handle.setTitle(Messages.bind(Messages.runtimeWizardTitle, getRuntimeName()));
-		String version = getRuntimeDelegate().getRuntime().getRuntimeType().getVersion();
-		handle.setDescription(Messages.bind(Messages.runtimeWizardDescription, version));
-		createContent(container, handle);
-		return container;
-	}
-
-	public void createContent(Composite parent, IWizardHandle handle) {
-
-		Composite composite = new Composite(parent, SWT.NONE);
-		GridLayout layout = new GridLayout(3, false);
-		composite.setLayout(layout);
-		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
-		addJRESelection(composite);
-		addInstallDirSection(composite);
-		addInstallableRuntimeSection(composite);
-	}
-
-	protected void addInstallableRuntimeSection(Composite composite) {
-		GridData data = new GridData();
-		data = new GridData(GridData.FILL_BOTH);
-		data.horizontalSpan = 3;
-
-		GeronimoRuntimeDelegate gRuntime = getGeronimoRuntime();
-
-		final IInstallableRuntime gWithTomcat = ServerPlugin.findInstallableRuntime(gRuntime.getInstallableTomcatRuntimeId());
-		final IInstallableRuntime gWithJetty = ServerPlugin.findInstallableRuntime(gRuntime.getInstallableJettyRuntimeId());
-
-		if (gWithTomcat != null && gWithJetty != null) {
-			group = new Group(composite, SWT.NONE);
-			group.setText(Messages.downloadOptions);
-			group.setLayoutData(data);
-			group.setLayout(composite.getLayout());
-			group.setEnabled(false);
-
-			Label webContainer = new Label(group, SWT.NONE);
-			webContainer.setText(Messages.chooseWebContainer);
-			data = new GridData();
-			data.horizontalSpan = 3;
-			webContainer.setLayoutData(data);
-
-			tomcat = new Button(group, SWT.RADIO);
-			tomcat.setSelection(true);
-			tomcat.setText(Messages.gWithTomcat);
-			data = new GridData();
-			data.horizontalSpan = 3;
-			tomcat.setLayoutData(data);
-			tomcat.setToolTipText(Messages.tooltipTomcat);
-
-			jetty = new Button(group, SWT.RADIO);
-			jetty.setText(Messages.gWithJetty);
-			data = new GridData();
-			data.horizontalSpan = 3;
-			jetty.setLayoutData(data);
-			jetty.setToolTipText(Messages.tooltipJetty);
-
-			Button install = SWTUtil.createButton(group, Messages.install);
-			data = new GridData();
-			data.horizontalSpan = 3;
-			install.setLayoutData(data);
-			install.setToolTipText(Messages.bind(Messages.tooltipInstall, getRuntimeName()));
-			install.addSelectionListener(new SelectionAdapter() {
-				public void widgetSelected(SelectionEvent se) {
-					if (installDir != null && isValidLocation()) {
-						Shell shell = installDir.getShell();
-						ConfirmInstallDialog dialog = new ConfirmInstallDialog(shell, installDir.getText());
-						dialog.open();
-						if (dialog.getReturnCode() == IDialogConstants.OK_ID) {
-
-							final IInstallableRuntime installable = tomcat.getSelection() ? gWithTomcat
-									: gWithJetty;
-							final Path installPath = new Path(installDir.getText());
-							IRunnableWithProgress runnable = new IRunnableWithProgress() {
-								public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-									try {
-										installable.install(installPath, monitor);
-									} catch (CoreException e) {
-										Trace.trace(Trace.SEVERE, "Error installing runtime", e);
-									}
-								}
-							};
-
-							try {
-								getWizard().run(true, false, runnable);
-							} catch (InterruptedException e) {
-								e.printStackTrace();
-							} catch (InvocationTargetException e) {
-								e.printStackTrace();
-							} catch (Exception e) {
-								Trace.trace(Trace.SEVERE, "Error installing runtime", e);
-							}
-
-							updateInstallDir(installPath);
-
-						}
-					}
-				}
-
-				boolean isValidLocation() {
-					return true;
-				}
-
-				void updateInstallDir(IPath installPath) {
-					InstallableRuntime installable = (InstallableRuntime) (tomcat.getSelection() ? gWithTomcat
-							: gWithJetty);
-					String version = installable.getFeatureVersion();
-//              			if (version.endsWith(".0"))
-//		                		version = version.substring(0, version.lastIndexOf(".0"));
-					installPath = installPath.append("geronimo-" + (tomcat.getSelection() ? "tomcat6" : "jetty6") + "-jee5-" + version);
-					installDir.setText(installPath.toOSString());
-				}
-			});
-		}
-	}
-
-	protected GeronimoRuntimeDelegate getGeronimoRuntime() {
-		if (geronimoRuntime == null)
-			geronimoRuntime = (GeronimoRuntimeDelegate) getRuntimeDelegate().getRuntime().loadAdapter(GeronimoRuntimeDelegate.class, null);
-		return geronimoRuntime;
-	}
-
-	protected void addInstallDirSection(Composite composite) {
-		Label label = new Label(composite, SWT.NONE);
-		label.setText(Messages.installDir);
-		GridData data = new GridData();
-		data.horizontalSpan = 3;
-		label.setLayoutData(data);
-		String tooltipLoc = Messages.bind(Messages.tooltipLoc, getRuntimeName());
-		label.setToolTipText(tooltipLoc);
-
-		installDir = new Text(composite, SWT.BORDER);
-
-		IPath currentLocation = getRuntimeDelegate().getRuntimeWorkingCopy().getLocation();
-		if (currentLocation != null) {
-			installDir.setText(currentLocation.toOSString());
-		}
-
-		data = new GridData(GridData.FILL_HORIZONTAL);
-		data.horizontalSpan = 2;
-		installDir.setLayoutData(data);
-		installDir.setToolTipText(tooltipLoc);
-		installDir.addModifyListener(new ModifyListener() {
-			public void modifyText(ModifyEvent e) {
-				getRuntimeDelegate().getRuntimeWorkingCopy().setLocation(new Path(installDir.getText()));
-				validate();
-			}
-		});
-
-		final Composite browseComp = composite;
-		Button browse = SWTUtil.createButton(composite, Messages.browse);
-		browse.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent se) {
-				DirectoryDialog dialog = new DirectoryDialog(browseComp.getShell());
-				dialog.setMessage(Messages.installDir);
-				dialog.setFilterPath(installDir.getText());
-				String selectedDirectory = dialog.open();
-				if (selectedDirectory != null)
-					installDir.setText(selectedDirectory);
-			}
-		});
-	}
-
-	protected void addJRESelection(final Composite composite) {
-		updateJREs();
-
-		Label label = new Label(composite, SWT.NONE);
-		label.setText(Messages.installedJRE);
-		label.setLayoutData(new GridData());
-
-		combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
-		combo.setItems(jreNames);
-		GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
-		combo.setLayoutData(data);
-
-		combo.addSelectionListener(new SelectionListener() {
-			public void widgetSelected(SelectionEvent e) {
-				int sel = combo.getSelectionIndex();
-				IVMInstall vmInstall = null;
-				if (sel > 0)
-					vmInstall = (IVMInstall) installedJREs.get(sel - 1);
-				getGeronimoRuntime().setVMInstall(vmInstall);
-				validate();
-			}
-
-			public void widgetDefaultSelected(SelectionEvent e) {
-				widgetSelected(e);
-			}
-		});
-
-		Button button = SWTUtil.createButton(composite, Messages.installedJREs);
-		button.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				String currentVM = combo.getText();
-				if (showPreferencePage(composite)) {
-					updateJREs();
-					combo.setItems(jreNames);
-					combo.setText(currentVM);
-					if (combo.getSelectionIndex() == -1)
-						combo.select(0);
-				}
-			}
-		});
-
-		if (getRuntimeDelegate() != null) {
-			if (getRuntimeDelegate().isUsingDefaultJRE()) {
-				combo.select(0);
-			} else {
-				combo.setText(getRuntimeDelegate().getVMInstall().getName());
-			}
-		}
-	}
-
-	protected boolean showPreferencePage(Composite composite) {
-		PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
-		IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode("org.eclipse.jdt.debug.ui.preferences.VMPreferencePage");
-		PreferenceManager manager2 = new PreferenceManager();
-		manager2.addToRoot(node);
-		final PreferenceDialog dialog = new PreferenceDialog(composite.getShell(), manager2);
-		final boolean[] result = new boolean[] { false };
-		BusyIndicator.showWhile(composite.getDisplay(), new Runnable() {
-			public void run() {
-				dialog.create();
-				if (dialog.open() == Window.OK)
-					result[0] = true;
-			}
-		});
-		return result[0];
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#isComplete()
-	 */
-	public boolean isComplete() {
-		IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
-		IStatus status = runtimeWC.validate(null);
-		return status == null || status.getSeverity() != IStatus.ERROR;
-	}
-
-	protected void validate() {
-
-		IRuntime runtime = getRuntimeDelegate().getRuntime();
-
-		IWizardHandle wizard = getWizard();
-
-		if (runtime == null) {
-			wizard.setMessage("", IMessageProvider.ERROR);
-			return;
-		}
-
-		IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
-		getRuntimeDelegate().setInstanceProperty("serverRootDirectory", installDir.getText());
-
-		if (installDir.getText() == null || installDir.getText().length() == 0) {
-			// installDir field has not been entered
-			wizard.setMessage(Messages.installDirInfo, IMessageProvider.NONE);
-		} else {
-			IStatus status = runtimeWC.validate(null);
-			if (status == null || status.isOK()) {
-				// a valid install found
-				wizard.setMessage(null, IMessageProvider.NONE);
-				group.setEnabled(false);
-			} else if (status.getCode() == GeronimoRuntimeDelegate.INCORRECT_VERSION) {
-				group.setEnabled(false);
-				if (status.getSeverity() == IStatus.ERROR) {
-					wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
-					return;
-				}
-				wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
-			} else if (status.getCode() == GeronimoRuntimeDelegate.PARTIAL_IMAGE) {
-				wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
-				return;
-			} else {
-				File file = new Path(installDir.getText()).toFile();
-				boolean enableGroup = file.isDirectory() && file.canWrite() ? true : false;
-				group.setEnabled(enableGroup);
-				if (file.isDirectory()) {
-					String message = file.canWrite() ? Messages.noImageFound : Messages.cannotInstallAtLocation;
-					wizard.setMessage(message, IMessageProvider.ERROR);
-				} else {
-					wizard.setMessage(Messages.noSuchDir, IMessageProvider.ERROR);
-				}
-				return;
-			}
-
-			if (!isValidVM())
-				wizard.setMessage(Messages.jvmWarning, IMessageProvider.WARNING);
-		}
-	}
-
-	private boolean isValidVM() {
-		if(getRuntimeDelegate().getRuntime().getRuntimeType().getVersion().startsWith("1")) {
-			IVMInstall vmInstall = getRuntimeDelegate().getVMInstall();
-			if (vmInstall instanceof IVMInstall2) {
-				String javaVersion = ((IVMInstall2) vmInstall).getJavaVersion();
-				return javaVersion != null && javaVersion.startsWith("1.4");
-			}
-		}
-		return true;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#enter()
-	 */
-	public void enter() {
-		if (getRuntimeDelegate() != null)
-			getRuntimeDelegate().getRuntimeWorkingCopy().setName(createName());
-		validate();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#exit()
-	 */
-	public void exit() {
-		validate();
-	}
-
-	private GeronimoRuntimeDelegate getRuntimeDelegate() {
-		IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
-		if (wc == null)
-			return null;
-		return (GeronimoRuntimeDelegate) wc.loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
-	}
-
-	private String createName() {
-		RuntimeDelegate dl = getRuntimeDelegate();
-		IRuntimeType runtimeType = dl.getRuntime().getRuntimeType();
-		String name = runtimeType.getName();
-		IRuntime[] list = ServerCore.getRuntimes();
-		int suffix = 1;
-		String suffixName = name;
-		for (int i = 0; i < list.length; i++) {
-			if ((list[i].getName().equals(name) || list[i].getName().equals(suffixName))
-					&& !list[i].equals(dl.getRuntime()))
-				suffix++;
-			suffixName = name + " " + suffix;
-		}
-
-		if (suffix > 1)
-			return suffixName;
-		return name;
-	}
-
-	protected String getRuntimeName() {
-		if (getRuntimeDelegate() != null
-				&& getRuntimeDelegate().getRuntime() != null)
-			return getRuntimeDelegate().getRuntime().getName();
-		return null;
-	}
-
-	protected void updateJREs() {
-		installedJREs = new ArrayList<IVMInstall>();
-		IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
-		int size = vmInstallTypes.length;
-		for (int i = 0; i < size; i++) {
-			IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
-			int size2 = vmInstalls.length;
-			for (int j = 0; j < size2; j++) {
-				installedJREs.add(vmInstalls[j]);
-			}
-		}
-
-		size = installedJREs.size();
-		jreNames = new String[size + 1];
-		jreNames[0] = Messages.runtimeDefaultJRE;
-		for (int i = 0; i < size; i++) {
-			IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
-			jreNames[i + 1] = vmInstall.getName();
-		}
-	}
-
-	public IWizardHandle getWizard() {
-		return fWizard;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#createChildFragments(java.util.List)
-	 */
-	protected void createChildFragments(List list) {
-		list.add(new GeronimoRuntimeSourceWizardFragment());
-	}
+    protected Group group;
+
+    private IWizardHandle fWizard;
+
+    protected List<IVMInstall> installedJREs;
+
+    protected String[] jreNames;
+
+    protected Combo combo;
+
+    public GeronimoRuntimeWizardFragment() {
+        super();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#hasComposite()
+     */
+    public boolean hasComposite() {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#createComposite(org.eclipse.swt.widgets.Composite,
+     *      org.eclipse.wst.server.ui.wizard.IWizardHandle)
+     */
+    public Composite createComposite(Composite parent, IWizardHandle handle) {
+        this.fWizard = handle;
+        Composite container = new Composite(parent, SWT.NONE);
+        GridLayout grid = new GridLayout(1, false);
+        grid.marginWidth = 0;
+        container.setLayout(grid);
+        container.setLayoutData(new GridData(GridData.FILL_BOTH));
+        handle.setImageDescriptor(Activator.getImageDescriptor((Activator.IMG_WIZ_GERONIMO)));
+        handle.setTitle(Messages.bind(Messages.runtimeWizardTitle, getRuntimeName()));
+        String version = getRuntimeDelegate().getRuntime().getRuntimeType().getVersion();
+        handle.setDescription(Messages.bind(Messages.runtimeWizardDescription, version));
+        createContent(container, handle);
+        return container;
+    }
+
+    public void createContent(Composite parent, IWizardHandle handle) {
+
+        Composite composite = new Composite(parent, SWT.NONE);
+        GridLayout layout = new GridLayout(3, false);
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+        addJRESelection(composite);
+        addInstallDirSection(composite);
+        addInstallableRuntimeSection(composite);
+    }
+
+    protected void addInstallableRuntimeSection(Composite composite) {
+        GridData data = new GridData();
+        data = new GridData(GridData.FILL_BOTH);
+        data.horizontalSpan = 3;
+
+        GeronimoRuntimeDelegate gRuntime = getGeronimoRuntime();
+
+        final IInstallableRuntime gWithTomcat = ServerPlugin.findInstallableRuntime(gRuntime.getInstallableTomcatRuntimeId());
+        final IInstallableRuntime gWithJetty = ServerPlugin.findInstallableRuntime(gRuntime.getInstallableJettyRuntimeId());
+
+        if (gWithTomcat != null && gWithJetty != null) {
+            group = new Group(composite, SWT.NONE);
+            group.setText(Messages.downloadOptions);
+            group.setLayoutData(data);
+            group.setLayout(composite.getLayout());
+            group.setEnabled(false);
+
+            Label webContainer = new Label(group, SWT.NONE);
+            webContainer.setText(Messages.chooseWebContainer);
+            data = new GridData();
+            data.horizontalSpan = 3;
+            webContainer.setLayoutData(data);
+
+            tomcat = new Button(group, SWT.RADIO);
+            tomcat.setSelection(true);
+            tomcat.setText(Messages.gWithTomcat);
+            data = new GridData();
+            data.horizontalSpan = 3;
+            tomcat.setLayoutData(data);
+            tomcat.setToolTipText(Messages.tooltipTomcat);
+
+            jetty = new Button(group, SWT.RADIO);
+            jetty.setText(Messages.gWithJetty);
+            data = new GridData();
+            data.horizontalSpan = 3;
+            jetty.setLayoutData(data);
+            jetty.setToolTipText(Messages.tooltipJetty);
+
+            Button install = SWTUtil.createButton(group, Messages.install);
+            data = new GridData();
+            data.horizontalSpan = 3;
+            install.setLayoutData(data);
+            install.setToolTipText(Messages.bind(Messages.tooltipInstall, getRuntimeName()));
+            install.addSelectionListener(new SelectionAdapter() {
+                                             public void widgetSelected(SelectionEvent se) {
+                                                 if (installDir != null && isValidLocation()) {
+                                                     Shell shell = installDir.getShell();
+                                                     ConfirmInstallDialog dialog = new ConfirmInstallDialog(shell, installDir.getText());
+                                                     dialog.open();
+                                                     if (dialog.getReturnCode() == IDialogConstants.OK_ID) {
+
+                                                         final IInstallableRuntime installable = tomcat.getSelection() ? gWithTomcat
+                                                         : gWithJetty;
+                                                         final Path installPath = new Path(installDir.getText());
+                                                         IRunnableWithProgress runnable = new IRunnableWithProgress() {
+                                                             public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+                                                                 try {
+                                                                     installable.install(installPath, monitor);
+                                                                 }
+                                                                 catch (CoreException e) {
+                                                                     Trace.trace(Trace.SEVERE, "Error installing runtime", e);
+                                                                 }
+                                                             }
+                                                         };
+
+                                                         try {
+                                                             getWizard().run(true, false, runnable);
+                                                         }
+                                                         catch (InterruptedException e) {
+                                                             e.printStackTrace();
+                                                         }
+                                                         catch (InvocationTargetException e) {
+                                                             e.printStackTrace();
+                                                         }
+                                                         catch (Exception e) {
+                                                             Trace.trace(Trace.SEVERE, "Error installing runtime", e);
+                                                         }
+
+                                                         updateInstallDir(installPath);
+
+                                                     }
+                                                 }
+                                             }
+
+                                             boolean isValidLocation() {
+                                                 return true;
+                                             }
+
+                                             void updateInstallDir(IPath installPath) {
+                                                 InstallableRuntime installable = (InstallableRuntime) (tomcat.getSelection() ? gWithTomcat
+                                                                                                        : gWithJetty);
+                                                 String version = installable.getFeatureVersion();
+                                                 installPath = installPath.append("geronimo-" + (tomcat.getSelection() ? "tomcat6" : "jetty6") + "-jee5-" + version);
+                                                 installDir.setText(installPath.toOSString());
+                                             }
+                                         });
+        }
+        else {
+            Trace.trace(Trace.SEVERE, "Error finding installable runtime(s)");
+        }
+    }
+
+    protected GeronimoRuntimeDelegate getGeronimoRuntime() {
+        if (geronimoRuntime == null)
+            geronimoRuntime = (GeronimoRuntimeDelegate) getRuntimeDelegate().getRuntime().loadAdapter(GeronimoRuntimeDelegate.class, null);
+        return geronimoRuntime;
+    }
+
+    protected void addInstallDirSection(Composite composite) {
+        Label label = new Label(composite, SWT.NONE);
+        label.setText(Messages.installDir);
+        GridData data = new GridData();
+        data.horizontalSpan = 3;
+        label.setLayoutData(data);
+        String tooltipLoc = Messages.bind(Messages.tooltipLoc, getRuntimeName());
+        label.setToolTipText(tooltipLoc);
+
+        installDir = new Text(composite, SWT.BORDER);
+
+        IPath currentLocation = getRuntimeDelegate().getRuntimeWorkingCopy().getLocation();
+        if (currentLocation != null) {
+            installDir.setText(currentLocation.toOSString());
+        }
+
+        data = new GridData(GridData.FILL_HORIZONTAL);
+        data.horizontalSpan = 2;
+        installDir.setLayoutData(data);
+        installDir.setToolTipText(tooltipLoc);
+        installDir.addModifyListener(new ModifyListener() {
+                                         public void modifyText(ModifyEvent e) {
+                                             getRuntimeDelegate().getRuntimeWorkingCopy().setLocation(new Path(installDir.getText()));
+                                             validate();
+                                         }
+                                     });
+
+        final Composite browseComp = composite;
+        Button browse = SWTUtil.createButton(composite, Messages.browse);
+        browse.addSelectionListener(new SelectionAdapter() {
+                                        public void widgetSelected(SelectionEvent se) {
+                                            DirectoryDialog dialog = new DirectoryDialog(browseComp.getShell());
+                                            dialog.setMessage(Messages.installDir);
+                                            dialog.setFilterPath(installDir.getText());
+                                            String selectedDirectory = dialog.open();
+                                            if (selectedDirectory != null)
+                                                installDir.setText(selectedDirectory);
+                                        }
+                                    });
+    }
+
+    protected void addJRESelection(final Composite composite) {
+        updateJREs();
+
+        Label label = new Label(composite, SWT.NONE);
+        label.setText(Messages.installedJRE);
+        label.setLayoutData(new GridData());
+
+        combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
+        combo.setItems(jreNames);
+        GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+        combo.setLayoutData(data);
+
+        combo.addSelectionListener(new SelectionListener() {
+                                       public void widgetSelected(SelectionEvent e) {
+                                           int sel = combo.getSelectionIndex();
+                                           IVMInstall vmInstall = null;
+                                           if (sel > 0)
+                                               vmInstall = (IVMInstall) installedJREs.get(sel - 1);
+                                           getGeronimoRuntime().setVMInstall(vmInstall);
+                                           validate();
+                                       }
+
+                                       public void widgetDefaultSelected(SelectionEvent e) {
+                                           widgetSelected(e);
+                                       }
+                                   });
+
+        Button button = SWTUtil.createButton(composite, Messages.installedJREs);
+        button.addSelectionListener(new SelectionAdapter() {
+                                        public void widgetSelected(SelectionEvent e) {
+                                            String currentVM = combo.getText();
+                                            if (showPreferencePage(composite)) {
+                                                updateJREs();
+                                                combo.setItems(jreNames);
+                                                combo.setText(currentVM);
+                                                if (combo.getSelectionIndex() == -1)
+                                                    combo.select(0);
+                                            }
+                                        }
+                                    });
+
+        if (getRuntimeDelegate() != null) {
+            if (getRuntimeDelegate().isUsingDefaultJRE()) {
+                combo.select(0);
+            }
+            else {
+                combo.setText(getRuntimeDelegate().getVMInstall().getName());
+            }
+        }
+    }
+
+    protected boolean showPreferencePage(Composite composite) {
+        PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
+        IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode("org.eclipse.jdt.debug.ui.preferences.VMPreferencePage");
+        PreferenceManager manager2 = new PreferenceManager();
+        manager2.addToRoot(node);
+        final PreferenceDialog dialog = new PreferenceDialog(composite.getShell(), manager2);
+        final boolean[] result = new boolean[] { false};
+        BusyIndicator.showWhile(composite.getDisplay(), new Runnable() {
+                                    public void run() {
+                                        dialog.create();
+                                        if (dialog.open() == Window.OK)
+                                            result[0] = true;
+                                    }
+                                });
+        return result[0];
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#isComplete()
+     */
+    public boolean isComplete() {
+        IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
+        IStatus status = runtimeWC.validate(null);
+        return status == null || status.getSeverity() != IStatus.ERROR;
+    }
+
+    protected void validate() {
+
+        IRuntime runtime = getRuntimeDelegate().getRuntime();
+
+        IWizardHandle wizard = getWizard();
+
+        if (runtime == null) {
+            wizard.setMessage("", IMessageProvider.ERROR);
+            return;
+        }
+
+        IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
+        getRuntimeDelegate().setInstanceProperty("serverRootDirectory", installDir.getText());
+
+        if (installDir.getText() == null || installDir.getText().length() == 0) {
+            // installDir field has not been entered
+            wizard.setMessage(Messages.installDirInfo, IMessageProvider.NONE);
+        }
+        else {
+            IStatus status = runtimeWC.validate(null);
+            if (status == null || status.isOK()) {
+                // a valid install found
+                wizard.setMessage(null, IMessageProvider.NONE);
+                group.setEnabled(false);
+            }
+            else if (status.getCode() == GeronimoRuntimeDelegate.INCORRECT_VERSION) {
+                group.setEnabled(false);
+                if (status.getSeverity() == IStatus.ERROR) {
+                    wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
+                    return;
+                }
+                wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
+            }
+            else if (status.getCode() == GeronimoRuntimeDelegate.PARTIAL_IMAGE) {
+                wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
+                return;
+            }
+            else {
+                File file = new Path(installDir.getText()).toFile();
+                boolean enableGroup = file.isDirectory() && file.canWrite() ? true : false;
+                group.setEnabled(enableGroup);
+                if (file.isDirectory()) {
+                    String message = file.canWrite() ? Messages.noImageFound : Messages.cannotInstallAtLocation;
+                    wizard.setMessage(message, IMessageProvider.ERROR);
+                }
+                else {
+                    wizard.setMessage(Messages.noSuchDir, IMessageProvider.ERROR);
+                }
+                return;
+            }
+
+            if (!isValidVM())
+                wizard.setMessage(Messages.jvmWarning, IMessageProvider.WARNING);
+        }
+    }
+
+    private boolean isValidVM() {
+        if (getRuntimeDelegate().getRuntime().getRuntimeType().getVersion().startsWith("1")) {
+            IVMInstall vmInstall = getRuntimeDelegate().getVMInstall();
+            if (vmInstall instanceof IVMInstall2) {
+                String javaVersion = ((IVMInstall2) vmInstall).getJavaVersion();
+                return javaVersion != null && javaVersion.startsWith("1.4");
+            }
+        }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#enter()
+     */
+    public void enter() {
+        if (getRuntimeDelegate() != null)
+            getRuntimeDelegate().getRuntimeWorkingCopy().setName(createName());
+        validate();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#exit()
+     */
+    public void exit() {
+        validate();
+    }
+
+    private GeronimoRuntimeDelegate getRuntimeDelegate() {
+        IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+        if (wc == null)
+            return null;
+        return(GeronimoRuntimeDelegate) wc.loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
+    }
+
+    private String createName() {
+        RuntimeDelegate dl = getRuntimeDelegate();
+        IRuntimeType runtimeType = dl.getRuntime().getRuntimeType();
+        String name = runtimeType.getName();
+        IRuntime[] list = ServerCore.getRuntimes();
+        int suffix = 1;
+        String suffixName = name;
+        for (int i = 0; i < list.length; i++) {
+            if ((list[i].getName().equals(name) || list[i].getName().equals(suffixName))
+                && !list[i].equals(dl.getRuntime()))
+                suffix++;
+            suffixName = name + " " + suffix;
+        }
+
+        if (suffix > 1)
+            return suffixName;
+        return name;
+    }
+
+    protected String getRuntimeName() {
+        if (getRuntimeDelegate() != null
+            && getRuntimeDelegate().getRuntime() != null)
+            return getRuntimeDelegate().getRuntime().getName();
+        return null;
+    }
+
+    protected void updateJREs() {
+        installedJREs = new ArrayList<IVMInstall>();
+        IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
+        int size = vmInstallTypes.length;
+        for (int i = 0; i < size; i++) {
+            IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
+            int size2 = vmInstalls.length;
+            for (int j = 0; j < size2; j++) {
+                installedJREs.add(vmInstalls[j]);
+            }
+        }
+
+        size = installedJREs.size();
+        jreNames = new String[size + 1];
+        jreNames[0] = Messages.runtimeDefaultJRE;
+        for (int i = 0; i < size; i++) {
+            IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
+            jreNames[i + 1] = vmInstall.getName();
+        }
+    }
+
+    public IWizardHandle getWizard() {
+        return fWizard;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.wst.server.ui.wizard.WizardFragment#createChildFragments(java.util.List)
+     */
+    protected void createChildFragments(List list) {
+        list.add(new GeronimoRuntimeSourceWizardFragment());
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/plugin.xml?rev=611355&r1=611354&r2=611355&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/plugin.xml Fri Jan 11 18:38:22 2008
@@ -66,6 +66,12 @@
         </installableRuntime>
     </extension>
     
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Declare the 1.0 version of the "Geronimo Deployment" <project-facet> and the <action>   -->
+    <!-- that the user can perform on the facet (i.e., install)                                  -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
     <extension point="org.eclipse.wst.common.project.facet.core.facets">
         <project-facet-version facet="org.apache.geronimo.facet" version="1.0">
             <action type="install">
@@ -98,6 +104,13 @@
             runtime-component="org.apache.geronimo.runtime" version="1.0"/>
     </extension>
     
+    
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Map the <runtime-component> (defined in org.apache.geronimo.st.core\plugin.xml) to a    -->
+    <!-- specific version of the "Geronimo Deployment" <project-facet>                           -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
     <extension id="org.apache.geronimo.defaultFacets"
         name="Geronimo Default Facets"
         point="org.eclipse.wst.common.project.facet.core.defaultFacets">

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml?rev=611355&r1=611354&r2=611355&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/plugin.xml Fri Jan 11 18:38:22 2008
@@ -68,6 +68,12 @@
             runtime-component="org.apache.geronimo.runtime" version="1.1"/>
     </extension>
     
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Declare the 1.1 version of the "Geronimo Deployment" <project-facet> and the <action>   -->
+    <!-- that the user can perform on the facet (i.e., install)                                  -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
     <extension point="org.eclipse.wst.common.project.facet.core.facets">        
         <project-facet-version facet="org.apache.geronimo.facet" version="1.1">
             <action type="install" id="geronimo.plan.install">
@@ -100,6 +106,13 @@
         </project-facet-version>
     </extension>
     
+    
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Map the <runtime-component> (defined in org.apache.geronimo.st.core\plugin.xml) to a    -->
+    <!-- specific version of the "Geronimo Deployment" <project-facet>                           -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
     <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets" 
     	id="org.apache.geronimo.defaultFacets"
         name="Geronimo Default Facets">

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/plugin.xml?rev=611355&r1=611354&r2=611355&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/plugin.xml Fri Jan 11 18:38:22 2008
@@ -69,6 +69,14 @@
             runtime-component="org.apache.geronimo.runtime" version="2.0"/>
     </extension>
     
+    
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Declare the 2.0 version of the "Geronimo Deployment" <project-facet> and the <action>   -->
+    <!-- that the user can perform on the facet (i.e., install)                                  -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
+    <!-- 
     <extension point="org.eclipse.wst.common.project.facet.core.facets">        
         <project-facet-version facet="org.apache.geronimo.facet" version="2.0">
             <action type="install" id="geronimo.plan.install">
@@ -100,13 +108,22 @@
             </constraint>
         </project-facet-version>
     </extension>
+    -->
+    
     
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Map the <runtime-component> (defined in org.apache.geronimo.st.core\plugin.xml) to a    -->
+    <!-- specific version of the "Geronimo Deployment" <project-facet>. Note that the 1.1        -->
+    <!-- version is the only supported <project-facet-version> for the 2.0 Geronimo server.      -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
     <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets" 
     	id="org.apache.geronimo.defaultFacets"
         name="Geronimo Default Facets">
         <default-facets>
             <runtime-component id="org.apache.geronimo.runtime" version="2.0"/>
-            <facet id="org.apache.geronimo.facet" version="2.0"/>
+            <facet id="org.apache.geronimo.facet" version="1.1"/>
         </default-facets>
     </extension>
   

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/META-INF/MANIFEST.MF?rev=611355&r1=611354&r2=611355&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/META-INF/MANIFEST.MF (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/META-INF/MANIFEST.MF Fri Jan 11 18:38:22 2008
@@ -12,7 +12,8 @@
  org.eclipse.core.resources,
  org.apache.geronimo.v11.deployment.model.edit,
  org.apache.geronimo.v11.deployment.model,
- org.eclipse.wst.common.project.facet.ui
+ org.eclipse.wst.common.project.facet.ui,
+ org.apache.geronimo.st.v11.ui
 Eclipse-LazyStart: true
 Bundle-Vendor: Apache.org
 Export-Package: org.apache.geronimo.st.v20.ui,

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/plugin.xml?rev=611355&r1=611354&r2=611355&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/plugin.xml Fri Jan 11 18:38:22 2008
@@ -34,7 +34,7 @@
 
     <extension point="org.eclipse.wst.common.project.facet.ui.wizardPages">
   		<wizard-pages action="geronimo.plan.install">
-    		<page class="org.apache.geronimo.st.v20.ui.wizards.FacetInstallPage"/>
+    		<page class="org.apache.geronimo.st.v11.ui.wizards.FacetInstallPage"/>
   		</wizard-pages>
 	</extension>  
 </plugin>

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/pom.xml?rev=611355&r1=611354&r2=611355&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.ui/pom.xml Fri Jan 11 18:38:22 2008
@@ -100,5 +100,10 @@
             <artifactId>org.apache.geronimo.st.ui</artifactId>
             <version>${version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.devtools</groupId>
+            <artifactId>org.apache.geronimo.st.v11.ui</artifactId>
+            <version>${version}</version>
+        </dependency>
     </dependencies>
 </project>

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.classpath
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.classpath?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.classpath (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.classpath Fri Jan 11 18:38:22 2008
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.options
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.options?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.options (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.options Fri Jan 11 18:38:22 2008
@@ -0,0 +1 @@
+org.apache.geronimo.st.v21.core/debug=true
\ No newline at end of file

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.project
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.project?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.project (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/.project Fri Jan 11 18:38:22 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.apache.geronimo.st.v21.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/META-INF/MANIFEST.MF?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/META-INF/MANIFEST.MF (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/META-INF/MANIFEST.MF Fri Jan 11 18:38:22 2008
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Geronimo v21 Server Tools Core Plug-in
+Bundle-SymbolicName: org.apache.geronimo.st.v21.core;singleton:=true
+Bundle-Version: 2.1.0
+Bundle-Activator: org.apache.geronimo.st.v21.core.Activator
+Bundle-Vendor: Apache.org
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.wst.server.core,
+ org.eclipse.debug.core,
+ org.eclipse.wst.common.project.facet.core,
+ org.apache.geronimo.runtime.v21,
+ org.apache.geronimo.st.core,
+ org.eclipse.jst.common.frameworks,
+ org.eclipse.wst.common.modulecore,
+ org.apache.geronimo.v11.deployment.model
+Eclipse-LazyStart: true
+Export-Package: 
+ org.apache.geronimo.st.v21.core,
+ org.apache.geronimo.st.v21.core.internal,
+ org.apache.geronimo.st.v21.core.operations

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.properties?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.properties (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.properties Fri Jan 11 18:38:22 2008
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# $Rev: 583586 $ $Date: 2007-10-10 15:29:32 -0400 (Wed, 10 Oct 2007) $
+#
+pluginName=Geronimo Server Tools V21 Core Plug-in
+providerName=Apache Software Foundation
+
+runtimeTypeName=Apache Geronimo v2.1 Runtime
+runtimeTypeDescription=Apache Geronimo v2.1 supports Java EE 5.0.
+runtimeTypeVendor=Apache
+
+serverTypeName=Apache Geronimo v2.1 Server
+serverTypeDescription=Apache Geronimo v2.1 Server
+
+serverRootDirectory=Application Server Directory:
+port=Port:
+rmiport=RMI Naming Port:
+ejbport=EJB Port:
+adminId=Ad&ministrator Id:
+adminPassword=Administrator Password:
+classPath=Classpath Variable:
\ No newline at end of file

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.xml?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.xml (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/plugin.xml Fri Jan 11 18:38:22 2008
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!-- $Rev: 589873 $ $Date: 2007-10-29 17:48:35 -0400 (Mon, 29 Oct 2007) $ -->
+
+<plugin>
+
+
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Extend WTP runtimeTypes to include the new Geronimo runtime type                        -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
+    <extension point="org.eclipse.wst.server.core.runtimeTypes">
+        <runtimeType id="org.apache.geronimo.runtime.21" version="2.1"
+            name="%runtimeTypeName"
+            description="%runtimeTypeDescription"
+            vendor="%runtimeTypeVendor"
+            class="org.apache.geronimo.st.v21.core.GeronimoRuntime">
+            <moduleType types="jst.web"       versions="2.2, 2.3, 2.4, 2.5"/>
+            <moduleType types="jst.ejb"       versions="1.1, 2.0, 2.1, 3.0"/>
+            <moduleType types="jst.connector" versions="1.0, 1.5"/>
+            <moduleType types="jst.ear"       versions="1.2, 1.3, 1.4, 5.0"/>
+            <moduleType types="jst.utility"   versions="1.0"/>
+        </runtimeType>
+    </extension>
+    
+
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Extend WTP serverTypes so that the new Geronimo server type can be asociated with the   -->
+    <!-- new Geronimo runtime type (defined above)                                               -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
+    <extension point="org.eclipse.wst.server.core.serverTypes">
+        <serverType id="org.apache.geronimo.server.21"
+            name="%serverTypeName"
+            description="%serverTypeDescription"
+            runtime="true"
+            class="org.apache.geronimo.st.v21.core.GeronimoServer"
+            initialState="stopped"
+            supportsRemoteHosts="true"
+            startTimeout="240000"
+            stopTimeout="30000"
+            startBeforePublish="true"
+            runtimeTypeId="org.apache.geronimo.runtime.21"
+            launchConfigId="org.apache.geronimo.st.core.launchConfigurationType"
+            behaviourClass="org.apache.geronimo.st.v21.core.GeronimoServerBehaviour"
+            hasConfiguration="false"
+            launchModes="run,debug,profile">
+        </serverType>
+    </extension>
+    
+    
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Extend WTP installableRuntimes so that the new Geronimo server or runtime type          -->
+    <!-- can be discovered via the GeronimoRuntimeWizardFragment extension                       -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
+    <extension point="org.eclipse.wst.server.core.installableRuntimes">
+        <installableRuntime id="org.apache.geronimo.runtime.tomcat.21"
+            featureVersion="2.1.0"
+            featureId="org.apache.geronimo.installableruntime.tomcat.feature"
+            featureSite="http://www.apache.org/dist/geronimo/eclipse/updates/"
+            path="geronimo-tomcat6-jee5-2.1.0.zip">
+        </installableRuntime>
+        <installableRuntime id="org.apache.geronimo.runtime.jetty.21"
+            featureVersion="2.1.0"
+            featureId="org.apache.geronimo.installableruntime.jetty.feature"
+            featureSite="http://www.apache.org/dist/geronimo/eclipse/updates/"
+            path="geronimo-jetty6-jee5-2.1.0.zip">
+        </installableRuntime>
+    </extension>
+    
+
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Map the runtime-component (defined in plugins\org.apache.geronimo.st.core\plugin.xml)   -->
+    <!-- to the new Geronimo runtime type (defined above)                                        -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
+    <extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
+        <runtimeFacetMapping
+            runtimeTypeId="org.apache.geronimo.runtime.21"
+            runtime-component="org.apache.geronimo.runtime" version="2.1"/>
+    </extension>
+    
+
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Declare the 2.1 version of the "Geronimo Deployment" <project-facet> and the <action>   -->
+    <!-- that the user can perform on the facet (i.e., install)                                  -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
+    <!-- 
+    <extension point="org.eclipse.wst.common.project.facet.core.facets">
+        <project-facet-version facet="org.apache.geronimo.facet" version="2.1">
+            <action type="install" id="geronimo.plan.install">
+                <delegate class="org.apache.geronimo.st.v21.core.operations.GeronimoV21FacetInstallDelegate"/>
+                <config-factory class="org.apache.geronimo.st.v21.core.DeploymentPlanInstallConfig$Factory"/>
+            </action>
+            <constraint>
+                <or>
+                    <requires facet="jst.ear" version="1.2"/>
+                    <requires facet="jst.ear" version="1.3"/>
+                    <requires facet="jst.ear" version="1.4"/>
+                    <requires facet="jst.ear" version="1.4"/>
+                    <requires facet="jst.ear" version="5.0"/>
+                    <requires facet="jst.appclient" version="1.2"/>
+                    <requires facet="jst.appclient" version="1.3"/>
+                    <requires facet="jst.appclient" version="1.4"/>
+                    <requires facet="jst.connector" version="1.0"/>
+                    <requires facet="jst.connector" version="1.5"/>
+                    <requires facet="jst.ejb" version="1.1"/>
+                    <requires facet="jst.ejb" version="2.0"/>
+                    <requires facet="jst.ejb" version="2.1"/>
+                    <requires facet="jst.ejb" version="3.0"/>
+                    <requires facet="jst.web" version="2.2"/>
+                    <requires facet="jst.web" version="2.3"/>
+                    <requires facet="jst.web" version="2.4"/>
+                    <requires facet="jst.web" version="2.5"/>
+                    <requires facet="jst.utility" version="1.0"/>
+                </or>
+            </constraint>
+        </project-facet-version>
+    </extension>
+    -->
+    
+
+    <!-- ======================================================================================= -->
+    <!--                                                                                         -->
+    <!-- Map the <runtime-component> (defined in org.apache.geronimo.st.core\plugin.xml) to a    -->
+    <!-- specific version of the "Geronimo Deployment" <project-facet>. Note that the 1.1        -->
+    <!-- version is the only supported <project-facet-version> for the 2.1 Geronimo server.      -->
+    <!--                                                                                         -->
+    <!-- ======================================================================================= -->
+    <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets"
+        id="org.apache.geronimo.defaultFacets"
+        name="Geronimo Default Facets">
+        <default-facets>
+            <runtime-component id="org.apache.geronimo.runtime" version="2.1"/>
+            <facet id="org.apache.geronimo.facet" version="1.1"/>
+        </default-facets>
+    </extension>
+
+</plugin>

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/pom.xml?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/pom.xml (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/pom.xml Fri Jan 11 18:38:22 2008
@@ -0,0 +1,92 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<!-- $Rev: 609739 $ $Date: 2008-01-07 13:54:14 -0500 (Mon, 07 Jan 2008) $ -->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.geronimo.st.v21.core</artifactId>
+    <packaging>jar</packaging>
+    <name>${artifactId}</name>
+    <parent>
+        <groupId>org.apache.geronimo.devtools</groupId>
+        <artifactId>eclipse-plugins-parent</artifactId>
+        <version>2.1.0</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <build>
+        <resources>
+            <resource>
+                <directory>.</directory>
+                <includes>
+                    <include>plugin.xml</include>
+                    <include>plugin.properties</include>
+                    <include>.options</include>
+                </includes>
+            </resource>
+            <resource>
+                <targetPath>META-INF</targetPath>
+                <directory>..</directory>
+                <includes>
+                    <include>LICENSE</include>
+                    <include>NOTICE</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.geronimo.devtools</groupId>
+                <artifactId>maven-eclipsepde-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <artifactId>maven-dependency-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.devtools</groupId>
+            <artifactId>eclipse</artifactId>
+            <version>${version}</version>
+            <type>pom</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.devtools</groupId>
+            <artifactId>org.apache.geronimo.st.core</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.devtools</groupId>
+            <artifactId>org.apache.geronimo.runtime.v21</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.devtools</groupId>
+            <artifactId>org.apache.geronimo.runtime.common</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.devtools</groupId>
+            <artifactId>org.apache.geronimo.v11.deployment.model</artifactId>
+            <version>${version}</version>
+        </dependency>
+    </dependencies>
+</project>

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/Activator.java?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/Activator.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/Activator.java Fri Jan 11 18:38:22 2008
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @version $Rev: 499184 $ $Date: 2007-01-23 18:36:18 -0500 (Tue, 23 Jan 2007) $
+ */
+public class Activator extends Plugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.apache.geronimo.st.v21.core";
+
+	// The shared instance
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+	
+	public static void log(int severity, String message, Throwable throwable) {
+		plugin.getLog().log(new Status(severity, PLUGIN_ID, 0, message, throwable));
+	}
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/DeploymentPlanInstallConfig.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/DeploymentPlanInstallConfig.java?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/DeploymentPlanInstallConfig.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/DeploymentPlanInstallConfig.java Fri Jan 11 18:38:22 2008
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import org.apache.geronimo.st.v21.core.internal.Trace;
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+
+/**
+ * @version $Rev: 588513 $ $Date: 2007-10-26 00:14:23 -0400 (Fri, 26 Oct 2007) $
+ */
+public class DeploymentPlanInstallConfig {
+	
+	private String groupId;
+	
+	private String artifactId;
+	
+	private String version;
+	
+	private String type;
+	
+	private boolean sharedLib;
+	
+    public static final class Factory implements IActionConfigFactory
+    {
+        public Object create()
+        {
+        	Trace.trace("Entry/Exit", "DeploymentPlanInstallConfig.create");
+            return new DeploymentPlanInstallConfig();
+        }
+    }
+
+	public String getArtifactId() {
+		return artifactId;
+	}
+
+	public void setArtifactId(String artifactId) {
+		this.artifactId = artifactId;
+	}
+
+	public String getGroupId() {
+		return groupId;
+	}
+
+	public void setGroupId(String groupId) {
+		this.groupId = groupId;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getVersion() {
+		return version;
+	}
+
+	public void setVersion(String version) {
+		this.version = version;
+	}
+
+	public boolean isSharedLib() {
+		return sharedLib;
+	}
+
+	public void setSharedLib(boolean sharedLib) {
+		this.sharedLib = sharedLib;
+	}
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoRuntime.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoRuntime.java?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoRuntime.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoRuntime.java Fri Jan 11 18:38:22 2008
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.st.core.GeronimoRuntimeDelegate;
+import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
+import org.apache.geronimo.xbeans.geronimo.GerConnectorType;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerApplicationDocument;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerApplicationType;
+import org.apache.geronimo.xbeans.geronimo.web.GerWebAppDocument;
+import org.apache.geronimo.xbeans.geronimo.web.GerWebAppType;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * @version $Rev: 509678 $ $Date: 2007-02-20 12:43:17 -0500 (Tue, 20 Feb 2007) $
+ */
+public class GeronimoRuntime extends GeronimoRuntimeDelegate {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoRuntime#fixGeronimoConnectorSchema(org.eclipse.core.resources.IFile)
+	 */
+	public XmlObject fixGeronimoConnectorSchema(IFile plan) throws XmlException {
+            XmlObject xmlplan = getXmlObject(plan);
+            if (plan != null) {
+                SchemaConversionUtils.fixGeronimoSchema(xmlplan, GerConnectorDocument.type.getDocumentElementName(),
+                    GerConnectorType.type);
+                save(xmlplan, plan);
+            }	
+            return xmlplan;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoRuntime#fixGeronimoEarSchema(org.eclipse.core.resources.IFile)
+	 */
+	public XmlObject fixGeronimoEarSchema(IFile plan) throws XmlException {
+            XmlObject xmlplan = getXmlObject(plan);
+            if (plan != null) {
+                SchemaConversionUtils.fixGeronimoSchema(xmlplan, GerApplicationDocument.type.getDocumentElementName(),
+                    GerApplicationType.type);
+                save(xmlplan, plan);
+            }
+            return xmlplan;
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoRuntime#fixGeronimoEjbSchema(org.eclipse.core.resources.IFile)
+	 */
+	public XmlObject fixGeronimoEjbSchema(IFile plan) throws XmlException {
+            XmlObject xmlplan = getXmlObject(plan);
+            //FIXME
+            /*if (plan != null) {
+                SchemaConversionUtils.fixGeronimoSchema(xmlplan, OpenejbOpenejbJarDocument.type.getDocumentElementName(), OpenejbOpenejbJarType.type);
+                save(xmlplan, plan);
+            }*/
+            return xmlplan;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoRuntime#fixGeronimoWebSchema(org.eclipse.core.resources.IFile)
+	 */
+	public XmlObject fixGeronimoWebSchema(IFile plan) throws XmlException {
+            XmlObject xmlplan = getXmlObject(plan);
+            if (plan != null) {
+                SchemaConversionUtils.fixGeronimoSchema(xmlplan, GerWebAppDocument.type.getDocumentElementName(),
+                    GerWebAppType.type);
+                save(xmlplan, plan);
+            }
+            return xmlplan; 
+	}
+	
+	private XmlObject getXmlObject(IFile plan) {
+		if (plan.exists()) {
+			try {
+				return XmlBeansUtil.parse(plan.getLocation().toFile().toURL(), null);
+			} catch (MalformedURLException e) {
+				e.printStackTrace();
+			} catch (IOException e) {
+				e.printStackTrace();
+			} catch (XmlException e) {
+				e.printStackTrace();
+			}
+		}
+		return null;
+	}
+
+ 	private void save(XmlObject object, IFile file) {
+        try {
+ 	        object.save(file.getLocation().toFile());
+ 	        file.refreshLocal(IFile.DEPTH_ONE, null);
+ 	    } catch (IOException e) {
+ 	          e.printStackTrace();
+ 	    } catch (CoreException e) {
+ 		     e.printStackTrace();
+ 	    }
+ 	}
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoServer.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoServer.java?rev=611355&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoServer.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/org/apache/geronimo/st/v21/core/GeronimoServer.java Fri Jan 11 18:38:22 2008
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import java.io.File;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
+import org.apache.geronimo.st.core.GeronimoRuntimeDelegate;
+import org.apache.geronimo.st.core.GeronimoServerDelegate;
+import org.apache.geronimo.st.core.IGeronimoVersionHandler;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.LibraryLocation;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.util.SocketUtil;
+
+/**
+ * @version $Rev: 554980 $ $Date: 2007-07-10 11:35:58 -0400 (Tue, 10 Jul 2007) $
+ */
+public class GeronimoServer extends GeronimoServerDelegate {
+
+    public static final String PROPERTY_IN_PLACE_SHARED_LIB = "inPlaceSharedLib";
+    public static final String PROPERTY_RUN_FROM_WORKSPACE = "runFromWorkspace";
+
+    private static IGeronimoVersionHandler versionHandler = null;
+
+    private static DeploymentFactory deploymentFactory;
+
+    static {
+        deploymentFactory = new DeploymentFactoryImpl();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.GenericGeronimoServer#getContextRoot(org.eclipse.wst.server.core.IModule)
+     */
+    public String getContextRoot(IModule module) {
+        return GeronimoV21Utils.getContextRoot(module);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getDeployerURL()
+     */
+    public String getDeployerURL() {
+        return "deployer:geronimo:jmx://" + getServer().getHost() + ":" + getRMINamingPort();
+    }
+
+    @Override
+    public String getVMArgs() {
+        String runtimeLocation = getServer().getRuntime().getLocation().toString();
+        GeronimoRuntimeDelegate geronimoRuntimeDelegate = (GeronimoRuntimeDelegate) getServer().getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
+        if (geronimoRuntimeDelegate == null) {
+            geronimoRuntimeDelegate = (GeronimoRuntimeDelegate) getServer().getRuntime().loadAdapter(GeronimoRuntimeDelegate.class,new NullProgressMonitor());
+        }
+        IVMInstall vmInstall = geronimoRuntimeDelegate.getVMInstall();
+        String vmInstallLocation = vmInstall.getInstallLocation().getAbsolutePath() + "/jre";
+
+        LibraryLocation[] libLocations = JavaRuntime.getLibraryLocations(vmInstall);
+        IPath vmLibDir = null;
+        for(int i = 0; i < libLocations.length; i++) {
+            LibraryLocation loc = libLocations[i];
+            IPath libDir = loc.getSystemLibraryPath().removeLastSegments(2);
+            if(libDir.toOSString().endsWith("lib")) {
+                vmLibDir = libDir;
+                break;
+            }
+        }
+
+        String cp = System.getProperty("path.separator");
+
+        //-javaagent:"GERONIMO_BASE/bin/jpa.jar"
+        String javaagent = "";
+        File jpaJar = new File(runtimeLocation + "/bin/jpa.jar");
+        if (jpaJar.exists()) {
+            javaagent = "-javaagent:\"" + runtimeLocation + "/bin/jpa.jar\"";
+        }
+
+        //-Djava.ext.dirs="GERONIMO_BASE/lib/ext;JRE_HOME/lib/ext"
+        String javaExtDirs = "-Djava.ext.dirs=\"" + runtimeLocation + "/lib/ext" + cp + vmLibDir.append("ext").toOSString() + "\"";
+
+        //-Djava.endorsed.dirs="GERONIMO_BASE/lib/endorsed;JRE_HOME/lib/endorsed"
+        String javaEndorsedDirs = "-Djava.endorsed.dirs=\"" + runtimeLocation + "/lib/endorsed" + cp + vmLibDir.append("endorsed").toOSString() + "\"";
+
+        //-Dorg.apache.geronimo.base.dir="GERONIMO_BASE"
+        String baseDir = "-Dorg.apache.geronimo.base.dir=" + runtimeLocation;
+
+        String vmArgs = javaagent + " " + javaExtDirs + " " + javaEndorsedDirs;
+
+        String superVMArgs = super.getVMArgs();
+        if (superVMArgs != null) {
+            vmArgs += " " + superVMArgs;
+        }
+
+        return vmArgs;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getJMXServiceURL()
+     */
+    public String getJMXServiceURL() {
+        String host = getServer().getHost();
+        return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + getRMINamingPort() + "/JMXConnector";
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getJSR88DeployerJar()
+     */
+    public IPath getJSR88DeployerJar() {
+        return getServer().getRuntime().getLocation().append("/lib/jsr88-deploymentfactory.jar");
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getDeploymentFactory()
+     */
+    public DeploymentFactory getDeploymentFactory() {
+        return deploymentFactory;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#configureDeploymentManager(javax.enterprise.deploy.spi.DeploymentManager)
+     */
+    public void configureDeploymentManager(DeploymentManager dm) {
+        ((JMXDeploymentManager) dm).setLogConfiguration(true, true);
+        boolean enableInPlace = SocketUtil.isLocalhost(getServer().getHost()) && isRunFromWorkspace();
+        setInPlaceDeployment(dm, enableInPlace);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getVersionHandler()
+     */
+    public IGeronimoVersionHandler getVersionHandler() {
+        if (versionHandler == null)
+            versionHandler = new GeronimoV21VersionHandler();
+        return versionHandler;
+    }
+
+    public void setInPlaceDeployment(DeploymentManager dm, boolean enable) {
+        ((JMXDeploymentManager) dm).setInPlace(enable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.IGeronimoServer#isInPlace()
+     */
+    public boolean isInPlaceSharedLib() {
+        return getAttribute(PROPERTY_IN_PLACE_SHARED_LIB, false);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.IGeronimoServer#isRunFromWorkspace()
+     */
+    public boolean isRunFromWorkspace() {
+        return getAttribute(PROPERTY_RUN_FROM_WORKSPACE, false);
+    }
+
+    public void setInPlaceSharedLib(boolean enable) {
+        setAttribute(PROPERTY_IN_PLACE_SHARED_LIB, enable);
+    }
+
+    public void setRunFromWorkspace(boolean enable) {
+        setAttribute(PROPERTY_RUN_FROM_WORKSPACE, enable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.GeronimoServerDelegate#setDefaults(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public void setDefaults(IProgressMonitor monitor) {
+        super.setDefaults(monitor);
+        setInPlaceSharedLib(false);
+        setRunFromWorkspace(false);
+    }
+
+}
\ No newline at end of file



Mime
View raw message