User: jules_gosnell
  Date: 01/07/08 03:47:23

  Modified:    jetty/src/main/org/jboss/jetty JettyService.java
  Log:
  jetty.home is now statically configured - less code
  ensure webDefault and npackWars ARE set properly
  only support one config file
  
  Revision  Changes    Path
  1.18      +34 -57    contrib/jetty/src/main/org/jboss/jetty/JettyService.java
  
  Index: JettyService.java
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JettyService.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- JettyService.java 2001/06/23 10:08:30     1.17
  +++ JettyService.java 2001/07/08 10:47:23     1.18
  @@ -36,7 +36,7 @@
    *      
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Julian Gosnell</a>
  - *   @version $Revision: 1.17 $
  + *   @version $Revision: 1.18 $
    */
   
   class JettyMBean extends HttpServerMBean
  @@ -108,31 +108,6 @@
       ensureLogging();
     }
   
  -  //----------------------------------------
  -  // hack city...
  -  //----------------------------------------
  -
  -  protected static String _jettyHome=_getJettyHome();
  -
  -  static public String
  -    _getJettyHome()
  -  {
  -    try
  -    {      
  -      Class jettyClass = Class.forName("com.mortbay.HTTP.HttpServer");
  -      URL jettyUrl = jettyClass.getProtectionDomain().getCodeSource().getLocation();
  -      String jettyHome = new File(new 
File(jettyUrl.getFile()).getParent()).getParent();
  -
  -      return jettyHome;
  -    }
  -    catch (Exception e)
  -    {
  -      com.mortbay.Util.Log.warning("Could not figure out JBOSS_HOME - 
com.mortbay.HTTP.HttpServer displaced");
  -    }
  -    
  -    return null;
  -  }
  -
     //----------------------------------------------------------------------------
   
     public ObjectName
  @@ -177,11 +152,13 @@
       ensureJetty()
     {
       // make a Jetty...
  -    _jetty = new Jetty();
  +    Jetty jetty = new Jetty();       // tmp - until we have initialised it...
  +
  +    jetty.setJettyHome(getJettyHome());
  +    jetty.setWebDefault(getWebDefault());
  +    jetty.setUnpackWars(getUnpackWars());
   
  -    _jetty.setJettyHome(_jettyHome);
  -    _jetty.setWebDefault(getWebDefault());
  -    _jetty.setUnpackWars(getUnpackWars());
  +    _jetty=jetty;            // now we are initialised.
   
       com.mortbay.Util.Log.event("instantiated and configured server");
   
  @@ -217,20 +194,7 @@
         com.mortbay.Util.Log.event("MBean peers WILL NOT be created for Jetty 
Contexts");
       }
   
  -    for (int i=0; i<_configuration.size(); i++)
  -    {
  -      try
  -      {
  -     String config=(String)_configuration.elementAt(i);
  -     com.mortbay.Util.Log.event("loading config: "+config);
  -     _jetty.configure(config);
  -     com.mortbay.Util.Log.event("loaded config: "+config);
  -      }
  -      catch(IOException e)
  -      {
  -     e.printStackTrace();
  -      }
  -    }
  +    _jetty.setConfiguration(_configuration);
     }
   
     protected void
  @@ -407,7 +371,7 @@
   
     //----------------------------------------------------------------------------
     
  -  protected String _webDefault=_jettyHome+"/etc/webdefault.xml";
  +  protected String _webDefault=null;
   
     public String
       getWebDefault()
  @@ -431,30 +395,32 @@
   
     //----------------------------------------------------------------------------
     
  -  protected Vector _configuration=new Vector();
  +  protected String _configuration=null;
   
  -  //deprecated
  -  public void
  -    setConfiguration(String configUrl)
  +  public String
  +    getConfiguration()
     {
  -    com.mortbay.Util.Log.event("setConfiguration() is deprecated - use 
addConfiguration()");
  -    addConfiguration(configUrl);
  +    if (isInitialised())
  +      return _jetty.getConfiguration();
  +    else
  +      return _configuration;
     }
   
     public void
  -    addConfiguration(String configUrl)
  +    setConfiguration(String configUrl)
     {
  -    com.mortbay.Util.Log.event("added Configuration "+configUrl);
  +    com.mortbay.Util.Log.event("set Configuration to "+configUrl);
   
       if (isInitialised())
  -      _jetty.addConfiguration(configUrl);
  +      _jetty.setConfiguration(configUrl);
       else
  -      _configuration.add(configUrl);
  +      _configuration=configUrl;
     }
  -
  +  
     //----------------------------------------------------------------------------
  -  // TODO
   
  +  protected static String _jettyHome=null;
  +
     public String
       getJettyHome()
     {
  @@ -462,5 +428,16 @@
         return _jetty.getJettyHome();
       else
         return _jettyHome;
  +  }
  +
  +  public void
  +    setJettyHome(String jettyHome)
  +  {
  +    com.mortbay.Util.Log.event("set JettyHome to "+jettyHome);
  +
  +    if (isInitialised())
  +      _jetty.setJettyHome(jettyHome);
  +    else
  +      _jettyHome=jettyHome;
     }
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to