
org.openxma.rwt.bridge.BootruntimeDeployer Maven / Gradle / Ivy
The newest version!
package org.openxma.rwt.bridge;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Properties;
import javax.servlet.ServletContext;
public class BootruntimeDeployer extends Deployer {
public BootruntimeDeployer(ServletContext context) {
super(context);
}
public void deploy() {
System.out.println("OpenxmaFrameworkLauncher.deploy()...");
/* Disable the busy indicator in order to avoid a method call which is not implemented
* in RWT (org.eclipse.swt.widgets.Display.getMessageCount()). Furthermore RWT has its own busy
* indicator which can cover also the remove call waiting time.
*/
System.setProperty("disableBusyShellForRemoteCall","true");
File servletTemp = (File) context.getAttribute("javax.servlet.context.tempdir");
File platformDirectory = new File(servletTemp, "openxma"); //$NON-NLS-1$
if (!platformDirectory.exists()) {
platformDirectory.mkdirs();
}
System.out.println("OpenxmaFrameworkLauncher plattformdirectory = "+platformDirectory);
String openxmaBase = RESOURCE_BASE + "openxma/";
copyResource(openxmaBase + "settings/", new File(platformDirectory, "settings")); //$NON-NLS-1$ //$NON-NLS-2$
copyResource(openxmaBase + "swt/", new File(platformDirectory, "swt")); //$NON-NLS-1$ //$NON-NLS-2$
copyResource(openxmaBase + "swt/none/", new File(platformDirectory, "swt/none")); //$NON-NLS-1$ //$NON-NLS-2$
copyResource(openxmaBase + "xma_bootrt/", new File(platformDirectory, "xma_bootrt")); //$NON-NLS-1$ //$NON-NLS-2$
createSettingsFile(platformDirectory.getAbsolutePath());
// TODO: Refacture bootruntime so that this jar file here is not needed (is alreads in web-inf/lib directoy)
// (Maybe upgrade to the head version is does is fix)
copyResource(openxmaBase + "xma_bootrt/xmacom.jar", new File(platformDirectory+"/xma_bootrt","xmacom.jar")); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("OpenxmaFrameworkLauncher.deploy() finished.");
System.out.println("Property: xma.boot.homedir = "+System.getProperty("xma.boot.homedir"));
System.setProperty("xma.boot.homedir",platformDirectory.getAbsolutePath());
System.out.println("Property changed to: xma.boot.homedir = "+System.getProperty("xma.boot.homedir"));
}
public static void createSettingsFile(String platformDirectory) {
String propertyFileName = platformDirectory+"/settings/bootcfg.properties";
Properties props = new Properties();
props.put("boot.log.level", "FINE");
props.put("boot.datapath", platformDirectory);
props.put("boot.swt.basedir", platformDirectory+"/swt");
props.put("boot.swt.version", "none");
props.put("boot.xmasubdir", platformDirectory+"/xma_bootrt");
props.put("boot.xmacom.jar", platformDirectory+"/xma_bootrt/xmacom.jar");
props.put("boot.installdir", platformDirectory);
props.put("defaultComponentUrl", "http://localhost:8080/CustomerDemo/CustomerComponent");
props.put("boot.transport.defaultimpl", "org.openxma.rwt.bridge.RwtHttpTransport");
String xmaFdmDir = System.getProperty("xma.fdm.dir");
if (xmaFdmDir != null && xmaFdmDir.trim().length()>0) {
props.put("boot.fdm","true");
props.put("boot.fdm.classes",xmaFdmDir);
System.out.println("BootruntimeDeployer: fdm directory = "+xmaFdmDir+" (defined in system property 'xma.fdm.dir')");
} else {
String bootFdm = System.getProperty("boot.fdm");
if (bootFdm != null && bootFdm.trim().equalsIgnoreCase("true")) {
props.put("boot.fdm","true");
/* locate the default (maven) classes directory */
File platformDirFile = new File(platformDirectory);
File targetDirFile = platformDirFile.getParentFile().getParentFile();
File classesDirFile = new File(targetDirFile,"classes");
String defaultFdmDir = classesDirFile.getAbsolutePath();
props.put("boot.fdm.classes",defaultFdmDir);
System.out.println("BootruntimeDeployer: fdm directory = "+defaultFdmDir+" (activated with system property 'boot.fdm')");
}
}
try {
props.store(new FileOutputStream(new File(propertyFileName)), "");
} catch (Exception e) {
throw new RuntimeException("Can not create bootcfg.properties: "+propertyFileName);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy