jon         01/05/19 14:44:09

  Modified:    src/java/org/apache/turbine/services BaseInitableBroker.java
                        BaseServiceBroker.java
               src/java/org/apache/turbine/services/intake
                        TurbineIntakeService.java
               src/java/org/apache/turbine/services/pull
                        TurbinePullService.java
               src/java/org/apache/turbine/services/servlet
                        TurbineServletService.java
               src/java/org/apache/turbine/services/upload
                        BaseUploadService.java
  Log:
  make the upload service startup late
  
  clean up some line wrapping in the services system
  
  added some more debugging output (to tell how long it takes a service to
  startup)
  
  intake: moved the appData.ser file to the WEB-INF directory.
  
  Revision  Changes    Path
  1.25      +15 -8     
jakarta-turbine/src/java/org/apache/turbine/services/BaseInitableBroker.java
  
  Index: BaseInitableBroker.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/BaseInitableBroker.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- BaseInitableBroker.java   2001/05/05 13:26:55     1.24
  +++ BaseInitableBroker.java   2001/05/19 21:44:06     1.25
  @@ -86,7 +86,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kevin Burton</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
  - * @version $Id: BaseInitableBroker.java,v 1.24 2001/05/05 13:26:55 jvanzyl Exp $
  + * @version $Id: BaseInitableBroker.java,v 1.25 2001/05/19 21:44:06 jon Exp $
    */
   public abstract class BaseInitableBroker
       implements InitableBroker
  @@ -175,13 +175,15 @@
               if(initable.getInit())
               {
                   initable.shutdown();
  +                ((BaseInitable)initable).setInit(false);
               }
           }
           catch( InstantiationException e )
           {
               // Shutdown of a nonexistent class was requested.
               // This does not hurt anything, so we log the error and continue.
  -            error(new TurbineException("Shutdown of a nonexistent class 
"+className+" was requested", e));
  +            error(new TurbineException("Shutdown of a nonexistent class " + 
  +                    className + " was requested", e));
           }
       }
   
  @@ -219,7 +221,8 @@
                           // getInit() returning false indicates some initialization 
issue,
                           // which in turn prevents the InitableBroker from passing a 
working
                           // instance of the initable to the client.
  -                        throw new InitializationException("init() failed to 
initialize class "+className);
  +                        throw new InitializationException(
  +                            "init() failed to initialize class " + className);
                       }
                   }
               }
  @@ -227,7 +230,8 @@
           }
           catch( InitializationException e )
           {
  -            throw new InstantiationException("Class "+className+" failed to 
initialize", e);
  +            throw new InstantiationException("Class " + className + 
  +                            " failed to initialize", e);
           }
       }
   
  @@ -271,19 +275,22 @@
   
                   if(t instanceof NoClassDefFoundError)
                   {
  -                    msg = "A class referenced by "+className+" is unavailable. 
Check your jars and classes.";
  +                    msg = "A class referenced by " + className + 
  +                        " is unavailable. Check your jars and classes.";
                   }
                   else if(t instanceof ClassNotFoundException)
                   {
  -                    msg = "Class "+className+" is unavailable. Check your jars and 
classes.";
  +                    msg = "Class " + className + 
  +                        " is unavailable. Check your jars and classes.";
                   }
                   else if(t instanceof ClassCastException)
                   {
  -                    msg = "Class "+className+" doesn't implement Initable.";
  +                    msg = "Class " + className + 
  +                        " doesn't implement Initable.";
                   }
                   else 
                   {
  -                    msg = "Failed to instantiate "+className;
  +                    msg = "Failed to instantiate " + className;
                   }
                   
                   throw new InstantiationException(msg, t);   
  
  
  
  1.22      +19 -14    
jakarta-turbine/src/java/org/apache/turbine/services/BaseServiceBroker.java
  
  Index: BaseServiceBroker.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/BaseServiceBroker.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- BaseServiceBroker.java    2001/05/05 13:26:55     1.21
  +++ BaseServiceBroker.java    2001/05/19 21:44:07     1.22
  @@ -78,7 +78,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kevin Burton</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
  - * @version $Id: BaseServiceBroker.java,v 1.21 2001/05/05 13:26:55 jvanzyl Exp $
  + * @version $Id: BaseServiceBroker.java,v 1.22 2001/05/19 21:44:07 jon Exp $
    */
   public class BaseServiceBroker
       extends BaseInitableBroker
  @@ -155,14 +155,15 @@
       public void initServices( Object data, boolean report )
           throws InstantiationException, InitializationException
       {
  -        notice("Initializing all services using: " + data.getClass().getName());
  +        notice("Initializing all services using: " + 
  +                data.getClass().getName());
           Iterator names = mapping.getKeys();
           // throw exceptions 
           if(report) 
           {
               while(names.hasNext())
               {
  -                doInitService(data, names);
  +                doInitService(data, (String)names.next());
               }
           }
           // eat exceptions
  @@ -172,7 +173,7 @@
               {
                   try
                   {
  -                    doInitService(data, names);
  +                    doInitService(data, (String)names.next());
                   }
                   // In case of an exception, file an error message; the
                   // system may be still functional, though.
  @@ -193,11 +194,10 @@
        * Internal utility method for use in initServices()
        * to prevent duplication of code.
        */
  -    private void doInitService(Object data, Iterator names)
  +    private void doInitService(Object data, String name)
           throws InstantiationException, InitializationException
       {
  -        String name = (String)names.next();
  -        notice("Initializing service (early): " + name);
  +        notice("Start Initializing service (early): " + name);
   
           // Make sure the service has it's name and broker
           // reference set before initialization.
  @@ -205,6 +205,8 @@
           
           // Perform early initialization.
           initClass(mapping.getString(name), data);
  +
  +        notice("Finish Initializing service (early): " + name);
       }
   
       /**
  @@ -237,7 +239,7 @@
           {
               serviceName = (String)serviceNames.nextElement();
               notice("Shutting down service: " + serviceName);
  -            shutdownClass((String)mapping.get(serviceName));
  +            shutdownService(serviceName);
           }
       }
   
  @@ -262,8 +264,9 @@
                   {
                       if(!service.getInit())
                       {
  -                        notice("Initializing service (late): " + name);
  +                        notice("Start Initializing service (late): " + name);
                           service.init();
  +                        notice("Finish Initializing service (late): " + name);
                       }
                   }
               }
  @@ -273,13 +276,15 @@
                   // getInit() returning false indicates some initialization issue,
                   // which in turn prevents the InitableBroker from passing a
                   // reference to a working instance of the initable to the client.
  -                throw new InitializationException("init() failed to initialize 
service "+name);
  +                throw new InitializationException(
  +                    "init() failed to initialize service " + name);
               }
               return service;
           }
           catch( InitializationException e )
           {
  -            throw new InstantiationException("Service "+name+" failed to 
initialize", e);
  +            throw new InstantiationException("Service " + name + 
  +                " failed to initialize", e);
           }
       }
   
  @@ -311,7 +316,7 @@
               if(className == null)
               {
                   throw new InstantiationException(
  -                    "ServiceBroker: unknown service "+name+" requested");
  +                    "ServiceBroker: unknown service " + name + " requested");
               }
               try
               {
  @@ -320,13 +325,13 @@
               catch(ClassCastException e)
               {
                   throw new InstantiationException(
  -                    "ServiceBroker: class "+className+
  +                    "ServiceBroker: class " + className +
                       " does not implement Service interface.", e);
               }
               catch(InstantiationException e)
               {
                   throw new InstantiationException(
  -                    "Failed to instantiate service "+name, e);
  +                    "Failed to instantiate service " + name, e);
               }
               service.setServiceBroker(this);
               service.setName(name);
  
  
  
  1.13      +2 -2      
jakarta-turbine/src/java/org/apache/turbine/services/intake/TurbineIntakeService.java
  
  Index: TurbineIntakeService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/intake/TurbineIntakeService.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TurbineIntakeService.java 2001/05/17 00:58:45     1.12
  +++ TurbineIntakeService.java 2001/05/19 21:44:07     1.13
  @@ -94,7 +94,7 @@
    * on an XML specification.
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>John McNally</a>
  - * @version $Id: TurbineIntakeService.java,v 1.12 2001/05/17 00:58:45 jmcnally Exp $
  + * @version $Id: TurbineIntakeService.java,v 1.13 2001/05/19 21:44:07 jon Exp $
    */
   public class TurbineIntakeService
       extends TurbineBaseService
  @@ -147,7 +147,7 @@
       {
           Properties props = getProperties();
           String xmlPath = props.getProperty(XML_PATH);
  -        String appDataPath = "appData.ser";
  +        String appDataPath = "WEB-INF/appData.ser";
           try
           {
               // If possible, transform paths to be webapp root relative.
  
  
  
  1.20      +4 -2      
jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePullService.java
  
  Index: TurbinePullService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TurbinePullService.java   2001/05/12 00:03:53     1.19
  +++ TurbinePullService.java   2001/05/19 21:44:08     1.20
  @@ -147,7 +147,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sean Legassick</a>
  - * @version $Id: TurbinePullService.java,v 1.19 2001/05/12 00:03:53 mpoeschl Exp $
  + * @version $Id: TurbinePullService.java,v 1.20 2001/05/19 21:44:08 jon Exp $
    */
   public class TurbinePullService extends TurbineBaseService 
       implements PullService
  @@ -269,6 +269,8 @@
        */
       private void initPull() throws Exception
       {
  +
  +        Log.debug ("Start PullService init()");
           Properties props = getProperties();
   
           /*
  @@ -337,7 +339,7 @@
            */
           globalContext = new VelocityContext();
           populateWithGlobalTools(globalContext);
  -
  +        Log.debug ("Finish PullService init()");
       }
   
       /**
  
  
  
  1.10      +5 -2      
jakarta-turbine/src/java/org/apache/turbine/services/servlet/TurbineServletService.java
  
  Index: TurbineServletService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/servlet/TurbineServletService.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TurbineServletService.java        2001/04/26 18:17:03     1.9
  +++ TurbineServletService.java        2001/05/19 21:44:08     1.10
  @@ -83,7 +83,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Santiago Gala</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens</a>
  - * @version $Id: TurbineServletService.java,v 1.9 2001/04/26 18:17:03 jon Exp $
  + * @version $Id: TurbineServletService.java,v 1.10 2001/05/19 21:44:08 jon Exp $
    */
   public class TurbineServletService 
       extends TurbineBaseService implements ServletService
  @@ -132,7 +132,6 @@
           /* 
            * Allow Turbine to work with both 2.2 (and 2.1) and 2.0
            * Servlet API.
  -         */ 
           Class jsdkClass = HttpServletRequest.class;
           
           try
  @@ -149,6 +148,9 @@
               // null.
               contextPath = "";
           }
  +         */ 
  +
  +        contextPath = data.getRequest().getContextPath();
   
           Log.debug("[TurbineServletService] serverName: " + serverName);
           Log.debug("[TurbineServletService] serverScheme: " + serverScheme);
  @@ -156,6 +158,7 @@
           Log.debug("[TurbineServletService] contextPath: " + contextPath);
   
           setInit(true);
  +        System.out.println ("init(RD) Finish: " + new java.util.Date() );
       }
   
       /**
  
  
  
  1.2       +6 -18     
jakarta-turbine/src/java/org/apache/turbine/services/upload/BaseUploadService.java
  
  Index: BaseUploadService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/upload/BaseUploadService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseUploadService.java    2001/05/18 18:21:15     1.1
  +++ BaseUploadService.java    2001/05/19 21:44:08     1.2
  @@ -54,23 +54,11 @@
    * <http://www.apache.org/>.
    */
   
  -import java.io.IOException;
  -import java.io.InputStream;
  -import java.io.OutputStream;
  -import java.util.Hashtable;
  -import java.util.Properties;
  -import javax.servlet.ServletConfig;
  -import javax.servlet.ServletContext;
  -import javax.servlet.ServletInputStream;
  -import javax.servlet.ServletRequest;
   import javax.servlet.http.HttpServletRequest;
  -import org.apache.turbine.services.BaseService;
   import org.apache.turbine.services.TurbineBaseService;
  +import org.apache.turbine.services.servlet.TurbineServlet;
   import org.apache.turbine.util.ParameterParser;
   import org.apache.turbine.util.TurbineException;
  -import org.apache.turbine.util.ValueParser;
  -import org.apache.turbine.util.upload.FileItem;
  -import org.apache.turbine.util.upload.MultipartStream;
   
   /**
    * <p> This class is a base implementation of
  @@ -78,7 +66,8 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
  - * @version $Id: BaseUploadService.java,v 1.1 2001/05/18 18:21:15 dlr Exp $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens</a>
  + * @version $Id: BaseUploadService.java,v 1.2 2001/05/19 21:44:08 jon Exp $
    */
   public abstract class BaseUploadService
       extends TurbineBaseService
  @@ -95,23 +84,22 @@
        *
        * This method processes the repository path, to make it relative to the
        * web application root, if neccessary
  -     *
  -     * @param config the ServletConfig of the Turbine servlet
        */
  -    public void init(ServletConfig config)
  +    public void init()
       {
           String path = getProperties()
               .getProperty(UploadService.REPOSITORY_KEY,
                            UploadService.REPOSITORY_DEFAULT.toString());
           if(!path.startsWith("/")) 
           {
  -            String realPath = config.getServletContext().getRealPath(path);
  +            String realPath = TurbineServlet.getRealPath(path);
               if(realPath != null)
               {
                   path = realPath;
               }
           }
           getProperties().setProperty(UploadService.REPOSITORY_KEY, path);
  +        setInit(true);
       }
   
       /**
  
  
  

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

Reply via email to