Initial commit from SVN.

This commit is contained in:
wcrisman
2014-05-30 10:31:51 -07:00
commit b45e56b890
1968 changed files with 370949 additions and 0 deletions

View File

@@ -0,0 +1,183 @@
package com.foundation.web.manager.application;
import java.io.File;
import com.common.debug.*;
import com.common.io.StreamSupport;
import com.common.orb.IInvalidProxyListener;
import com.common.orb.Orb;
import com.common.thread.*;
import com.common.util.*;
import com.de22.orb.optional.ServerSocketOptions;
import com.de22.orb.optional.SocketOptions;
import com.de22.orb.Address;
import com.foundation.util.*;
import com.foundation.util.xml.DocumentBuilder;
import com.foundation.util.xml.IDocument;
import com.foundation.util.xml.INode;
import com.foundation.view.*;
import com.foundation.controller.*;
import com.foundation.application.Application;
import com.foundation.view.resource.ResourceService;
import com.foundation.view.swt.SwtViewContext;
import com.foundation.web.manager.controller.ServerController;
import com.foundation.web.manager.model.Server;
import com.foundation.web.monitor.shared.IManagerConnector;
import com.foundation.web.monitor.shared.IWebServerInterface;
import com.foundation.transaction.TransactionService;
/**
* The starting point for this application. In addition to kicking things off, the application class manages the basic services used by other application components.
* <p>Notes for running on OSX: Prevent the main thread from ever dieing (see main method); Add -XstartOnFirstThread to the run command (VM Argument).</p>
*/
public class WebServerManagerApplication extends Application {
/** The property name that determines whether we generate proxies. This should only be true during development. */
public static final String PROPERTY_GENERATE_PROXIES = "generate.proxies";
private static final WebServerManagerApplication singleton = new WebServerManagerApplication();
/** The base directory for the application. This allows the directory to be modified as needed without affecting other setup code. */
private File baseDirectory = new File("./");
/**
* Starts the Foundation Web Server Manager application.
* @param args None expected.
*/
public static void main(String[] args) {
//Setup the debug log.//
Debug.setLog(new DefaultLog());
getSingleton().startup();
//Enable the wait for shutdown call on the Mac such that the main thread never dies.//
// getSingleton().waitForShutdown();
}//main()//
/**
* Gets the one and only instance of the application.
* @return The singleton instance.
*/
public static WebServerManagerApplication getSingleton() {
return singleton;
}//getSingleton()//
/**
* WebServerManagerApplication constructor.
*/
public WebServerManagerApplication() {
super();
}//WebServerManagerApplication()//
/**
* Gets the directory containing the application's resources.
* @return The file referencing the application's base path.
*/
public File getBaseDirectory() {
return baseDirectory;
}//getBaseDirectory()//
/**
* Sets the directory containing the application's resources.
* @param baseDirectory The file referencing the application's base path.
*/
public void setBaseDirectory(File baseDirectory) {
this.baseDirectory = baseDirectory == null ? new File("./") : baseDirectory;
}//setBaseDirectory()//
/* (non-Javadoc)
* @see com.foundation.application.Application#getDefaultRepositoryIdentifier()
*/
public Object getDefaultRepositoryIdentifier() {
return "APPDB";
}//getDefaultRepositoryIdentifier()//
/* (non-Javadoc)
* @see com.foundation.application.Application#getMetadataLocation()
*/
public Object getMetadataLocation() {
return new File(getBaseDirectory(), "metadata.xml");
}//getMetadataLocation()//
/* (non-Javadoc)
* @see com.foundation.application.Application#getResourcesPath()
*/
public File getResourcesPath() {
return getBaseDirectory() != null ? getBaseDirectory() : super.getResourcesPath();
}//getResourcesPath()//
/* (non-Javadoc)
* @see com.foundation.application.Application#initializeResources(com.foundation.view.resource.ResourceService)
*/
protected void initializeResources(ResourceService resourceService) {
}//initializeResources()//
/* (non-Javadoc)
* @see com.foundation.application.Application#internalShutdown()
*/
protected void internalShutdown() {
try {
ServerController.getSingleton().shutdown();
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
try {
Orb.shutdown();
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
try {
SwtViewContext.getSingleton().shutdown();
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
try {
Scheduler.shutdown();
ActiveScheduler.getSingleton().shutdown();
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
super.internalShutdown();
}//internalShutdown()//
/* (non-Javadoc)
* @see com.foundation.application.Application#startup()
*/
protected void startup() {
String generateProxiesProperty = System.getProperty(PROPERTY_GENERATE_PROXIES);
boolean generateProxies = (generateProxiesProperty != null) && ((generateProxiesProperty.equals("yes")) || (generateProxiesProperty.equals("on")) || (generateProxiesProperty.equals("true")));
//Setup the metadata service.//
setupMetadataService();
//Setup the resource service.//
setupResourceService();
// //Setup the transaction service.//
// setupTransactionService();
// getTransactionService().debug(TransactionService.DEBUG_ALL);
//Setup the ORB.//
Orb.setOrbWrapper(new com.de22.orb.optional.CommonOrbWrapper(generateProxies ? new com.de22.orb.development.OrbClassLoader(new File(getBaseDirectory(), "proxies")) : null, null, null));
try {
//Start the application specific code.//
startApplication();
}//try//
catch(Throwable e) {
//Log all errors that are not caught earlier in the program.//
Debug.log(e);
}//catch//
}//startup()//
/**
* Starts the actual application.
*/
private void startApplication() {
try {
//Run the view in the swt event loop so that any reflections it creates upon startup will be done in the correct thread.//
SwtViewContext.getSingleton().getRequestHandler().executeAsync(new com.common.thread.IRunnable() {
public Object run() {
com.foundation.web.manager.local.view.controller.MainViewController controller = new com.foundation.web.manager.local.view.controller.MainViewController(SwtViewContext.getSingleton(), ServerController.getSingleton().getServers());
controller.open();
return null;
}//run()//
});
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
}//startApplication()//
}//WebServerManagerApplication//

View File

@@ -0,0 +1,23 @@
package com.foundation.web.manager.controller;
import com.foundation.application.*;
import com.foundation.web.manager.application.*;
/**
* The base class for application controllers. Application controllers contain control logic not tied to a model or view. These classes probably need to be thread safe.
*/
public abstract class AbstractController extends com.foundation.controller.Controller {
/**
* AbstractController constructor.
*/
public AbstractController() {
super();
}//AbstractController()//
/**
* Gets the application object that this object is running under. The application object provides the object various services that it will need.
* @return The application reference for the application this object is running under.
*/
public IApplication getApplication() {
return WebServerManagerApplication.getSingleton();
}//getApplication()//
}//AbstractController//

View File

@@ -0,0 +1,304 @@
package com.foundation.web.manager.controller;
import java.io.File;
import com.common.debug.Debug;
import com.common.io.StreamSupport;
import com.common.orb.IInvalidProxyListener;
import com.common.orb.Orb;
import com.common.security.Sha512;
import com.common.thread.ActiveScheduler;
import com.common.thread.IRunnable;
import com.common.thread.Monitor;
import com.common.thread.Scheduler;
import com.common.util.ICollection;
import com.common.util.IIterator;
import com.common.util.LiteList;
import com.common.util.StringSupport;
import com.de22.orb.Address;
import com.de22.orb.optional.SocketOptions;
import com.foundation.util.CollectionChangeEvent;
import com.foundation.util.IManagedCollection;
import com.foundation.util.IManagedIndexedCollection;
import com.foundation.util.IManagedList;
import com.foundation.util.ListManager;
import com.foundation.util.ManagedList;
import com.foundation.util.xml.DocumentBuilder;
import com.foundation.util.xml.IDocument;
import com.foundation.util.xml.INode;
import com.foundation.view.swt.SwtViewContext;
import com.foundation.web.manager.application.WebServerManagerApplication;
import com.foundation.web.manager.model.Server;
import com.foundation.web.monitor.shared.IManagerConnector;
import com.foundation.web.monitor.shared.IWebServerInterface;
import com.foundation.attribute.SingleThreadedReflectionContext;
import com.foundation.event.EventSupport;
import com.foundation.event.IHandler;
import com.foundation.metadata.Attribute;
/**
* Manages the list of servers and connections to those servers.
*/
public class ServerController extends AbstractController {
public static final Attribute SERVERS = registerCollection(ServerController.class, "servers", AO_REFERENCED);
/** A context for creating an internal reflection of the list of servers for maintenance. */
private SingleThreadedReflectionContext context = new SingleThreadedReflectionContext();
/** The server XML file. */
private final File serverXml = new File(WebServerManagerApplication.getSingleton().getBaseDirectory(), "servers.xml");
/** A reflection of the list of server metadata. */
private ManagedList servers = null;
/** The runnable used to check the connection for each server and connect if not currently connected. */
private CancellableRunnable checkConnectionsRunnable;
/** The single instance of the class. */
private static ServerController singleton = new ServerController();
public static abstract class CancellableRunnable implements Runnable {
public volatile boolean cancel = false;
}//CancellableRunnable//
/**
* Gets the one and only instance.
* @return The single instance of this class.
*/
public static ServerController getSingleton() {
return singleton;
}//getSingleton()//
/**
* ServerController constructor.
*/
private ServerController() {
try {
ManagedList internalServers = new ManagedList(10, 100);
//Load the server data.//
if(serverXml.exists()) {
DocumentBuilder builder = new DocumentBuilder();
IDocument doc = builder.readDocument(StreamSupport.readText(serverXml, "UTF8"));
INode app = doc.findNode("app");
LiteList serverNodes = new LiteList(100);
app.findNodes("server", serverNodes);
for(int index = 0; index < serverNodes.getSize(); index++) {
INode next = (INode) serverNodes.get(index);
if(next.hasAttribute("name") && next.hasAttribute("address") && next.hasAttribute("user") && next.hasAttribute("password")) {
internalServers.add(new Server(next.getAttributeValue("name"), next.getAttributeValue("address"), next.getAttributeValue("user"), next.getAttributeValue("password")), CONTEXT_TRUSTED);
}//if//
}//for//
}//if//
else {
DocumentBuilder builder = new DocumentBuilder();
IDocument doc = builder.createDocument();
doc.createNode("app");
StreamSupport.writeText(builder.writeDocument(doc, "UTF8", false), serverXml, "UTF8");
}//else//
//Set the list of servers.//
setServers(internalServers);
//Create a reflection of the list of servers for maintaining connections and the server.xml.//
servers = (ManagedList) context.createReflection(internalServers);
context.initialize();
final ManagedList serverList = servers; //This is necessary to avoid a deadlock - though I am not sure why a deadlock is occuring upon accessing the attribute versus this final local variable.//
context.execute(new IRunnable() {
public Object run() {
//Register a listener with the server list reflection for add/remove type changes.//
//Note: Calling the attribute for the server list here seems to be deadlocking the app. Not sure why. The local variable serverList is a work around.//
serverList.registerListener(IManagedCollection.EVENT, new IHandler() {
public void evaluate(int eventNumber, Object[] eventParameters, int flags) {
//Note: Because this is inlined, we should already be in the context's thread.//
if(flags != EventSupport.FLAG_TRUSTED_CHANGE) {
//Re-write the list of server data to file.//
writeToFile();
}//if//
if(eventParameters.length > 0 && eventParameters[0] instanceof CollectionChangeEvent) {
CollectionChangeEvent event = (CollectionChangeEvent) eventParameters[0];
if(event.getRemovedObjects() != null) {
IIterator iterator = event.getRemovedObjects().iterator();
while(iterator.hasNext()) {
Server server = (Server) iterator.next();
disconnect(server);
}//while//
}//if//
else if(event.getRemovedObject() != null) {
Server server = (Server) event.getRemovedObject();
disconnect(server);
}//else if//
}//if//
}//evaluate()//
}, true);
return null;
}//run()//
});
//Setup the runnable that will check the server objects for connections to the servers, and connect those that are not connected.//
checkConnectionsRunnable = new CancellableRunnable() {
public void run() {
context.executeAsync(new IRunnable() {
public Object run() {
if(!cancel) {
for(int index = 0; index < servers.getSize(); index++) {
Server next = (Server) servers.get(index);
if(next.getWebServer() == null && next.getAddress() != null && next.getUser() != null && next.getPassword() != null) {
//Attempt to connect to the server.//
connect(next);
}//if//
}//for//
//Run this again in 15 seconds.//
ActiveScheduler.getSingleton().add(checkConnectionsRunnable, 15000);
}//if//
return null;
}//run()//
});
}//run()//
};
//Start the scheduler to run the check connections task.//
ActiveScheduler.getSingleton().add(checkConnectionsRunnable, 5000);
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
}//ServerController()//
/**
* Attempts to connect to the given server.
* @param server The server to connect to.
*/
private void connect(final Server server) {
try {
Object socketId = Orb.openSocket("ServerConnection_" + server.getAddress(), new SocketOptions(0, new Address[] {new Address(server.getAddress())}, null));
if(socketId != null) {
//Connect and login.//
IManagerConnector connector = (IManagerConnector) Orb.lookup(IManagerConnector.ORB_NAME, socketId);
IWebServerInterface webServer;
Sha512 hashAlgorithm = new Sha512();
long ts = System.currentTimeMillis();
byte[] tsBytes = new byte[8];
StreamSupport.writeLong(ts, tsBytes, 0);
hashAlgorithm.add(server.getPassword());
hashAlgorithm.add(tsBytes);
webServer = connector.login(server.getUser(), StringSupport.toHexString(hashAlgorithm.hash()), ts);
if(webServer == null) {
server.setStatus(server.STATUS_AUTH_FAILED);
server.setWebServer(null);
Orb.closeSocket(socketId);
context.synchronizeAll(null, true);
}//if//
else {
try {
server.setWebServer(webServer);
server.setStatus(server.STATUS_CONNECTED);
context.synchronizeAll(null, true);
//Listen for a connection failure.//
Orb.registerInvalidProxyListener(webServer, new IInvalidProxyListener() {
public void evaluate(Object proxy) {
context.executeAsync(new IRunnable() {
public Object run() {
server.setWebServer(null);
server.setStatus(server.STATUS_DISCONNECTED);
context.synchronizeAll(null, true);
return null;
}
});
}//evaluate()//
});
}//try//
catch(Throwable e) {
Debug.log(e);
server.setStatus(server.STATUS_DISCONNECTED);
server.setWebServer(null);
context.synchronizeAll(null, true);
}//catch//
}//else//
}//if//
}//try//
catch(Throwable e) {}
}//connect()//
/**
* Disconnects from the server.
* @param server The server to be disconnected.
*/
private void disconnect(Server server) {
IWebServerInterface webServer = server.getWebServer();
//Try to close the ORB's socket to the server.//
if(webServer != null) {
try {
Orb.closeSocket(Orb.getConnectionIdentifier(webServer));
}//try//
catch(Throwable e) {}
}//if//
server.setWebServer(null);
server.setStatus(server.STATUS_DISCONNECTED);
context.synchronizeAll(null, true);
}//disconnect()//
/**
* Writes the server list to file so the next run of the app will have all changes.
*/
private void writeToFile() {
try {
DocumentBuilder builder = new DocumentBuilder();
IDocument doc = builder.createDocument();
INode app = doc.createNode("app");
for(int index = 0; index < servers.getSize(); index++) {
Server server = (Server) servers.get(index);
if(server.getName() != null && server.getAddress() != null) {
INode next = app.createNode("server");
next.addAttribute("name", server.getName());
next.addAttribute("address", server.getAddress());
next.addAttribute("user", server.getUser());
next.addAttribute("password", server.getPassword());
}//if//
}//for//
StreamSupport.writeText(builder.writeDocument(doc, "UTF8", false), serverXml, "UTF8");
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
}//writeChanges()//
/**
* Shuts down the server controller. This must be called during the shutdown proceedure.
*/
public void shutdown() {
context.execute(new IRunnable() {
public Object run() {
checkConnectionsRunnable.cancel = true;
servers.removeAll(CONTEXT_TRUSTED);
context.release();
return null;
}//run()//
});
}//shutdown()//
/**
* Gets the servers value.
* @return The servers value.
*/
public IManagedList getServers() {
return (IManagedList) getAttributeValue(SERVERS);
}//getServers()//
/**
* Sets the servers value.
* @param servers The servers value.
*/
public void setServers(IManagedList servers) {
setAttributeValue(SERVERS, servers);
}//setServers()//
}//ServerController//

View File

@@ -0,0 +1,660 @@
package com.foundation.web.manager.local.view;
/**
* MainView
*/
public class MainView extends com.foundation.view.swt.Window implements com.foundation.view.IAssociationHandler {
//Component Names//
public static final String CONTROLLER_HOLDER_COMPONENT = "controllerHolder";
public static final String MAIN_COMPONENT = "main";
public static final String LEFT_COMPONENT = "left";
public static final String SERVER_LIST_COMPONENT = "serverList";
public static final String EDIT_SERVER_MENU_COMPONENT = "EditServerMenu";
public static final String REMOVE_SERVER_MENU_COMPONENT = "RemoveServerMenu";
public static final String RIGHT_COMPONENT = "right";
public static final String WEBAPP_TABLE_COMPONENT = "webappTable";
public static final String BOTTOM_COMPONENT = "bottom";
public static final String WEB_SERVER_LOG_COMPONENT = "webServerLog";
public static final String MAIN_VIEW_COMPONENT = "MainView";
//Association Identifiers//
protected static final int SERVER_LIST_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0 = 0;
protected static final int SERVER_LIST_COLUMN_PART1_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0 = 1;
protected static final int SERVER_LIST_ASSOCIATION_COLLECTION_ASSOCIATION_0 = 2;
protected static final int SERVER_LIST_ASSOCIATION_SELECTION_ASSOCIATION_0 = 3;
protected static final int WEBAPP_TABLE_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0 = 4;
protected static final int WEBAPP_TABLE_ASSOCIATION_COLLECTION_ASSOCIATION_0 = 5;
protected static final int WEBAPP_TABLE_ASSOCIATION_SELECTION_ASSOCIATION_0 = 6;
protected static final int WEB_SERVER_LOG_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0 = 7;
//Attribute Association Identifiers//
protected static final int SERVER_LIST_COLUMN_PART1_ASSOCIATION_COLUMN_CELL_TEXT_AA0_ATTRIBUTE_ASSOCIATION = 0;
//Method Association Identifiers//
protected static final int THIS_CLOSED_METHOD_ASSOCIATION = 0;
protected static final int SERVER_LIST_DOUBLE_CLICK_METHOD_ASSOCIATION = 1;
protected static final int SERVER_LIST_KEY_BINDING_43_0 = 2;
protected static final int SERVER_LIST_KEY_BINDING_82_0 = 3;
protected static final int SERVER_LIST_KEY_BINDING_16777225_0 = 4;
protected static final int SERVER_LIST_KEY_BINDING_45_0 = 5;
protected static final int SERVER_LIST_KEY_BINDING_8_0 = 6;
protected static final int SERVER_LIST_KEY_BINDING_127_0 = 7;
protected static final int UNNAMED_COMPONENT2_SELECTION_METHOD_ASSOCIATION = 8;
protected static final int EDIT_SERVER_MENU_SELECTION_METHOD_ASSOCIATION = 9;
protected static final int REMOVE_SERVER_MENU_SELECTION_METHOD_ASSOCIATION = 10;
protected static final int UNNAMED_COMPONENT3_SELECTION_METHOD_ASSOCIATION = 11;
protected static final int UNNAMED_COMPONENT4_SELECTION_METHOD_ASSOCIATION = 12;
protected static final int UNNAMED_COMPONENT6_SELECTION_METHOD_ASSOCIATION = 13;
protected static final int UNNAMED_COMPONENT7_SELECTION_METHOD_ASSOCIATION = 14;
protected static final int UNNAMED_COMPONENT8_SELECTION_METHOD_ASSOCIATION = 15;
protected static final int UNNAMED_COMPONENT9_SELECTION_METHOD_ASSOCIATION = 16;
protected static final int UNNAMED_COMPONENT10_SELECTION_METHOD_ASSOCIATION = 17;
//View Components//
private com.foundation.view.swt.ValueHolder controllerHolder = null;
private com.foundation.view.swt.Panel main = null;
private com.foundation.view.swt.Panel left = null;
private com.foundation.view.swt.SimpleTable serverList = null;
private com.foundation.view.swt.Menu unnamedComponent0 = null;
private com.foundation.view.swt.Menu unnamedComponent1 = null;
private com.foundation.view.swt.Menu unnamedComponent2 = null;
private com.foundation.view.swt.Menu EditServerMenu = null;
private com.foundation.view.swt.Menu RemoveServerMenu = null;
private com.foundation.view.swt.Menu unnamedComponent3 = null;
private com.foundation.view.swt.Menu unnamedComponent4 = null;
private com.foundation.view.swt.Panel right = null;
private com.foundation.view.swt.SimpleTable webappTable = null;
private com.foundation.view.swt.Menu unnamedComponent5 = null;
private com.foundation.view.swt.Menu unnamedComponent6 = null;
private com.foundation.view.swt.Menu unnamedComponent7 = null;
private com.foundation.view.swt.Menu unnamedComponent8 = null;
private com.foundation.view.swt.Menu unnamedComponent9 = null;
private com.foundation.view.swt.Menu unnamedComponent10 = null;
private com.foundation.view.swt.Panel bottom = null;
private com.foundation.view.swt.TextField webServerLog = null;
/**
* MainView default constructor.
* <p>Warning: This constructor is intended for use by the metadata service <b>only</b>. This constructor should <b>never</b> be called by the view's controller.</p>
*/
public MainView() {
}//MainView()//
/**
* MainView constructor.
* @param controller The view controller which will be assigned to the value holder(s) that don't depend on another value holder for their value.
*/
public MainView(com.foundation.controller.ViewController controller) {
super((com.foundation.controller.ViewController) controller.getParent(), MAIN_VIEW_COMPONENT, com.foundation.view.swt.Window.STYLE_SHELL_TRIM, controller.getContext(), controller);
}//MainView()//
public void initializeControllerHolder(com.foundation.view.swt.Container parent) {
controllerHolder = new com.foundation.view.swt.ValueHolder(parent, CONTROLLER_HOLDER_COMPONENT, com.foundation.web.manager.local.view.controller.MainViewController.class);
}//initializeControllerHolder()//
public void initializeServerListPopupMenu(com.foundation.view.IAbstractComponent parent) {
unnamedComponent0 = new com.foundation.view.swt.Menu(serverList, null, com.foundation.view.swt.Menu.STYLE_POPUP);
unnamedComponent1 = new com.foundation.view.swt.Menu(unnamedComponent0, null, com.foundation.view.swt.Menu.STYLE_CASCADE);
unnamedComponent1.setText("Modify");
unnamedComponent2 = new com.foundation.view.swt.Menu(unnamedComponent1, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent2.setText("Add Server..");
unnamedComponent2.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT2_SELECTION_METHOD_ASSOCIATION, unnamedComponent2, "controllerHolder", null, null));
EditServerMenu = new com.foundation.view.swt.Menu(unnamedComponent1, EDIT_SERVER_MENU_COMPONENT, com.foundation.view.swt.Menu.STYLE_PUSH);
EditServerMenu.setText("Edit Server");
EditServerMenu.setSelectionMethod(new com.foundation.view.MethodAssociation(this, EDIT_SERVER_MENU_SELECTION_METHOD_ASSOCIATION, EditServerMenu, "controllerHolder", null, null));
RemoveServerMenu = new com.foundation.view.swt.Menu(unnamedComponent1, REMOVE_SERVER_MENU_COMPONENT, com.foundation.view.swt.Menu.STYLE_PUSH);
RemoveServerMenu.setText("Remove Server");
RemoveServerMenu.setSelectionMethod(new com.foundation.view.MethodAssociation(this, REMOVE_SERVER_MENU_SELECTION_METHOD_ASSOCIATION, RemoveServerMenu, "controllerHolder", null, null));
unnamedComponent3 = new com.foundation.view.swt.Menu(unnamedComponent0, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent3.setText("Stop");
unnamedComponent3.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT3_SELECTION_METHOD_ASSOCIATION, unnamedComponent3, "controllerHolder", null, null));
unnamedComponent4 = new com.foundation.view.swt.Menu(unnamedComponent0, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent4.setText("Start");
unnamedComponent4.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT4_SELECTION_METHOD_ASSOCIATION, unnamedComponent4, "controllerHolder", null, null));
}//initializeServerListPopupMenu()//
public void initializeServerList(com.foundation.view.swt.Container parent) {
serverList = new com.foundation.view.swt.SimpleTable(parent, SERVER_LIST_COMPONENT, com.foundation.view.swt.SimpleTable.STYLE_SINGLE|com.foundation.view.swt.SimpleTable.STYLE_FULL_SELECTION);
serverList.setAutoFit(true);
com.foundation.view.swt.SimpleTable.ColumnData serverListColumnPart0 = serverList.addColumn();
serverListColumnPart0.setHeaderText("Server Name");
serverListColumnPart0.setCellTextAssociation(new com.foundation.view.MultiAssociationContainer(new com.foundation.view.MultiAssociation[] {new com.foundation.view.MultiAssociation(com.foundation.web.manager.model.Server.class, SERVER_LIST_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.model.Server.class, com.foundation.web.manager.model.Server.NAME)}, null,true)}));
com.foundation.view.swt.SimpleTable.ColumnData serverListColumnPart1 = serverList.addColumn();
serverListColumnPart1.setHeaderText("Server Status");
serverListColumnPart1.setCellTextAssociation(new com.foundation.view.MultiAssociationContainer(new com.foundation.view.MultiAssociation[] {new com.foundation.view.MultiAssociation(com.foundation.web.manager.model.Server.class, SERVER_LIST_COLUMN_PART1_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0, this, false, new com.foundation.view.AssociationAttribute[] {new com.foundation.view.AssociationAttribute(com.foundation.web.manager.model.Server.WEB_SERVER_STATUS, SERVER_LIST_COLUMN_PART1_ASSOCIATION_COLUMN_CELL_TEXT_AA0_ATTRIBUTE_ASSOCIATION, this, false)}, new com.foundation.view.AssociationNode[] {new com.foundation.view.AssociationNode("com.foundation.web.monitor.shared.model.WebServerStatus", null, new int[] {com.foundation.web.monitor.shared.model.WebServerStatus.IS_RUNNING.getNumber()})}, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(serverListColumnPart1, null, null, com.foundation.web.manager.model.Server.class, com.foundation.web.manager.model.Server.STATUS), new com.foundation.view.EventAssociation(serverListColumnPart1, null, null, com.foundation.web.manager.model.Server.class, com.foundation.web.manager.model.Server.WEB_SERVER_STATUS), },"controllerHolder",true)}));
serverList.setAutoSynchronizeSelection(true);
serverList.setCollectionAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.local.view.controller.MainViewController.class, SERVER_LIST_ASSOCIATION_COLLECTION_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.local.view.controller.MainViewController.class, com.foundation.web.manager.local.view.controller.MainViewController.SERVERS)}, null,true)}));
serverList.setSelectionAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.local.view.controller.MainViewController.class, SERVER_LIST_ASSOCIATION_SELECTION_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.local.view.controller.MainViewController.class, com.foundation.web.manager.local.view.controller.MainViewController.SELECTED_SERVER)}, null,true)}));
serverList.setDoubleClickMethod(new com.foundation.view.MethodAssociation(this, SERVER_LIST_DOUBLE_CLICK_METHOD_ASSOCIATION, serverList, "controllerHolder", null, null));
serverList.addKeyBinding(new com.foundation.view.KeyBinding(this, SERVER_LIST_KEY_BINDING_43_0, serverList, "controllerHolder", null, null, 0, new Integer(43)));
serverList.addKeyBinding(new com.foundation.view.KeyBinding(this, SERVER_LIST_KEY_BINDING_82_0, serverList, "controllerHolder", null, null, 0, new Integer(82)));
serverList.addKeyBinding(new com.foundation.view.KeyBinding(this, SERVER_LIST_KEY_BINDING_16777225_0, serverList, "controllerHolder", null, null, 0, new Integer(16777225)));
serverList.addKeyBinding(new com.foundation.view.KeyBinding(this, SERVER_LIST_KEY_BINDING_45_0, serverList, "controllerHolder", null, null, 0, new Integer(45)));
serverList.addKeyBinding(new com.foundation.view.KeyBinding(this, SERVER_LIST_KEY_BINDING_8_0, serverList, "controllerHolder", null, null, 0, new Integer(8)));
serverList.addKeyBinding(new com.foundation.view.KeyBinding(this, SERVER_LIST_KEY_BINDING_127_0, serverList, "controllerHolder", null, null, 0, new Integer(127)));
initializeServerListPopupMenu(serverList);
}//initializeServerList()//
public void initializeLeft(com.foundation.view.swt.Container parent) {
left = new com.foundation.view.swt.Panel(parent, LEFT_COMPONENT, 0);
initializeServerList(left);
com.foundation.view.swt.FillLayout layout = new com.foundation.view.swt.FillLayout(left);
layout.setMarginHeight(3);
layout.setMarginWidth(3);
left.setLayout(layout);
left.setTabOrder(new com.common.util.LiteList(new Object[] {}));
}//initializeLeft()//
public void initializeWebappTablePopupMenu(com.foundation.view.IAbstractComponent parent) {
unnamedComponent5 = new com.foundation.view.swt.Menu(webappTable, null, com.foundation.view.swt.Menu.STYLE_POPUP);
unnamedComponent6 = new com.foundation.view.swt.Menu(unnamedComponent5, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent6.setText("Refresh All");
unnamedComponent6.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT6_SELECTION_METHOD_ASSOCIATION, unnamedComponent6, "controllerHolder", null, null));
unnamedComponent7 = new com.foundation.view.swt.Menu(unnamedComponent5, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent7.setText("Refresh");
unnamedComponent7.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT7_SELECTION_METHOD_ASSOCIATION, unnamedComponent7, "controllerHolder", null, null));
unnamedComponent8 = new com.foundation.view.swt.Menu(unnamedComponent5, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent8.setText("Reload");
unnamedComponent8.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT8_SELECTION_METHOD_ASSOCIATION, unnamedComponent8, "controllerHolder", null, null));
unnamedComponent9 = new com.foundation.view.swt.Menu(unnamedComponent5, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent9.setText("Upload");
unnamedComponent9.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT9_SELECTION_METHOD_ASSOCIATION, unnamedComponent9, "controllerHolder", null, null));
unnamedComponent10 = new com.foundation.view.swt.Menu(unnamedComponent5, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent10.setText("Remove");
unnamedComponent10.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT10_SELECTION_METHOD_ASSOCIATION, unnamedComponent10, "controllerHolder", null, null));
}//initializeWebappTablePopupMenu()//
public void initializeWebappTable(com.foundation.view.swt.Container parent) {
webappTable = new com.foundation.view.swt.SimpleTable(parent, WEBAPP_TABLE_COMPONENT, com.foundation.view.swt.SimpleTable.STYLE_BORDER);
webappTable.showHeaders(true);
webappTable.setAutoFit(true);
com.foundation.view.swt.SimpleTable.ColumnData webappTableColumnPart0 = webappTable.addColumn();
webappTableColumnPart0.setHeaderText("Web Application");
webappTableColumnPart0.setCellTextAssociation(new com.foundation.view.MultiAssociationContainer(new com.foundation.view.MultiAssociation[] {new com.foundation.view.MultiAssociation(com.foundation.web.server.shared.model.WebappBundle.class, WEBAPP_TABLE_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.server.shared.model.WebappBundle.class, com.foundation.web.server.shared.model.WebappBundle.NAME)}, null,true)}));
webappTable.setAutoSynchronizeSelection(true);
webappTable.setAutoSynchronizeSelectionDelay(0l);
webappTable.setAutoValidate(false);
webappTable.setCollectionAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.local.view.controller.MainViewController.class, WEBAPP_TABLE_ASSOCIATION_COLLECTION_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.local.view.controller.MainViewController.class, com.foundation.web.manager.local.view.controller.MainViewController.WEBAPPS)}, null,true)}));
webappTable.setSelectionAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.local.view.controller.MainViewController.class, WEBAPP_TABLE_ASSOCIATION_SELECTION_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.local.view.controller.MainViewController.class, com.foundation.web.manager.local.view.controller.MainViewController.SELECTED_WEBAPP)}, null,true)}));
initializeWebappTablePopupMenu(webappTable);
}//initializeWebappTable()//
public void initializeRight(com.foundation.view.swt.Container parent) {
right = new com.foundation.view.swt.Panel(parent, RIGHT_COMPONENT, 0);
initializeWebappTable(right);
com.foundation.view.swt.FillLayout layout = new com.foundation.view.swt.FillLayout(right);
layout.setMarginHeight(3);
layout.setMarginWidth(3);
right.setLayout(layout);
right.setTabOrder(new com.common.util.LiteList(new Object[] {}));
}//initializeRight()//
public void initializeWebServerLog(com.foundation.view.swt.Container parent) {
webServerLog = new com.foundation.view.swt.TextField(parent, WEB_SERVER_LOG_COMPONENT, com.foundation.view.swt.TextField.STYLE_BORDER|com.foundation.view.swt.TextField.STYLE_READ_ONLY|com.foundation.view.swt.TextField.STYLE_V_SCROLL|com.foundation.view.swt.TextField.STYLE_H_SCROLL|com.foundation.view.swt.TextField.STYLE_MULTI);
com.foundation.view.swt.TextField.TextFormat webServerLogFormat = (com.foundation.view.swt.TextField.TextFormat) webServerLog.initializeFormat(com.foundation.view.swt.TextField.TextFormat.class);
webServerLogFormat.setValueAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.local.view.controller.MainViewController.class, WEB_SERVER_LOG_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.local.view.controller.MainViewController.class, com.foundation.web.manager.local.view.controller.MainViewController.WEB_SERVER_LOG_TEXT)}, null,true)}));
webServerLog.setSelectOnFocus(true);
}//initializeWebServerLog()//
public void initializeBottom(com.foundation.view.swt.Container parent) {
bottom = new com.foundation.view.swt.Panel(parent, BOTTOM_COMPONENT, 0);
initializeWebServerLog(bottom);
com.foundation.view.swt.FillLayout layout = new com.foundation.view.swt.FillLayout(bottom);
layout.setMarginHeight(3);
layout.setMarginWidth(3);
bottom.setLayout(layout);
bottom.setTabOrder(new com.common.util.LiteList(new Object[] {webServerLog}));
}//initializeBottom()//
public void initializeMain(com.foundation.view.swt.Container parent) {
main = new com.foundation.view.swt.Panel(parent, MAIN_COMPONENT, com.foundation.view.swt.Panel.STYLE_BORDER);
initializeLeft(main);
initializeRight(main);
initializeBottom(main);
com.foundation.view.swt.GridLayout layout = new com.foundation.view.swt.GridLayout(main);
layout.setNumColumns(2);
layout.setMakeColumnsEqualWidth(false);
layout.setMarginHeight(2);
layout.setMarginWidth(2);
layout.setHorizontalSpacing(2);
layout.setVerticalSpacing(2);
main.setLayout(layout);
main.setTabOrder(new com.common.util.LiteList(new Object[] {left, right, bottom}));
}//initializeMain()//
/* (non-Javadoc)
* @see com.foundation.view.IView#internalViewInitialize()
*/
public void internalViewInitialize() {
this.setClosedMethod(new com.foundation.view.MethodAssociation(this, THIS_CLOSED_METHOD_ASSOCIATION, this, "controllerHolder", null, null));
initializeControllerHolder(this);
initializeMain(this);
com.foundation.view.swt.FillLayout layout = new com.foundation.view.swt.FillLayout(this);
layout.setMarginHeight(3);
layout.setMarginWidth(3);
this.setLayout(layout);
this.setTabOrder(new com.common.util.LiteList(new Object[] {main}));
this.setSize(650, 650);
this.setDefaultContainerTitle("Main");
layoutComponents();
super.internalViewInitialize();
setupLinkages();
}//internalViewInitialize()//
/* (non-Javadoc)
* @see com.foundation.view.IView#pack()
*/
public void pack() {
//Don't pack since a custom size was specified.
}//pack()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeGetMethod(int, Object)
*/
public Object invokeGetMethod(int associationNumber, Object value) {
Object retVal = null;
switch(associationNumber) {
case SERVER_LIST_COLUMN_PART1_ASSOCIATION_COLUMN_CELL_TEXT_AA0_ATTRIBUTE_ASSOCIATION:
retVal = ((com.foundation.web.manager.model.Server) value).getWebServerStatus();
break;
default:
com.common.debug.Debug.log("Attribute association broken.");
break;
}//switch//
return retVal;
}//invokeGetMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeSetMethod(int, Object, Object)
*/
public void invokeSetMethod(int associationNumber, Object value, Object parameter) {
switch(associationNumber) {
default:
com.common.debug.Debug.log("Attribute association broken.");
break;
}//switch//
}//invokeSetMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeMethod(int, Object, Object[])
*/
public Object invokeMethod(int associationNumber, Object value, Object[] parameters) {
Object retVal = null;
switch(associationNumber) {
case THIS_CLOSED_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doClose();
break;
case SERVER_LIST_DOUBLE_CLICK_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doEditServer();
break;
case SERVER_LIST_KEY_BINDING_43_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doAddServer();
break;
case SERVER_LIST_KEY_BINDING_82_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doAddServer();
break;
case SERVER_LIST_KEY_BINDING_16777225_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doAddServer();
break;
case SERVER_LIST_KEY_BINDING_45_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doRemoveServer();
break;
case SERVER_LIST_KEY_BINDING_8_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doRemoveServer();
break;
case SERVER_LIST_KEY_BINDING_127_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doRemoveServer();
break;
case UNNAMED_COMPONENT2_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doAddServer();
break;
case EDIT_SERVER_MENU_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doEditServer();
break;
case REMOVE_SERVER_MENU_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doRemoveServer();
break;
case UNNAMED_COMPONENT3_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doStopServer();
break;
case UNNAMED_COMPONENT4_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doStartServer();
break;
case UNNAMED_COMPONENT6_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doRefreshAllWebapps();
break;
case UNNAMED_COMPONENT7_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doRefreshWebapp();
break;
case UNNAMED_COMPONENT8_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doReloadWebapp();
break;
case UNNAMED_COMPONENT9_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doUploadWebapp();
break;
case UNNAMED_COMPONENT10_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.MainViewController) value).doStartServer();
break;
default:
com.common.debug.Debug.log("Method association broken.");
break;
}//switch//
return retVal;
}//invokeMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeMethod(int, Object, Object[], byte)
*/
public Object invokeMethod(int associationNumber, Object value, Object[] parameters, byte flags) {
Object result = null;
if(flags == INVOKE_GETTER_METHOD_FLAG) {
switch(associationNumber) {
case SERVER_LIST_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getName();
break;
case SERVER_LIST_COLUMN_PART1_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getWebServerStatus((com.foundation.web.manager.model.Server) parameters[0]);
break;
case SERVER_LIST_ASSOCIATION_COLLECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getServers();
break;
case SERVER_LIST_ASSOCIATION_SELECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getSelectedServer();
break;
case WEBAPP_TABLE_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.server.shared.model.WebappBundle) value).getName();
break;
case WEBAPP_TABLE_ASSOCIATION_COLLECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getWebapps();
break;
case WEBAPP_TABLE_ASSOCIATION_SELECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getSelectedWebapp();
break;
case WEB_SERVER_LOG_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getWebServerLogText();
break;
default:
com.common.debug.Debug.log("Association (getter) broken.");
break;
}//switch//
}//if//
else if(flags == INVOKE_ORIGINAL_VALUE_GETTER_METHOD_FLAG) {
switch(associationNumber) {
case SERVER_LIST_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getOldAttributeValue(com.foundation.web.manager.model.Server.NAME);
break;
case SERVER_LIST_ASSOCIATION_COLLECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getOldAttributeValue(com.foundation.web.manager.local.view.controller.MainViewController.SERVERS);
break;
case SERVER_LIST_ASSOCIATION_SELECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getOldAttributeValue(com.foundation.web.manager.local.view.controller.MainViewController.SELECTED_SERVER);
break;
case WEBAPP_TABLE_COLUMN_PART0_ASSOCIATION_COLUMN_CELL_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.server.shared.model.WebappBundle) value).getOldAttributeValue(com.foundation.web.server.shared.model.WebappBundle.NAME);
break;
case WEBAPP_TABLE_ASSOCIATION_COLLECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getOldAttributeValue(com.foundation.web.manager.local.view.controller.MainViewController.WEBAPPS);
break;
case WEBAPP_TABLE_ASSOCIATION_SELECTION_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getOldAttributeValue(com.foundation.web.manager.local.view.controller.MainViewController.SELECTED_WEBAPP);
break;
case WEB_SERVER_LOG_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.MainViewController) value).getOldAttributeValue(com.foundation.web.manager.local.view.controller.MainViewController.WEB_SERVER_LOG_TEXT);
break;
default:
com.common.debug.Debug.log("Association (original value getter) broken.");
break;
}//switch//
}//if//
else {
switch(associationNumber) {
case SERVER_LIST_ASSOCIATION_SELECTION_ASSOCIATION_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).setSelectedServer((com.foundation.web.manager.model.Server) parameters[0]);
break;
case WEBAPP_TABLE_ASSOCIATION_SELECTION_ASSOCIATION_0:
((com.foundation.web.manager.local.view.controller.MainViewController) value).setSelectedWebapp((com.foundation.web.server.shared.model.WebappBundle) parameters[0]);
break;
default:
com.common.debug.Debug.log("Association (setter) broken.");
break;
}//switch//
}//else//
return result;
}//invokeMethod()//
/**
* Lays out the components.
*/
public void layoutComponents() {
{ //left//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.verticalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.minimumWidth = 200;
layoutData.widthHint = 200;
layoutData.minimumHeight = 200;
layoutData.heightHint = 200;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = false;
left.setLayoutData(layoutData);
}//block//
{ //right//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.verticalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.minimumWidth = 200;
layoutData.widthHint = 200;
layoutData.minimumHeight = 200;
layoutData.heightHint = 200;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = false;
right.setLayoutData(layoutData);
}//block//
{ //bottom//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.verticalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.minimumWidth = 400;
layoutData.widthHint = 400;
layoutData.minimumHeight = 400;
layoutData.heightHint = 400;
layoutData.horizontalSpan = 2;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
bottom.setLayoutData(layoutData);
}//block//
}//layoutComponents()//
/**
* Initializes the direct linkages between the components.
*/
public void setupLinkages() {
serverList.addSelectionLink(new com.foundation.view.LinkData(EditServerMenu, com.foundation.view.swt.Menu.LINK_TARGET_IS_VISIBLE, null, false, false));
serverList.addSelectionLink(new com.foundation.view.LinkData(RemoveServerMenu, com.foundation.view.swt.Menu.LINK_TARGET_IS_VISIBLE, null, false, false));
}//setupLinkages()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.ValueHolder getVpControllerHolder() {
return controllerHolder;
}//getVpControllerHolder()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Panel getVpMain() {
return main;
}//getVpMain()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Panel getVpLeft() {
return left;
}//getVpLeft()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.SimpleTable getVpServerList() {
return serverList;
}//getVpServerList()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent0() {
return unnamedComponent0;
}//getVpUnnamedComponent0()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent1() {
return unnamedComponent1;
}//getVpUnnamedComponent1()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent2() {
return unnamedComponent2;
}//getVpUnnamedComponent2()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpEditServerMenu() {
return EditServerMenu;
}//getVpEditServerMenu()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpRemoveServerMenu() {
return RemoveServerMenu;
}//getVpRemoveServerMenu()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent3() {
return unnamedComponent3;
}//getVpUnnamedComponent3()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent4() {
return unnamedComponent4;
}//getVpUnnamedComponent4()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Panel getVpRight() {
return right;
}//getVpRight()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.SimpleTable getVpWebappTable() {
return webappTable;
}//getVpWebappTable()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent5() {
return unnamedComponent5;
}//getVpUnnamedComponent5()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent6() {
return unnamedComponent6;
}//getVpUnnamedComponent6()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent7() {
return unnamedComponent7;
}//getVpUnnamedComponent7()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent8() {
return unnamedComponent8;
}//getVpUnnamedComponent8()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent9() {
return unnamedComponent9;
}//getVpUnnamedComponent9()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Menu getVpUnnamedComponent10() {
return unnamedComponent10;
}//getVpUnnamedComponent10()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Panel getVpBottom() {
return bottom;
}//getVpBottom()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.TextField getVpWebServerLog() {
return webServerLog;
}//getVpWebServerLog()//
}//MainView//

View File

@@ -0,0 +1,135 @@
<?xml version="1.0"?>
<vml>
<metadata>
<platform name="thick:swt"/>
</metadata>
<window name="MainView" style="window trim" container-image="" container-title="Main" width="650" height="650">
<fill-layout margin-height="3" margin-width="3"/>
<method function="closed" name="doClose" signature="" value-holder="controllerHolder"/>
<value-holder name="controllerHolder" type="com.foundation.web.manager.local.view.controller.MainViewController"/>
<panel name="main" style="border" tab-order="1">
<grid-layout column-count="2" margin-height="2" margin-width="2" equal-width-columns="false" vertical-spacing="2" horizontal-spacing="2"/>
<panel name="left" style="" tab-order="1">
<grid-layout-data minimum-width="200" minimum-height="200" horizontal-alignment="fill" vertical-alignment="fill" horizontal-fill="true" vertical-fill="false"/>
<fill-layout margin-height="3" margin-width="3"/>
<simple-table name="serverList" style="single selection | full selection" auto-fit="true" auto-synchronize-selection="true">
<association function="collection" attribute="servers" value-holder="controllerHolder"/>
<!--<association function="row-selection-gradient" getter="getSelectionColor" getter-signature="Lcom.foundation.web.manager.model.Server;" row-type="com.foundation.web.manager.model.Server" value-holder="controllerHolder"/>-->
<association function="selection" attribute="selectedServer" value-holder="controllerHolder"/>
<key character="+" method="doAddServer" value-holder="controllerHolder"/>
<key character="0x52" method="doAddServer" value-holder="controllerHolder"/> <!--?? Key-->
<key character="0x1000009" method="doAddServer" value-holder="controllerHolder"/> <!--Insert Key-->
<key character="-" method="doRemoveServer" value-holder="controllerHolder"/>
<key character="0x08" method="doRemoveServer" value-holder="controllerHolder"/> <!--Delete Key-->
<key character="0x7F" method="doRemoveServer" value-holder="controllerHolder"/> <!--Backspace Key-->
<menu-floating>
<menu-cascade text="Modify">
<menu text="Add Server..">
<method function="selection" name="doAddServer" value-holder="controllerHolder"/>
</menu>
<menu name="EditServerMenu" text="Edit Server">
<method function="selection" name="doEditServer" value-holder="controllerHolder"/>
</menu>
<menu name="RemoveServerMenu" text="Remove Server">
<method function="selection" name="doRemoveServer" value-holder="controllerHolder"/>
</menu>
</menu-cascade>
<menu text="Stop">
<method function="selection" name="doStopServer" value-holder="controllerHolder"/>
</menu>
<menu text="Start">
<method function="selection" name="doStartServer" value-holder="controllerHolder"/>
</menu>
</menu-floating>
<link function="selection" component="EditServerMenu" target="is-visible"/>
<link function="selection" component="RemoveServerMenu" target="is-visible"/>
<method function="double-click" name="doEditServer" value-holder="controllerHolder"/>
<columns>
<column header-text="Server Name">
<association function="cell-text" attribute="name" row-type="com.foundation.web.manager.model.Server"/>
</column>
<column header-text="Server Status">
<association function="cell-text" getter="getWebServerStatus" getter-signature="Lcom.foundation.web.manager.model.Server;" row-type="com.foundation.web.manager.model.Server" value-holder="controllerHolder">
<association-event event="status"/>
<association-event event="webServerStatus"/>
<association-attribute attribute="webServerStatus"/>
<association-node row-type="com.foundation.web.monitor.shared.model.WebServerStatus">
<association-event event="isRunning"/>
</association-node>
</association>
</column>
<!--
<column header-text="Monitor Status">
<association function="cell-text" attribute="status" row-type="com.foundation.web.manager.model.Server"/>
<association function="cell-foreground-color" getter="getColor" getter-signature="Lcom.foundation.web.manager.model.Server;" row-type="com.foundation.web.manager.model.Server" value-holder="controllerHolder"/>
</column>
<column header-text="Webserver Status">
<association-group function="cell-text" row-type="com.foundation.web.manager.model.Server">
<association-link attribute="webServerStatus" row-type="com.foundation.web.manager.model.Server"/>
<association-target-method getter="getWebServerStatus" getter-signature="Lcom.foundation.web.monitor.shared.model.WebServerStatus;" value-holder="controllerHolder" row-type="com.foundation.web.monitor.shared.model.WebServerStatus">
<association-event event="isRunning"/>
</association-target-method>
</association-group>
</column>-->
</columns>
</simple-table>
</panel>
<panel name="right" style="" tab-order="1">
<grid-layout-data minimum-width="200" minimum-height="200" horizontal-alignment="fill" vertical-alignment="fill" horizontal-fill="true" vertical-fill="false"/>
<fill-layout margin-height="3" margin-width="3"/>
<simple-table name="webappTable" style="border" auto-fit="true" show-headers="true" auto-synchronize-selection="true" auto-synchronize-selection-delay="0" auto-validate="false">
<association function="collection" attribute="webapps" value-holder="controllerHolder"/>
<association function="selection" attribute="selectedWebapp" value-holder="controllerHolder"/>
<menu-floating>
<menu text="Refresh All">
<method function="selection" name="doRefreshAllWebapps" value-holder="controllerHolder"/>
</menu>
<menu text="Refresh">
<method function="selection" name="doRefreshWebapp" value-holder="controllerHolder"/>
</menu>
<menu text="Reload">
<method function="selection" name="doReloadWebapp" value-holder="controllerHolder"/>
</menu>
<menu text="Upload">
<method function="selection" name="doUploadWebapp" value-holder="controllerHolder"/>
</menu>
<menu text="Remove">
<method function="selection" name="doStartServer" value-holder="controllerHolder"/>
</menu>
</menu-floating>
<columns>
<column header-text="Web Application">
<association-group function="cell-text" cell-background-color="green">
<association-target-attribute attribute="name" row-type="com.foundation.web.server.shared.model.WebappBundle"/>
</association-group>
</column>
</columns>
</simple-table>
</panel>
<panel name="bottom" style="" tab-order="1">
<grid-layout-data minimum-width="400" minimum-height="400" horizontal-alignment="fill" vertical-alignment="fill" horizontal-fill="true" vertical-fill="true" horizontal-span="2"/>
<fill-layout margin-height="3" margin-width="3"/>
<text name="webServerLog" style="border | multi line | read only | horizontal scroll | vertical scroll" select-on-focus="true" tab-order="1">
<text-format>
<association function="text" attribute="webServerLogText" value-holder="controllerHolder"/>
</text-format>
</text>
</panel>
</panel>
</window>
</vml>

View File

@@ -0,0 +1,408 @@
package com.foundation.web.manager.local.view;
/**
* ServerEditor
*/
public class ServerEditor extends com.foundation.view.swt.Window implements com.foundation.view.IAssociationHandler {
//Component Names//
public static final String CONTROLLER_HOLDER_COMPONENT = "controllerHolder";
public static final String SERVER_HOLDER_COMPONENT = "serverHolder";
public static final String NAME_TEXT_COMPONENT = "nameText";
public static final String ADDRESS_TEXT_COMPONENT = "addressText";
public static final String USER_TEXT_COMPONENT = "userText";
public static final String PASSWORD_TEXT_COMPONENT = "passwordText";
public static final String BUTTON_PANEL_COMPONENT = "buttonPanel";
public static final String OK_BUTTON_COMPONENT = "okButton";
public static final String CANCEL_BUTTON_COMPONENT = "cancelButton";
public static final String SERVER_EDITOR_COMPONENT = "ServerEditor";
//Association Identifiers//
protected static final int SERVER_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0 = 0;
protected static final int NAME_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0 = 1;
protected static final int ADDRESS_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0 = 2;
protected static final int USER_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0 = 3;
protected static final int PASSWORD_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0 = 4;
//Method Association Identifiers//
protected static final int THIS_CLOSED_METHOD_ASSOCIATION = 0;
protected static final int OK_BUTTON_SELECTION_METHOD_ASSOCIATION = 1;
protected static final int CANCEL_BUTTON_SELECTION_METHOD_ASSOCIATION = 2;
//View Components//
private com.foundation.view.swt.ValueHolder controllerHolder = null;
private com.foundation.view.swt.ValueHolder serverHolder = null;
private com.foundation.view.swt.TextField nameText = null;
private com.foundation.view.swt.TextField addressText = null;
private com.foundation.view.swt.TextField userText = null;
private com.foundation.view.swt.TextField passwordText = null;
private com.foundation.view.swt.Panel buttonPanel = null;
private com.foundation.view.swt.Button okButton = null;
private com.foundation.view.swt.Button cancelButton = null;
/**
* ServerEditor default constructor.
* <p>Warning: This constructor is intended for use by the metadata service <b>only</b>. This constructor should <b>never</b> be called by the view's controller.</p>
*/
public ServerEditor() {
}//ServerEditor()//
/**
* ServerEditor constructor.
* @param controller The view controller which will be assigned to the value holder(s) that don't depend on another value holder for their value.
*/
public ServerEditor(com.foundation.controller.ViewController controller) {
super((com.foundation.controller.ViewController) controller.getParent(), SERVER_EDITOR_COMPONENT, com.foundation.view.swt.Window.STYLE_SHELL_TRIM, controller.getContext(), controller);
}//ServerEditor()//
public void initializeControllerHolder(com.foundation.view.swt.Container parent) {
controllerHolder = new com.foundation.view.swt.ValueHolder(parent, CONTROLLER_HOLDER_COMPONENT, com.foundation.web.manager.local.view.controller.ServerEditorController.class);
}//initializeControllerHolder()//
public void initializeServerHolder(com.foundation.view.swt.Container parent) {
serverHolder = new com.foundation.view.swt.ValueHolder(parent, SERVER_HOLDER_COMPONENT, com.foundation.web.manager.model.Server.class);
serverHolder.setParentAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.local.view.controller.ServerEditorController.class, SERVER_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.local.view.controller.ServerEditorController.class, com.foundation.web.manager.local.view.controller.ServerEditorController.SERVER)}, null,true)}));
}//initializeServerHolder()//
public void initializeNameText(com.foundation.view.swt.Container parent) {
nameText = new com.foundation.view.swt.TextField(parent, NAME_TEXT_COMPONENT, com.foundation.view.swt.TextField.STYLE_BORDER);
com.foundation.view.swt.TextField.TextFormat nameTextFormat = (com.foundation.view.swt.TextField.TextFormat) nameText.initializeFormat(com.foundation.view.swt.TextField.TextFormat.class);
nameTextFormat.setValueAssociation(new com.foundation.view.SingleAssociationContainer("serverHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.model.Server.class, NAME_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.model.Server.class, com.foundation.web.manager.model.Server.NAME)}, null,true)}));
nameText.setShadowText("Server display name.");
nameText.setSelectOnFocus(true);
}//initializeNameText()//
public void initializeAddressText(com.foundation.view.swt.Container parent) {
addressText = new com.foundation.view.swt.TextField(parent, ADDRESS_TEXT_COMPONENT, com.foundation.view.swt.TextField.STYLE_BORDER);
com.foundation.view.swt.TextField.TextFormat addressTextFormat = (com.foundation.view.swt.TextField.TextFormat) addressText.initializeFormat(com.foundation.view.swt.TextField.TextFormat.class);
addressTextFormat.setValueAssociation(new com.foundation.view.SingleAssociationContainer("serverHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.model.Server.class, ADDRESS_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.model.Server.class, com.foundation.web.manager.model.Server.ADDRESS)}, null,true)}));
addressText.setShadowText("IP:port or Domain:port");
addressText.setSelectOnFocus(true);
}//initializeAddressText()//
public void initializeUserText(com.foundation.view.swt.Container parent) {
userText = new com.foundation.view.swt.TextField(parent, USER_TEXT_COMPONENT, com.foundation.view.swt.TextField.STYLE_BORDER);
com.foundation.view.swt.TextField.TextFormat userTextFormat = (com.foundation.view.swt.TextField.TextFormat) userText.initializeFormat(com.foundation.view.swt.TextField.TextFormat.class);
userTextFormat.setValueAssociation(new com.foundation.view.SingleAssociationContainer("serverHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.model.Server.class, USER_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.model.Server.class, com.foundation.web.manager.model.Server.USER)}, null,true)}));
userText.setShadowText("The user name to login with.");
userText.setSelectOnFocus(true);
}//initializeUserText()//
public void initializePasswordText(com.foundation.view.swt.Container parent) {
passwordText = new com.foundation.view.swt.TextField(parent, PASSWORD_TEXT_COMPONENT, com.foundation.view.swt.TextField.STYLE_BORDER);
com.foundation.view.swt.TextField.TextFormat passwordTextFormat = (com.foundation.view.swt.TextField.TextFormat) passwordText.initializeFormat(com.foundation.view.swt.TextField.TextFormat.class);
passwordTextFormat.setValueAssociation(new com.foundation.view.SingleAssociationContainer("serverHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.foundation.web.manager.model.Server.class, PASSWORD_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.foundation.web.manager.model.Server.class, com.foundation.web.manager.model.Server.PASSWORD)}, null,true)}));
passwordText.setShadowText("The password to login with.");
passwordText.setSelectOnFocus(true);
}//initializePasswordText()//
public void initializeOkButton(com.foundation.view.swt.Container parent) {
okButton = new com.foundation.view.swt.Button(parent, OK_BUTTON_COMPONENT, 0);
okButton.setText("Ok");
okButton.setSelectionMethod(new com.foundation.view.MethodAssociation(this, OK_BUTTON_SELECTION_METHOD_ASSOCIATION, okButton, "controllerHolder", null, null));
}//initializeOkButton()//
public void initializeCancelButton(com.foundation.view.swt.Container parent) {
cancelButton = new com.foundation.view.swt.Button(parent, CANCEL_BUTTON_COMPONENT, 0);
cancelButton.setText("Cancel");
cancelButton.setSelectionMethod(new com.foundation.view.MethodAssociation(this, CANCEL_BUTTON_SELECTION_METHOD_ASSOCIATION, cancelButton, "controllerHolder", null, null));
}//initializeCancelButton()//
public void initializeButtonPanel(com.foundation.view.swt.Container parent) {
buttonPanel = new com.foundation.view.swt.Panel(parent, BUTTON_PANEL_COMPONENT, 0);
initializeOkButton(buttonPanel);
initializeCancelButton(buttonPanel);
com.foundation.view.swt.GridLayout layout = new com.foundation.view.swt.GridLayout(buttonPanel);
layout.setNumColumns(2);
layout.setMakeColumnsEqualWidth(true);
layout.setMarginHeight(0);
layout.setMarginWidth(0);
layout.setHorizontalSpacing(0);
layout.setVerticalSpacing(6);
buttonPanel.setLayout(layout);
buttonPanel.setTabOrder(new com.common.util.LiteList(new Object[] {}));
}//initializeButtonPanel()//
/* (non-Javadoc)
* @see com.foundation.view.IView#internalViewInitialize()
*/
public void internalViewInitialize() {
this.setClosedMethod(new com.foundation.view.MethodAssociation(this, THIS_CLOSED_METHOD_ASSOCIATION, this, "controllerHolder", null, null));
initializeControllerHolder(this);
initializeServerHolder(this);
initializeNameText(this);
initializeAddressText(this);
initializeUserText(this);
initializePasswordText(this);
initializeButtonPanel(this);
com.foundation.view.swt.GridLayout layout = new com.foundation.view.swt.GridLayout(this);
layout.setNumColumns(1);
layout.setMakeColumnsEqualWidth(false);
layout.setMarginHeight(20);
layout.setMarginWidth(20);
layout.setHorizontalSpacing(2);
layout.setVerticalSpacing(8);
this.setLayout(layout);
this.setTabOrder(new com.common.util.LiteList(new Object[] {nameText, addressText, userText, passwordText, buttonPanel}));
this.setDefaultContainerTitle("Server Editor");
this.setDefaultButton(okButton);
layoutComponents();
super.internalViewInitialize();
setupLinkages();
}//internalViewInitialize()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeGetMethod(int, Object)
*/
public Object invokeGetMethod(int associationNumber, Object value) {
Object retVal = null;
switch(associationNumber) {
default:
com.common.debug.Debug.log("Attribute association broken.");
break;
}//switch//
return retVal;
}//invokeGetMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeSetMethod(int, Object, Object)
*/
public void invokeSetMethod(int associationNumber, Object value, Object parameter) {
switch(associationNumber) {
default:
com.common.debug.Debug.log("Attribute association broken.");
break;
}//switch//
}//invokeSetMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeMethod(int, Object, Object[])
*/
public Object invokeMethod(int associationNumber, Object value, Object[] parameters) {
Object retVal = null;
switch(associationNumber) {
case THIS_CLOSED_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.ServerEditorController) value).doClose();
break;
case OK_BUTTON_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.ServerEditorController) value).doOk();
break;
case CANCEL_BUTTON_SELECTION_METHOD_ASSOCIATION:
((com.foundation.web.manager.local.view.controller.ServerEditorController) value).doCancel();
break;
default:
com.common.debug.Debug.log("Method association broken.");
break;
}//switch//
return retVal;
}//invokeMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeMethod(int, Object, Object[], byte)
*/
public Object invokeMethod(int associationNumber, Object value, Object[] parameters, byte flags) {
Object result = null;
if(flags == INVOKE_GETTER_METHOD_FLAG) {
switch(associationNumber) {
case SERVER_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.ServerEditorController) value).getServer();
break;
case NAME_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getName();
break;
case ADDRESS_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getAddress();
break;
case USER_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getUser();
break;
case PASSWORD_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getPassword();
break;
default:
com.common.debug.Debug.log("Association (getter) broken.");
break;
}//switch//
}//if//
else if(flags == INVOKE_ORIGINAL_VALUE_GETTER_METHOD_FLAG) {
switch(associationNumber) {
case SERVER_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0:
result = ((com.foundation.web.manager.local.view.controller.ServerEditorController) value).getOldAttributeValue(com.foundation.web.manager.local.view.controller.ServerEditorController.SERVER);
break;
case NAME_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getOldAttributeValue(com.foundation.web.manager.model.Server.NAME);
break;
case ADDRESS_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getOldAttributeValue(com.foundation.web.manager.model.Server.ADDRESS);
break;
case USER_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getOldAttributeValue(com.foundation.web.manager.model.Server.USER);
break;
case PASSWORD_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
result = ((com.foundation.web.manager.model.Server) value).getOldAttributeValue(com.foundation.web.manager.model.Server.PASSWORD);
break;
default:
com.common.debug.Debug.log("Association (original value getter) broken.");
break;
}//switch//
}//if//
else {
switch(associationNumber) {
case NAME_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
((com.foundation.web.manager.model.Server) value).setName((java.lang.String) parameters[0]);
break;
case ADDRESS_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
((com.foundation.web.manager.model.Server) value).setAddress((java.lang.String) parameters[0]);
break;
case USER_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
((com.foundation.web.manager.model.Server) value).setUser((java.lang.String) parameters[0]);
break;
case PASSWORD_TEXT_FORMAT_FORMAT_ASSOCIATION_TEXT_ASSOCIATION_0:
((com.foundation.web.manager.model.Server) value).setPassword((java.lang.String) parameters[0]);
break;
default:
com.common.debug.Debug.log("Association (setter) broken.");
break;
}//switch//
}//else//
return result;
}//invokeMethod()//
/**
* Lays out the components.
*/
public void layoutComponents() {
{ //nameText//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.minimumWidth = 220;
layoutData.widthHint = 220;
nameText.setLayoutData(layoutData);
}//block//
{ //addressText//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.minimumWidth = 220;
layoutData.widthHint = 220;
addressText.setLayoutData(layoutData);
}//block//
{ //userText//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.minimumWidth = 220;
layoutData.widthHint = 220;
userText.setLayoutData(layoutData);
}//block//
{ //passwordText//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.minimumWidth = 220;
layoutData.widthHint = 220;
passwordText.setLayoutData(layoutData);
}//block//
{ //buttonPanel//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.verticalAlignment = com.foundation.view.swt.layout.GridData.END;
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = false;
buttonPanel.setLayoutData(layoutData);
}//block//
{ //okButton//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.verticalAlignment = com.foundation.view.swt.layout.GridData.CENTER;
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = false;
okButton.setLayoutData(layoutData);
}//block//
{ //cancelButton//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.verticalAlignment = com.foundation.view.swt.layout.GridData.CENTER;
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = false;
cancelButton.setLayoutData(layoutData);
}//block//
}//layoutComponents()//
/**
* Initializes the direct linkages between the components.
*/
public void setupLinkages() {
}//setupLinkages()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.ValueHolder getVpControllerHolder() {
return controllerHolder;
}//getVpControllerHolder()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.ValueHolder getVpServerHolder() {
return serverHolder;
}//getVpServerHolder()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.TextField getVpNameText() {
return nameText;
}//getVpNameText()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.TextField getVpAddressText() {
return addressText;
}//getVpAddressText()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.TextField getVpUserText() {
return userText;
}//getVpUserText()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.TextField getVpPasswordText() {
return passwordText;
}//getVpPasswordText()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Panel getVpButtonPanel() {
return buttonPanel;
}//getVpButtonPanel()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Button getVpOkButton() {
return okButton;
}//getVpOkButton()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.view.swt.Button getVpCancelButton() {
return cancelButton;
}//getVpCancelButton()//
}//ServerEditor//

View File

@@ -0,0 +1,57 @@
<?xml version="1.0"?>
<vml>
<metadata>
<platform name="thick:swt"/>
</metadata>
<window name="ServerEditor" style="window trim" container-image="" container-title="Server Editor" default-button="okButton">
<grid-layout column-count="1" margin-height="20" margin-width="20" vertical-spacing="8" equal-width-columns="false" vertical-spacing="2" horizontal-spacing="2"/>
<value-holder name="controllerHolder" type="com.foundation.web.manager.local.view.controller.ServerEditorController"/>
<value-holder name="serverHolder" type="com.foundation.web.manager.model.Server">
<association function="parent" attribute="server" value-holder="controllerHolder"/>
</value-holder>
<method function="closed" name="doClose" signature="" value-holder="controllerHolder"/>
<text name="nameText" style="border" ghost-text="Server display name." select-on-focus="true" tab-order="1">
<grid-layout-data minimum-width="220"/>
<text-format>
<association function="text" attribute="name" value-holder="serverHolder"/>
</text-format>
</text>
<text name="addressText" style="border" ghost-text="IP:port or Domain:port" select-on-focus="true" tab-order="1">
<grid-layout-data minimum-width="220"/>
<text-format>
<association function="text" attribute="address" value-holder="serverHolder"/>
</text-format>
</text>
<text name="userText" style="border" ghost-text="The user name to login with." select-on-focus="true" tab-order="1">
<grid-layout-data minimum-width="220"/>
<text-format>
<association function="text" attribute="user" value-holder="serverHolder"/>
</text-format>
</text>
<text name="passwordText" style="border" ghost-text="The password to login with." select-on-focus="true" tab-order="1">
<grid-layout-data minimum-width="220"/>
<text-format>
<association function="text" attribute="password" value-holder="serverHolder"/>
</text-format>
</text>
<panel name='buttonPanel' style='' tab-order='1'>
<grid-layout-data horizontal-alignment='fill' horizontal-fill='true' vertical-fill='false' vertical-alignment='bottom'/>
<grid-layout column-count='2' equal-width-columns='true' margin-height='0' margin-width='0' vertical-spacing='6' horizontal-spacing='0'/>
<button name='okButton' style='' text='Ok'>
<grid-layout-data horizontal-alignment='fill' horizontal-fill='true' vertical-fill='false' vertical-alignment='center'/>
<method function='selection' name='doOk' value-holder='controllerHolder'/>
</button>
<button name='cancelButton' style='' text='Cancel'>
<grid-layout-data horizontal-alignment='fill' horizontal-fill='true' vertical-fill='false' vertical-alignment='center'/>
<method function='selection' name='doCancel' value-holder='controllerHolder'/>
</button>
</panel>
</window>
</vml>

View File

@@ -0,0 +1,56 @@
package com.foundation.web.manager.local.view.controller;
import com.foundation.controller.ViewController;
import com.foundation.view.IViewContext;
import com.foundation.application.*;
import com.foundation.attribute.ReflectionContext;
import com.foundation.view.resource.ResourceReference;
import com.foundation.web.manager.application.*;
/**
* The base view controller code for local views.
*/
public abstract class AbstractViewController extends ViewController {
public static final ResourceReference IMAGE_ERROR = new ResourceReference("res://Application/General/ErrorImage");
public static final ResourceReference IMAGE_WARN = new ResourceReference("res://Application/General/WarningImage");
public static final ResourceReference IMAGE_INFO = new ResourceReference("res://Application/General/InformationImage");
/**
* AbstractViewController constructor.
* @param viewContext The view's context under which it will operate.
*/
public AbstractViewController(IViewContext viewContext) {
super(viewContext);
}//AbstractViewController()//
/**
* AbstractViewController constructor.
* @param viewContext The view's context under which it will operate.
* @param reflectionContext The reflection context to be used by the view.
*/
public AbstractViewController(IViewContext context, ReflectionContext reflectionContext) {
super(context, reflectionContext);
}//AbstractViewController()//
/**
* AbstractViewController constructor.
* @param viewContext The view's context under which it will operate.
* @param validateOnOpen Whether the view should perform validation immediately after opening. This is true by default.
*/
public AbstractViewController(IViewContext viewContext, boolean validateOnOpen) {
super(viewContext, validateOnOpen);
}//AbstractViewController()//
/**
* AbstractViewController constructor.
* @param viewContext The view's context under which it will operate.
* @param reflectionContext The reflection context to be used by the view.
* @param validateOnOpen Whether the view should perform validation immediately after opening. This is true by default.
*/
public AbstractViewController(IViewContext context, ReflectionContext reflectionContext, boolean validateOnOpen) {
super(context, reflectionContext, validateOnOpen);
}//AbstractViewController()//
/**
* Gets the application object that this object is running under. The application object provides the object various services that it will need.
* @return The application reference for the application this object is running under.
*/
public IApplication getApplication() {
return WebServerManagerApplication.getSingleton();
}//getApplication()//
}//AbstractViewController//

View File

@@ -0,0 +1,408 @@
package com.foundation.web.manager.local.view.controller;
import com.common.util.IList;
import com.foundation.util.IManagedList;
import com.foundation.view.IViewContext;
import com.foundation.view.JefColor;
import com.foundation.web.manager.application.*;
import com.foundation.web.manager.local.view.MainView;
import com.foundation.web.manager.model.Server;
import com.foundation.web.monitor.shared.IWebServerInterface;
import com.foundation.web.monitor.shared.model.IWebServerStatus;
import com.foundation.web.monitor.shared.model.WebServerLog;
import com.foundation.web.server.shared.IWebServer;
import com.foundation.web.server.shared.model.WebappBundle;
import com.foundation.common.AttributeBinding;
import com.foundation.controller.IVetoableRunnable;
import com.foundation.event.model.IModelListenerAttributeHandler;
import com.foundation.event.model.IModelListenerCollectionHandler;
import com.foundation.event.model.ModelListener;
import com.foundation.metadata.Attribute;
import com.foundation.orb.Orb;
/**
* The control logic for the main local view.
*/
public class MainViewController extends AbstractViewController {
private static final JefColor COLOR_DISCONNECTED = new JefColor(255, 200, 200);
private static final JefColor COLOR_CONNECTED = new JefColor(255, 255, 255);
private static final JefColor COLOR_AUTH_FAILED = new JefColor(255, 255, 200);
private static final JefColor SELECTION_COLOR_DISCONNECTED = new JefColor(255, 200, 200);
private static final JefColor SELECTION_COLOR_CONNECTED = new JefColor(255, 255, 255);
private static final JefColor SELECTION_COLOR_AUTH_FAILED = new JefColor(255, 255, 200);
public static final Attribute SERVERS = registerCollection(MainViewController.class, "servers", AO_REFERENCED);
public static final Attribute SELECTED_SERVER = registerAttribute(MainViewController.class, "selectedServer");
public static final Attribute WEBAPPS = registerAttribute(MainViewController.class, "webapps");
public static final Attribute SELECTED_WEBAPP = registerAttribute(MainViewController.class, "selectedWebapp");
public static final Attribute WEB_SERVER_LOG = registerAttribute(MainViewController.class, "webServerLog");
public static final Attribute WEB_SERVER_LOG_TEXT = registerAttribute(MainViewController.class, "webServerLogText");
private ModelListener webappListener = null;
private ModelListener webServerLogListener = null;
/**
* MainViewController constructor.
* @param viewContext
*/
public MainViewController(IViewContext viewContext, IManagedList servers) {
super(viewContext);
setServers((IManagedList) getReflectionManager().createReflection(servers));
//Setup a listener to get the webapp bundles for the selected web server.//
webappListener = new ModelListener(this);
webappListener.addBinding(new AttributeBinding(MainViewController.class, MainViewController.SELECTED_SERVER));
webappListener.addBinding(new AttributeBinding(Server.class, Server.WEB_SERVER, AttributeBinding.FLAG_LAZY_LOAD_ATTRIBUTE, new IModelListenerAttributeHandler() {
public Class getReferenceType() {
return Server.class;
}//getReferenceType()//
public void run(Object object, int type, int flags, Object oldValue, Object newValue) {
if(newValue != null) {
IWebServerInterface webServerInterface = (IWebServerInterface) newValue;
IWebServer webServer = webServerInterface.getWebServer();
if(webServer != null) {
//Reflect the proxy of the list of WebappBundle instances.//
Orb.setAutoProxy(webServer, IManagedList.class);
IManagedList list = webServer.getWebappBundles();
list = (IManagedList) getReflectionManager().createReflection(list);
setWebapps(list);
}//if//
}//if//
else {
setWebapps(null);
}//else//
}//run()//
}, null));
webappListener.initialize();
//Setup a listener to set the web server log when the selected web server changes, and to update the log text when the logs change.//
webServerLogListener = new ModelListener(this);
webServerLogListener.addBinding(new AttributeBinding(MainViewController.class, MainViewController.SELECTED_SERVER));
webServerLogListener.addBinding(new AttributeBinding(Server.class, Server.WEB_SERVER, AttributeBinding.FLAG_LAZY_LOAD_ATTRIBUTE, new IModelListenerAttributeHandler() {
public Class getReferenceType() {
return Server.class;
}//getReferenceType()//
public void run(Object object, int type, int flags, Object oldValue, Object newValue) {
if(newValue != null) {
IWebServerInterface webServerInterface = (IWebServerInterface) newValue;
Orb.setAutoReflect(webServerInterface, getReflectionManager().getReflectionContext());
setWebServerLog(webServerInterface.getWebServerLog());
}//if//
else {
setWebServerLog(null);
}//else//
}//run()//
}, null));
webServerLogListener.addBinding(new AttributeBinding(MainViewController.class, MainViewController.WEB_SERVER_LOG));
webServerLogListener.addBinding(new AttributeBinding(WebServerLog.class, WebServerLog.LINES, AttributeBinding.FLAG_LAZY_LOAD_ATTRIBUTE, new IModelListenerAttributeHandler() {
public Class getReferenceType() {
return null;
}//getReferenceType()//
public void run(Object object, int type, int flags, Object oldValue, Object newValue) {
setWebServerLogText(null);
}//run()//
}, new IModelListenerCollectionHandler[] {new IModelListenerCollectionHandler() {
public Class getReferenceType() {
return null;
}//getReferenceType()//
public void run(Object object, int flags, IList addedValues, IList removedValues) {
if(getWebServerLog() != null) {
StringBuilder buffer = new StringBuilder(100000);
IManagedList logLines = getWebServerLog().getLines();
for(int index = 0, size = logLines.getSize(); index < size; index++) {
buffer.append(logLines.get(index));
}//for//
setWebServerLogText(buffer.toString());
}//if//
else {
setWebServerLogText(null);
}//else//
}//run()//
}}));
webServerLogListener.initialize();
}//MainViewController()//
/* (non-Javadoc)
* @see com.foundation.controller.AbstractViewController#postClose()
*/
protected void postClose() {
if(webappListener != null) {
try {webappListener.release();} catch(Throwable e) {}
webappListener = null;
}//if//
super.postClose();
}//postClose()//
/* (non-Javadoc)
* @see com.foundation.controller.RemoteViewController#getViewClass()
*/
protected Class getViewClass() {
return MainView.class;
}//getViewClass()//
/* (non-Javadoc)
* @see com.foundation.controller.ViewController#validate()
*/
public boolean validate() {
return true;
}//validate()//
/**
* Closes the main view.
*/
public void doClose() {
close();
WebServerManagerApplication.getSingleton().shutdown();
}//doClose()//
/**
* Adds a server to the list.
*/
public void doAddServer() {
final Server newServer = new Server();
final ServerEditorController controller = new ServerEditorController(getContext(), newServer);
controller.setPreCloseHandler(new IVetoableRunnable() {
public boolean run() {
return controller.getServer() != null ? getServers().add(newServer) != -1 && getReflectionManager().synchronizeAll() : true;
}//run()//
});
controller.open(this);
}//doAddServer()//
/**
* Edits a server in the list.
*/
public void doEditServer() {
if(getSelectedServer() != null) {
ServerEditorController controller = new ServerEditorController(getContext(), getSelectedServer().getReflected());
controller.open(this);
}//if//
}//doEditServer()//
/**
* Removes the selected server from the list.
*/
public void doRemoveServer() {
if(getSelectedServer() != null) {
getServers().remove(getSelectedServer());
getReflectionManager().synchronizeAll();
}//if//
}//doRemoveServer()//
/**
* Stops the selected server's web server component.
*/
public void doStopServer() {
if(getSelectedServer() != null) {
IWebServerInterface webServer = getSelectedServer().getWebServer();
Orb.setOneWayCall(webServer);
webServer.shutdown();
}//if//
}//doStopServer()//
/**
* Starts the selected server's web server component.
*/
public void doStartServer() {
if(getSelectedServer() != null) {
IWebServerInterface webServer = getSelectedServer().getWebServer();
Orb.setOneWayCall(webServer);
webServer.startup();
}//if//
}//doStartServer()//
/**
* Gets the displayed text for the web server status.
* @param status The status object.
* @return The text for the cell.
*/
public String getWebServerStatus(IWebServerStatus status) {
return status == null ? "" : status.getIsRunning() == null || !status.getIsRunning().booleanValue() ? "Shutdown" : "Running";
}//getWebServerStatus()//
/**
* Gets the displayed text for the web server status.
* @param status The status object.
* @return The text for the cell.
*/
public String getWebServerStatus(Server server) {
String result = "";
if(server != null) {
if(server.getStatus().equals(Server.STATUS_CONNECTED)) {
if(server.getWebServerStatus() != null && server.getWebServerStatus().getIsRunning() != null) {
if(server.getWebServerStatus().getIsRunning().booleanValue()) {
result = "Web Server Running";
}//if//
else {
result = "Web Server Stopped";
}//else//
}//if//
else {
result = "Unknown State";
}//else//
}//if//
else if(server.getStatus().equals(Server.STATUS_AUTH_FAILED)) {
result = "Authorization Failure";
}//else if//
else {
result = "Disconnected";
}//else//
}//if//
return result;
}//getWebServerStatus()//
/**
* Determines a color given the server's status.
* @param server
* @return
*/
public JefColor getColor(Server server) {
return server.getStatus() == null || server.getStatus().equals(server.STATUS_DISCONNECTED) ? COLOR_DISCONNECTED : server.getStatus().equals(server.STATUS_CONNECTED) ? COLOR_CONNECTED : COLOR_AUTH_FAILED;
}//getColor()//
/**
* Determines a color given the server's status.
* @param server
* @return
*/
public JefColor getSelectionColor(Server server) {
return server.getStatus() == null || server.getStatus().equals(server.STATUS_DISCONNECTED) ? SELECTION_COLOR_DISCONNECTED : server.getStatus().equals(server.STATUS_CONNECTED) ? SELECTION_COLOR_CONNECTED : SELECTION_COLOR_AUTH_FAILED;
}//getColor()//
/**
* Refreshes all the webapps on the selected server.
*/
public void doRefreshAllWebapps() {
if(getSelectedServer() != null) {
try {getSelectedServer().getWebServer().getWebServer().refreshWebapps();} catch(Throwable e) {}
}//if//
}//doRefreshAllWebapps()//
/**
* Refreshes the selected webapp.
*/
public void doRefreshWebapp() {
if(getSelectedWebapp() != null) {
try {getSelectedServer().getWebServer().getWebServer().refreshWebapp(getSelectedWebapp().getName());} catch(Throwable e) {}
}//if//
}//doRefreshWebappp()//
/**
* Refreshes the selected webapp.
*/
public void doReloadWebapp() {
if(getSelectedWebapp() != null) {
try {getSelectedServer().getWebServer().getWebServer().reloadWebapp(getSelectedWebapp().getName());} catch(Throwable e) {}
}//if//
}//doReloadWebappp()//
/**
* Refreshes the selected webapp.
*/
public void doUploadWebapp() {
if(getSelectedWebapp() != null) {
}//if//
}//doUploadWebappp()//
/**
* Refreshes the selected webapp.
*/
public void doRemoveWebapp() {
if(getSelectedWebapp() != null) {
try {getSelectedServer().getWebServer().getWebServer().removeWebapp(getSelectedWebapp().getName());} catch(Throwable e) {}
}//if//
}//doRemoveWebappp()//
///* (non-Javadoc)
// * @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
// */
//protected Object lazyLoadAttribute(Attribute attribute) {
// Object result = null;
//
// if(attribute == SERVERS) {
// result =
// }//if//
// else {
// result = super.lazyLoadAttribute(attribute);
// }//else//
//
// return result;
//}//lazyLoadAttribute()//
/**
* Gets the servers value.
* @return The servers value.
*/
public IManagedList getServers() {
return (IManagedList) getAttributeValue(SERVERS);
}//getServers()//
/**
* Sets the servers value.
* @param servers The servers value.
*/
private void setServers(IManagedList servers) {
setAttributeValue(SERVERS, servers);
}//setServers()//
/**
* Gets the selectedServer value.
* @return The selectedServer value.
*/
public Server getSelectedServer() {
return (Server) getAttributeValue(SELECTED_SERVER);
}//getSelectedServer()//
/**
* Sets the selectedServer value.
* @param selectedServer The selectedServer value.
*/
public void setSelectedServer(Server selectedServer) {
setAttributeValue(SELECTED_SERVER, selectedServer);
}//setSelectedServer()//
/**
* Gets the webapps value.
* @return The webapps value.
*/
public IManagedList getWebapps() {
return (IManagedList) getAttributeValue(WEBAPPS);
}//getWebapps()//
/**
* Sets the webapps value.
* @param webapps The webapps value.
*/
private void setWebapps(IManagedList webapps) {
setAttributeValue(WEBAPPS, webapps);
}//setWebapps()//
/**
* Gets the selectedWebapp value.
* @return The selectedWebapp value.
*/
public WebappBundle getSelectedWebapp() {
return (WebappBundle) getAttributeValue(SELECTED_WEBAPP);
}//getSelectedWebapp()//
/**
* Sets the selectedWebapp value.
* @param selectedWebapp The selectedWebapp value.
*/
public void setSelectedWebapp(WebappBundle selectedWebapp) {
setAttributeValue(SELECTED_WEBAPP, selectedWebapp);
}//setSelectedWebapp()//
/**
* Gets the webServerLog value.
* @return The webServerLog value.
*/
public WebServerLog getWebServerLog() {
return (WebServerLog) getAttributeValue(WEB_SERVER_LOG);
}//getWebServerLog()//
/**
* Sets the webServerLog value.
* @param webServerLog The webServerLog value.
*/
public void setWebServerLog(WebServerLog webServerLog) {
setAttributeValue(WEB_SERVER_LOG, webServerLog);
}//setWebServerLog()//
/**
* Gets the webServerLogText value.
* @return The webServerLogText value.
*/
public String getWebServerLogText() {
return (String) getAttributeValue(WEB_SERVER_LOG_TEXT);
}//getWebServerLogText()//
/**
* Sets the webServerLogText value.
* @param webServerLogText The webServerLogText value.
*/
public void setWebServerLogText(String webServerLogText) {
setAttributeValue(WEB_SERVER_LOG_TEXT, webServerLogText);
}//setWebServerLogText()//
}//MainViewController//

View File

@@ -0,0 +1,98 @@
package com.foundation.web.manager.local.view.controller;
import com.foundation.web.manager.local.view.ServerEditor;
import com.foundation.web.manager.model.Server;
import com.foundation.view.HighlightDecoration;
import com.foundation.view.IViewContext;
import com.foundation.view.ImageDecoration;
import com.foundation.view.JefColor;
import com.foundation.attribute.IReflectable;
import com.foundation.metadata.Attribute;
/**
* Edits an existing or new Server instance.
*/
public class ServerEditorController extends AbstractViewController {
public static final Attribute SERVER = registerAttribute(ServerEditorController.class, "server");
/**
* ServerEditorController constructor.
* @param context The context under which the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
* @param server The server to be edited.
*/
public ServerEditorController(IViewContext context, IReflectable server) {
super(context, false);
setServer((Server) getReflectionManager().createReflection(server));
}//ServerEditorController()//
/* (non-Javadoc)
* @see com.foundation.controller.AbstractViewController#getViewClass()
*/
protected Class getViewClass() {
return ServerEditor.class;
}//getViewClass()//
/* (non-Javadoc)
* @see com.declarativeengineering.jetson.view.controller.AbstractViewController#validate()
*/
public boolean validate() {
boolean result = true;
getDecorationManager().clearDecorations();
if(getServer().getName() == null) {
getDecorationManager().addDecoration(getServer(), Server.NAME, new ImageDecoration(IMAGE_ERROR));
result = false;
}//if//
if(getServer().getAddress() == null) {
getDecorationManager().addDecoration(getServer(), Server.ADDRESS, new ImageDecoration(IMAGE_ERROR));
result = false;
}//if//
if(getServer().getUser() == null) {
getDecorationManager().addDecoration(getServer(), Server.USER, new ImageDecoration(IMAGE_ERROR));
result = false;
}//if//
if(getServer().getPassword() == null) {
getDecorationManager().addDecoration(getServer(), Server.PASSWORD, new ImageDecoration(IMAGE_ERROR));
result = false;
}//if//
return result;
}//validate()//
/**
* Closes the window.
*/
public void doClose() {
setServer(null);
close();
}//doClose()//
/**
* Accepts changes and closes the dialog.
*/
public void doOk() {
synchronize();
getReflectionManager().synchronizeAll();
close();
}//doOk()//
/**
* Cancels the dialog.
*/
public void doCancel() {
setServer(null);
close();
}//doCancel()//
/**
* Gets the server value.
* @return The server value.
*/
public Server getServer() {
return (Server) getAttributeValue(SERVER);
}//getServer()//
/**
* Sets the server value.
* @param server The server value.
*/
public void setServer(Server server) {
setAttributeValue(SERVER, server);
}//setServer()//
}//ServerEditorController//

View File

@@ -0,0 +1,23 @@
package com.foundation.web.manager.model;
import com.foundation.application.*;
import com.foundation.web.manager.application.*;
/**
* The base class for all models for this application. The base class provides an opportunity to customize all models at once.
*/
public abstract class AbstractModel extends com.foundation.model.Model {
/**
* AbstractModel constructor.
*/
public AbstractModel() {
super();
}//AbstractModel()//
/**
* Gets the application object that this object is running under. The application object provides the object various services that it will need.
* @return The application reference for the application this object is running under.
*/
public IApplication getApplication() {
return WebServerManagerApplication.getSingleton();
}//getApplication()//
}//AbstractModel//

View File

@@ -0,0 +1,146 @@
package com.foundation.web.manager.model;
import com.foundation.metadata.Attribute;
import com.foundation.orb.Orb;
import com.foundation.web.monitor.shared.IWebServerInterface;
import com.foundation.web.monitor.shared.model.IWebServerStatus;
/**
* Models a server on a remote system.
*/
public class Server extends AbstractModel {
public static final Integer STATUS_DISCONNECTED = new Integer(0);
public static final Integer STATUS_CONNECTED = new Integer(1);
public static final Integer STATUS_AUTH_FAILED = new Integer(2);
public static final Attribute NAME = registerAttribute(Server.class, "name");
public static final Attribute ADDRESS = registerAttribute(Server.class, "address");
public static final Attribute USER = registerAttribute(Server.class, "user");
public static final Attribute PASSWORD = registerAttribute(Server.class, "password");
public static final Attribute WEB_SERVER = registerAttribute(Server.class, "webServer", AO_REFLECT_AS_IMMUTABLE);
public static final Attribute STATUS = registerAttribute(Server.class, "status", STATUS_DISCONNECTED);
public static final Attribute WEB_SERVER_STATUS = registerAttribute(Server.class, "webServerStatus");
/**
* Server constructor.
*/
public Server() {
}//Server()//
/**
* Server constructor.
*/
public Server(String name, String address, String user, String password) {
setName(name);
setAddress(address);
setUser(user);
setPassword(password);
}//Server()//
/**
* Gets the name value.
* @return The name value.
*/
public String getName() {
return (String) getAttributeValue(NAME);
}//getName()//
/**
* Sets the name value.
* @param name The name value.
*/
public void setName(String name) {
setAttributeValue(NAME, name);
}//setName()//
/**
* Gets the address value.
* @return The address value.
*/
public String getAddress() {
return (String) getAttributeValue(ADDRESS);
}//getAddress()//
/**
* Sets the address value.
* @param address The address value.
*/
public void setAddress(String address) {
setAttributeValue(ADDRESS, address);
}//setAddress()//
/**
* Gets the user value.
* @return The user value.
*/
public String getUser() {
return (String) getAttributeValue(USER);
}//getUser()//
/**
* Sets the user value.
* @param user The user value.
*/
public void setUser(String user) {
setAttributeValue(USER, user);
}//setUser()//
/**
* Gets the password value.
* @return The password value.
*/
public String getPassword() {
return (String) getAttributeValue(PASSWORD);
}//getPassword()//
/**
* Sets the password value.
* @param password The password value.
*/
public void setPassword(String password) {
setAttributeValue(PASSWORD, password);
}//setPassword()//
/**
* Gets the webServer value.
* @return The webServer value.
*/
public IWebServerInterface getWebServer() {
return (IWebServerInterface) getAttributeValue(WEB_SERVER);
}//getWebServer()//
/**
* Sets the webServer value.
* @param webServer The webServer value.
*/
public void setWebServer(IWebServerInterface webServer) {
setAttributeValue(WEB_SERVER, webServer);
if(webServer == null) {
setWebServerStatus(null);
}//if//
else {
//Tell the ORB to send an IReflectable proxy back instead of the usual result of the next call, and create a reflection from that proxy and return the reflection instead of a copy of the actual value.//
Orb.setAutoReflect(webServer, getReflectionContext());
// Orb.setAutoProxy(webServer, IWebServerStatus.class);
//Get the status model for the web server.//
setWebServerStatus(webServer.getStatus());
}//else//
}//setWebServer()//
/**
* Gets the status value.
* @return The status value.
*/
public Integer getStatus() {
return (Integer) getAttributeValue(STATUS);
}//getStatus()//
/**
* Sets the status value.
* @param status The status value.
*/
public void setStatus(Integer status) {
setAttributeValue(STATUS, status);
}//setStatus()//
/**
* Gets the webServerStatus value.
* @return The webServerStatus value.
*/
public IWebServerStatus getWebServerStatus() {
return (IWebServerStatus) getAttributeValue(WEB_SERVER_STATUS);
}//getWebServerStatus()//
/**
* Sets the webServerStatus value.
* @param webServerStatus The webServerStatus value.
*/
private void setWebServerStatus(IWebServerStatus webServerStatus) {
setAttributeValue(WEB_SERVER_STATUS, webServerStatus);
}//setWebServerStatus()//
}//Server//