implemented IPathElement
added public functions for base app: static getServer, startApplication, stopApplication, getAppsHome, getProperties, getProperty, getApplication
This commit is contained in:
		
							parent
							
								
									b52c3e54b4
								
							
						
					
					
						commit
						3c16c722a7
					
				
					 1 changed files with 74 additions and 4 deletions
				
			
		|  | @ -22,9 +22,10 @@ import com.sleepycat.db.*; | |||
|  * Helma server main class. | ||||
|  */ | ||||
|   | ||||
|  public class Server { | ||||
|  public class Server implements IPathElement	{ | ||||
| 
 | ||||
|     public static final String version = "1.2pre2 2002/02/25"; | ||||
|     public static final String version = "1.2pre2 2002/03/07"; | ||||
|     public static final long starttime = System.currentTimeMillis(); | ||||
| 
 | ||||
|     public static boolean useTransactions = true; | ||||
|     public static boolean paranoid; | ||||
|  | @ -47,6 +48,8 @@ import com.sleepycat.db.*; | |||
| 
 | ||||
|     static Hashtable dbSources; | ||||
| 
 | ||||
| 	static Server server; | ||||
| 
 | ||||
|     protected static File hopHome = null; | ||||
| 
 | ||||
|     private static Logger logger; | ||||
|  | @ -107,7 +110,7 @@ import com.sleepycat.db.*; | |||
| 	    System.exit (0); | ||||
| 	} | ||||
| 
 | ||||
| 	new Server (homeDir); | ||||
| 	server = new Server (homeDir); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|  | @ -277,6 +280,13 @@ import com.sleepycat.db.*; | |||
| 		return appManager.getApplications (); | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Get an Application by name | ||||
|      */ | ||||
|     public Application getApplication(String name)	{ | ||||
|     	return appManager.getApplication(name); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      *  Get a logger to use for output in this server. | ||||
|      */ | ||||
|  | @ -310,6 +320,13 @@ import com.sleepycat.db.*; | |||
|     } | ||||
| 
 | ||||
| 	/** | ||||
|      * Get the main Server | ||||
|      */ | ||||
| 	public static Server getServer()	{ | ||||
| 		return server; | ||||
| 	} | ||||
| 
 | ||||
|     /** | ||||
|     *  Get the Server's  XML-RPC web server. | ||||
|     */ | ||||
|     public static WebServer getXmlRpcServer() { | ||||
|  | @ -329,4 +346,57 @@ import com.sleepycat.db.*; | |||
| 	throw new Exception ("Error: Server already running on this port"); | ||||
|     } | ||||
| 
 | ||||
| 	public static String getProperty( String key )	{ | ||||
| 		return (String)sysProps.get(key);		 | ||||
| 	} | ||||
| 	 | ||||
| 	public static SystemProperties getProperties()	{ | ||||
| 		return sysProps; | ||||
| 	} | ||||
| 
 | ||||
| 	public static File getAppsHome()	{ | ||||
| 		String appHome = sysProps.getProperty ("appHome"); | ||||
| 		if (appHome != null && !"".equals (appHome.trim())) | ||||
| 		    return new File (appHome); | ||||
| 		else | ||||
| 	    	return new File (hopHome, "apps"); | ||||
| 	} | ||||
| 
 | ||||
| 	public void startApplication(String name)	{ | ||||
| 		appManager.start(name,false); | ||||
| 		appManager.register(name,false); | ||||
| 	} | ||||
| 	 | ||||
| 	public void stopApplication(String name)	{ | ||||
| 		appManager.stop(name); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	  * method from helma.framework.IPathElement | ||||
| 	  */ | ||||
| 	public String getElementName()	{ | ||||
| 		return "root"; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	  * method from helma.framework.IPathElement, | ||||
| 	  * returning active applications | ||||
| 	  */ | ||||
| 	public IPathElement getChildElement(String name)	{ | ||||
| 		return appManager.getApplication(name); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	  * method from helma.framework.IPathElement | ||||
| 	  */ | ||||
| 	public IPathElement getParentElement()	{ | ||||
| 		return null; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	  * method from helma.framework.IPathElement | ||||
| 	  */ | ||||
| 	public String getPrototype()	{ | ||||
| 		return "root"; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue