| D:\DEV\PROJECTS\Harbor_dB_Demo_Ship\src\harbor_db_demo_ship\CD_Unit.java |
package harbor_db_demo_ship;
import harbor.dbDemo.app.ui.interfaces.*;
import harbor.dbDemo.app.srvr.interfaces.I_Visitor_Processor;
import kewlstuff.pojopersist.interfaces.I_FlexiBean;
import kewlstuff.harbor.client.Vessel;
public class CD_Unit implements I_CD_Unit{
private I_UI i_UIControl = null;
private I_Visitor_Processor i_Visitor_Processor = null;
private Vessel vessel = null;
public CD_Unit() {
String harborUrl = "http://localhost:8080/harbor/service";
Vessel.loadUserConfig();
String harborTestUrl = Vessel.getUserProperty("HARBOR_SITE_URL");
if(harborTestUrl != null){
Vessel.setLocalAdminLogMessage("URL environment variable set to " + harborTestUrl);
harborUrl = harborTestUrl;
javax.swing.JOptionPane.showMessageDialog(null,harborUrl, "URL Setting in config file", javax.swing.JOptionPane.INFORMATION_MESSAGE);
}
vessel = new Vessel(harborUrl);
vessel.enableProgressDisplay(true);
}
public void startViewForm(){
Class uiApp = vessel.getRemoteClass("harbor.dbDemo.app.ui.View_Form");
if(uiApp != null){
I_UI i_UI = (I_UI)vessel.newInst(uiApp);
i_UI.start(this);
}
}
public void startEntryForm(){
Class uiApp = vessel.getRemoteClass("harbor.dbDemo.app.ui.Entry_Form");
if(uiApp != null){
I_UI i_UI = (I_UI)vessel.newInst(uiApp);
i_UI.start(this);
}
}
public void startControlForm(){
if(i_UIControl == null){
Class uiApp = vessel.getRemoteClass("harbor.dbDemo.app.ui.Control_Panel");
if(uiApp != null) i_UIControl = (I_UI)vessel.newInst(uiApp);
}
i_UIControl.start(this);
}
public boolean addVisitorMessageToDb(String sName, String sMessage){
if(i_Visitor_Processor == null) return false;
return i_Visitor_Processor.addVisitorMessageToDb(sName,sMessage);
}
public I_FlexiBean[] getVisitorFromDb(long startPosition, int limitRecords, boolean forwardDirection){
if(i_Visitor_Processor == null) return null;
return i_Visitor_Processor.getVisitorFromDb(startPosition, limitRecords, forwardDirection);
}
public I_FlexiBean[] getMessagesFromDb(long visitorID){
if(i_Visitor_Processor == null) return null;
return i_Visitor_Processor.getMessagesFromDb(visitorID);
}
public void start(){
i_Visitor_Processor = (I_Visitor_Processor)vessel.loadRemoteSingleton(I_Visitor_Processor.class,"harbor.dbDemo.app.srvr.Visitor_Processor","VISITOR_DB_DEMO");
if(i_Visitor_Processor == null){ System.out.print("Class does not exist or connection problems\n"); return;}
startControlForm();
}
public static void main(String[] args) {
new CD_Unit().start();
}
}