2
0
Fork 0

Removed eclipse settings.

This commit is contained in:
Willem Cazander 2012-05-07 16:28:50 +02:00
parent c23d14522f
commit 2872143028
130 changed files with 175 additions and 982 deletions

View file

@ -33,7 +33,6 @@ import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
import net.forwardfire.vasc.demo.tech.web.core.TomcatManager;
import net.forwardfire.vasc.frontend.VascFrontendData;
import net.forwardfire.vasc.frontends.web.jsf.AbstractJSFVascFacesControllerBase;
import net.forwardfire.vasc.impl.DefaultVascFactory;
@ -82,7 +81,20 @@ public class VascFacesController extends AbstractJSFVascFacesControllerBase {
@Override
public VascController getVascController() {
return TomcatManager.getInstance().getVascController();
// TODO: rm this by making common tech vasc package ?
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = this.getClass().getClassLoader(); // fallback
}
Class<?> clazz = cl.loadClass("net.forwardfire.vasc.demo.tech.ui.TechUI");
Object instance = clazz.getMethod("getInstance").invoke(null);
Object vasc = clazz.getMethod("getVascController").invoke(instance);
return (VascController)vasc;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View file

@ -1,57 +0,0 @@
package net.forwardfire.vasc.demo.tech.web.core;
import java.io.File;
import net.forwardfire.vasc.core.VascController;
import org.apache.catalina.startup.Tomcat;
public class TomcatManager {
private Tomcat tomcat = null;
private VascController vascController = null;
public void start() throws Exception {
String webappDirLocation = "../vasc-demo-tech-web/src/main/webapp/";
Tomcat tomcat = new Tomcat();
String webPort = System.getenv("PORT");
if(webPort == null || webPort.isEmpty()) {
webPort = "8899";
}
tomcat.setPort(Integer.valueOf(webPort));
tomcat.addWebapp("/demo", new File(webappDirLocation).getAbsolutePath());
System.out.println("configuring app with basedir: " + new File("./" + webappDirLocation).getAbsolutePath());
instance = this;
tomcat.start();
}
public void stop() throws Exception {
if (tomcat==null) {
return;
}
tomcat.stop();
instance = null;
}
static private TomcatManager instance = null;
static public TomcatManager getInstance() {
return instance; // hackje to rm mvn 1-1 dep with ui
}
/**
* @return the vascController
*/
public VascController getVascController() {
return vascController;
}
/**
* @param vascController the vascController to set
*/
public void setVascController(VascController vascController) {
this.vascController = vascController;
}
}