001: package org.enhydra.kelp.eclipse.ui.launcher;
002:
003: import org.eclipse.core.runtime.CoreException;
004: import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
005: import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
006: import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
007: import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
008: import org.enhydra.tool.ToolBoxInfo;
009:
010: import java.io.File;
011:
012: /**
013: * @author Administrator
014: *
015: * To change this generated comment edit the template variable "typecomment":
016: * Window>Preferences>Java>Templates.
017: * To enable and disable the creation of type comments go to
018: * Window>Preferences>Java>Code Generation.
019: */
020: public class EnhydraEnterpriseJOnASArgumentsTab extends
021: JavaArgumentsTab {
022:
023: private static final String ENHYDRA_PROGRAM_ARGUMENTS = "org.objectweb.jonas.server.Server";
024:
025: /**
026: * Constructor for EnhydraEnterpriseJOnASArgumentsTab.
027: */
028: public EnhydraEnterpriseJOnASArgumentsTab() {
029: super ();
030: }
031:
032: /**
033: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
034: */
035: public void setDefaults(
036: ILaunchConfigurationWorkingCopy configuration) {
037: super .setDefaults(configuration);
038:
039: String progArgs = "";
040: String prjName = "";
041:
042: try {
043: //24.03.2003
044: File path = new File(ToolBoxInfo.getEnhydraRoot());
045: path = path.getParentFile();
046: String enhydraRoot = path.getAbsolutePath();
047:
048: //configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-cp " + enhydraRoot + File.separator + "lib" + File.separator + "common" + File.separator + "ow_jonas_bootstrap.jar");
049:
050: String args = "-Dinstall.root="
051: + enhydraRoot
052: + "\n-Djonas.base="
053: + "application"
054: + File.separator
055: + "bin"
056: + File.separator
057: + "application"
058: + "\n-Djava.security.policy="
059: + enhydraRoot
060: + File.separator
061: + "conf"
062: + File.separator
063: + "java.policy"
064: + "\n-Djonas.classpath="
065: + "\n-Djonas.default.classloader=true"
066: + "\n-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB"
067: + "\n-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton"
068: + "\n-Dorg.omg.PortableInterceptor.ORBInitializerClass.standard_init=org.jacorb.orb.standardInterceptors.IORInterceptorInitializer"
069: + "\n-Djavax.rmi.CORBA.PortableRemoteObjectClass=org.objectweb.carol.rmi.multi.MultiPRODelegate"
070: + "\n-Djava.naming.factory.initial=org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory"
071: + "\n-Djava.security.auth.login.config="
072: + enhydraRoot
073: + File.separator
074: + "conf"
075: + File.separator
076: + "jaas.config"
077: + "\n-Djava.rmi.server.RMIClassLoaderSpi=org.objectweb.jonas.server.RemoteClassLoaderSpi";
078:
079: configuration
080: .setAttribute(
081: IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
082: args);
083:
084: //String classPath = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, EMPTY_STRING);
085: //classPath = classPath + File.pathSeparator + enhydraRoot + File.separator + "lib" + File.separator + "ext" + File.separator + "entray.jar";
086: //configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classPath);
087: //configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, classPath);
088:
089: // Program arguments defaults to ENHYDRA_PROGRAM_ARGUMENTS
090: progArgs = configuration
091: .getAttribute(
092: IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
093: EMPTY_STRING);
094: if (progArgs.compareTo(ENHYDRA_PROGRAM_ARGUMENTS) != 0)
095: configuration
096: .setAttribute(
097: IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
098: ENHYDRA_PROGRAM_ARGUMENTS);
099:
100: // Work directory defaults to <project name>/output
101: //workDir = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, EMPTY_STRING);
102:
103: if (progArgs.compareTo(EMPTY_STRING) == 0) {
104: prjName = configuration
105: .getAttribute(
106: IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
107: EMPTY_STRING);
108: configuration
109: .setAttribute(
110: IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
111: prjName);
112: }
113: } catch (CoreException e) {
114: JDIDebugUIPlugin.log(e);
115: }
116: }
117:
118: }
|