1 /*2 * EJTools, the Enterprise Java Tools3 *4 * Distributable under LGPL license.5 * See terms of license at www.gnu.org.6 */7 package net.sourceforge.ejtools.deploy;8 9 // Standard Imports10 import java.beans.beancontext.BeanContextServicesSupport ;11 import java.util.Iterator ;12 import java.util.ResourceBundle ;13 import java.util.Vector ;14 15 import net.sourceforge.ejtools.deploy.factories.FactoryManagerServiceProvider;16 17 import org.apache.log4j.Category;18 import org.ejtools.adwt.BeanContextListPanel;19 import org.ejtools.adwt.action.Command;20 import org.ejtools.adwt.action.CommandAction;21 import org.ejtools.adwt.action.file.ExitAction;22 import org.ejtools.adwt.service.AboutServiceProvider;23 import org.ejtools.adwt.service.MenuBarServiceProvider;24 import org.ejtools.adwt.service.SDIFrameServiceProvider;25 import org.ejtools.adwt.service.StatusBarServiceProvider;26 import org.ejtools.adwt.service.ToolBarServiceProvider;27 28 /**29 * Description of the Class30 *31 * @author letiembl32 * @created 21 mars 200233 * @todo Javadoc to complete34 * @todo Add log4j logs35 * @todo I18N to complete36 * @todo Clean services used37 */38 public class DeploymentBrowser extends BeanContextServicesSupport 39 {40 /** Description of the Field */41 AboutServiceProvider aboutService;42 /** Description of the Field */43 CommandAction action = null;44 /** Description of the Field */45 FactoryManagerServiceProvider factoryManagerService;46 /** Description of the Field */47 SDIFrameServiceProvider frameService;48 /** Description of the Field */49 MenuBarServiceProvider menuBarService;50 /** Description of the Field */51 StatusBarServiceProvider statusBarService;52 /** Description of the Field */53 ToolBarServiceProvider toolBarService;54 /** Description of the Field */55 private static Category cat = Category.getInstance(DeploymentBrowser.class.getName());56 /** Description of the Field */57 private static Vector factories;58 /** Description of the Field */59 private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources");60 61 62 /** Constructor for the DeploymentBrowser object */63 public DeploymentBrowser()64 {65 cat.debug("Deployment Console starting...");66 67 frameService = new SDIFrameServiceProvider();68 aboutService = new AboutServiceProvider(new AboutDialog());69 menuBarService = new MenuBarServiceProvider();70 toolBarService = new ToolBarServiceProvider();71 statusBarService = new StatusBarServiceProvider();72 factoryManagerService = new FactoryManagerServiceProvider();73 74 try75 {76 /*77 * WarProxy proxy = new WarProxy(Thread.currentThread().getContextClassLoader(), (new File("../conf/jmx.browser.war")).toURL());78 * System.out.println(proxy.toString());79 * String[] result = proxy.getText("//init-param");80 * for(int i = 0; i < result.length; i++) {81 * System.out.println(result[i]);82 * }83 */84 add(menuBarService);85 86 frameService.setTitle(res.getString("title.application"));87 88 add(factoryManagerService);89 90 add(new ExitAction(91 new Command()92 {93 public void execute()94 {95 System.exit(0);96 }97 }98 ));99 100 factoryManagerService.loadFactories();101 Iterator it = factoryManagerService.listFactories();102 while (it.hasNext())103 {104 System.out.println("FACT " + it.next());105 }106 107 frameService.setContent(new BeanContextListPanel(factoryManagerService));108 109 add(frameService);110 add(aboutService);111 }112 catch (RuntimeException e)113 {114 cat.warn("Error occured " + e.getMessage());115 throw e;116 }117 catch (Exception e)118 {119 e.printStackTrace();120 }121 }122 }123 124