costin      2003/03/16 23:30:10

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardEngine.java
  Log:
  If not registered yet - register ourself. That will replace the 
ServerLifecycleListener
  for standalone case - in embeded we are already registered by the JMX.
  
  Revision  Changes    Path
  1.5       +41 -4     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java
  
  Index: StandardEngine.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardEngine.java       7 Mar 2003 16:01:35 -0000       1.4
  +++ StandardEngine.java       17 Mar 2003 07:30:09 -0000      1.5
  @@ -80,6 +80,8 @@
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Service;
  +import org.apache.catalina.Realm;
  +import org.apache.catalina.realm.JAASRealm;
   import org.apache.catalina.util.ServerInfo;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -168,6 +170,19 @@
   
       // ------------------------------------------------------------- Properties
   
  +    /** Provide a default in case no explicit configuration is set
  +     *
  +     * @return configured realm, or a JAAS realm by default
  +     */
  +    public Realm getRealm() {
  +        Realm configured=super.getRealm();
  +        if( configured==null ) {
  +            configured=new JAASRealm();
  +            this.setRealm( configured );
  +        }
  +        return configured;
  +    }
  +
   
       /**
        * Return the default host.
  @@ -363,6 +378,19 @@
        * @exception LifecycleException if a startup error occurs
        */
       public void start() throws LifecycleException {
  +        if( started ) {
  +            return;
  +        }
  +        if( oname==null ) {
  +            // not registered in JMX yet - standalone mode
  +            try {
  +                domain=getName();
  +                log.info( "Register " + domain );
  +                oname=new ObjectName(domain + ":type=Engine");
  +            } catch( Throwable t ) {
  +                log.info("Error registering ", t );
  +            }
  +        }
   
           // Log our server identification information
           //System.out.println(ServerInfo.getServerInfo());
  @@ -426,4 +454,13 @@
   
           return name;
       }
  +
  +    public ObjectName createObjectName(String domain, ObjectName parent)
  +        throws Exception
  +    {
  +        if( log.isDebugEnabled())
  +            log.debug("Create ObjectName " + domain + " " + parent );
  +        return new ObjectName( domain + ":type=Engine");
  +    }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to