xlawrence    2005/08/05 15:58:20 CEST

  Modified files:
    core/src/java/org/jahia/bin JahiaAdministration.java 
    core/src/java/org/jahia/data/containers JahiaContainer.java 
    core/src/java/org/jahia/engines EngineToolBox.java 
    core/src/java/org/jahia/engines/lock LockEngine.java 
    core/src/java/org/jahia/engines/updatecontainer 
                                                    UpdateContainer_Engine.java 
    core/src/java/org/jahia/params ParamBean.java 
                                   ProcessingContextFactoryImpl.java 
    core/src/java/org/jahia/resourcebundle 
                                           JahiaResourceBundle.java 
    core/src/java/org/jahia/services/containers 
                                                ContentContainer.java 
    core/src/java/org/jahia/services/lock LockKey.java 
  Log:
  Code cleanUp
  
  Revision  Changes    Path
  1.17      +3 -7      
jahia/core/src/java/org/jahia/bin/JahiaAdministration.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/JahiaAdministration.java.diff?r1=1.16&r2=1.17&f=h
  1.7       +6 -8      
jahia/core/src/java/org/jahia/data/containers/JahiaContainer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/data/containers/JahiaContainer.java.diff?r1=1.6&r2=1.7&f=h
  1.6       +26 -27    jahia/core/src/java/org/jahia/engines/EngineToolBox.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/engines/EngineToolBox.java.diff?r1=1.5&r2=1.6&f=h
  1.5       +11 -2     
jahia/core/src/java/org/jahia/engines/lock/LockEngine.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/engines/lock/LockEngine.java.diff?r1=1.4&r2=1.5&f=h
  1.17      +3 -3      
jahia/core/src/java/org/jahia/engines/updatecontainer/UpdateContainer_Engine.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/engines/updatecontainer/UpdateContainer_Engine.java.diff?r1=1.16&r2=1.17&f=h
  1.26      +23 -19    jahia/core/src/java/org/jahia/params/ParamBean.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/params/ParamBean.java.diff?r1=1.25&r2=1.26&f=h
  1.2       +9 -8      
jahia/core/src/java/org/jahia/params/ProcessingContextFactoryImpl.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/params/ProcessingContextFactoryImpl.java.diff?r1=1.1&r2=1.2&f=h
  1.4       +88 -73    
jahia/core/src/java/org/jahia/resourcebundle/JahiaResourceBundle.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/resourcebundle/JahiaResourceBundle.java.diff?r1=1.3&r2=1.4&f=h
  1.15      +4 -0      
jahia/core/src/java/org/jahia/services/containers/ContentContainer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/containers/ContentContainer.java.diff?r1=1.14&r2=1.15&f=h
  1.3       +25 -19    jahia/core/src/java/org/jahia/services/lock/LockKey.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/lock/LockKey.java.diff?r1=1.2&r2=1.3&f=h
  
  
  
  Index: JahiaAdministration.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/bin/JahiaAdministration.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JahiaAdministration.java  21 Jul 2005 15:07:22 -0000      1.16
  +++ JahiaAdministration.java  5 Aug 2005 13:58:17 -0000       1.17
  @@ -1,4 +1,4 @@
  -// $Id: JahiaAdministration.java,v 1.16 2005/07/21 15:07:22 shuber Exp $
  +// $Id: JahiaAdministration.java,v 1.17 2005/08/05 13:58:17 xlawrence Exp $
   //
   //                                   ____.
   //                       __/\ ______|    |__/\.     _______
  @@ -84,7 +84,6 @@
   import org.jahia.params.ProcessingContextFactory;
   import org.jahia.registries.ServicesRegistry;
   import org.jahia.resourcebundle.JahiaResourceBundle;
  -import org.jahia.services.applications.*;
   import org.jahia.services.pages.ContentPage;
   import org.jahia.services.sites.JahiaSite;
   import org.jahia.services.usermanager.JahiaGroup;
  @@ -98,10 +97,8 @@
   import org.jahia.admin.categories.ManageCategories;
   import org.jahia.security.license.Limit;
   import org.jahia.security.license.DaysLeftValidator;
  -import java.util.Date;
   import org.jahia.utils.PathResolver;
   import org.jahia.utils.WebAppPathResolver;
  -import org.jahia.services.cache.CacheFactory;
   import org.springframework.beans.factory.BeanFactory;
   
   import java.util.Collections;
  @@ -521,11 +518,10 @@
   
           JahiaData jData = 
(JahiaData)request.getAttribute("org.jahia.data.JahiaData");
           if ( jData != null ){
  -          ParamBean jParams = jData.getParamBean();
  +          final ParamBean jParams = (ParamBean)jData.getProcessingContext();
             try {
               String htmlContent = ServicesRegistry.getInstance().
  -                getJahiaFetcherService()
  -                .fetchServlet(jParams, destination);
  +                getJahiaFetcherService().fetchServlet(jParams, destination);
   
               if (jParams.getRedirectLocation() != null) {
                 logger.debug(
  
  
  
  Index: JahiaContainer.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/data/containers/JahiaContainer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JahiaContainer.java       5 Jul 2005 15:46:00 -0000       1.6
  +++ JahiaContainer.java       5 Aug 2005 13:58:18 -0000       1.7
  @@ -304,10 +304,9 @@
        */
       public void clearFields(){
           if ( this.fields != null && this.fields.size()>0 ){
  -            Enumeration enum = this.fields.elements();
  -            JahiaField f = null;
  -            while ( enum.hasMoreElements() ){
  -                f = (JahiaField)enum.nextElement();
  +            final Enumeration fields = this.fields.elements();
  +            while ( fields.hasMoreElements() ){
  +                final JahiaField f = (JahiaField)fields.nextElement();
                   try {
                       this.children.remove(f.getDefinition().getName());
                   } catch ( JahiaException je ){
  @@ -323,10 +322,9 @@
        */
       public void clearContainerLists(){
           if ( this.containerLists !=null && this.containerLists.size()>0 ){
  -            Enumeration enum = this.containerLists.elements();
  -            JahiaContainerList cList = null;
  -            while ( enum.hasMoreElements() ){
  -                cList = (JahiaContainerList)enum.nextElement();
  +            final Enumeration containers = this.containerLists.elements();
  +            while ( containers.hasMoreElements() ){
  +                final JahiaContainerList cList = 
(JahiaContainerList)containers.nextElement();
                   try {
                       this.children.remove(cList.getDefinition().getName());
                   } catch ( JahiaException je ){
  
  
  
  Index: EngineToolBox.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/engines/EngineToolBox.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EngineToolBox.java        5 Jul 2005 15:46:08 -0000       1.5
  +++ EngineToolBox.java        5 Aug 2005 13:58:18 -0000       1.6
  @@ -10,7 +10,7 @@
   //                 . . . i n   j a h i a   w e   t r u s t . . .
   //
   //
  -// $Id: EngineToolBox.java,v 1.5 2005/07/05 15:46:08 shuber Exp $
  +// $Id: EngineToolBox.java,v 1.6 2005/08/05 13:58:18 xlawrence Exp $
   
   //
   //  EV  10.01.20001
  @@ -40,7 +40,7 @@
   
   public class EngineToolBox {
   
  -    private static EngineToolBox instance = null;
  +    private static final EngineToolBox instance = new EngineToolBox ();
   
       private static final String MSG_INTERNAL_ERROR = new String (
               "Audit Log Manager internal error");
  @@ -63,10 +63,7 @@
       /**
        * returns a single instance of the object
        */
  -    public static synchronized EngineToolBox getInstance () {
  -        if (instance == null) {
  -            instance = new EngineToolBox ();
  -        }
  +    public static final EngineToolBox getInstance () {
           return instance;
       }
   
  @@ -74,7 +71,7 @@
       /**
        * authoriseRender
        */
  -    public boolean authoriseRender (ProcessingContext jParams) {
  +    public boolean authoriseRender (final ProcessingContext jParams) {
           return (jParams.getOperationMode () == ProcessingContext.EDIT);
       } // end authoriseRender
   
  @@ -93,12 +90,12 @@
        * @throws JahiaUpdateLockException
        * @return boolean
        */
  -    public boolean processFieldTypes (JahiaField theField,
  -                                      JahiaContainer theContainer,
  -                                      String engineName,
  -                                      ProcessingContext jParams,
  -                                      int mode,
  -                                      HashMap engineMap)
  +    public boolean processFieldTypes (final JahiaField theField,
  +                                      final JahiaContainer theContainer,
  +                                      final String engineName,
  +                                      final ProcessingContext jParams,
  +                                      final int mode,
  +                                      final HashMap engineMap)
               throws JahiaException,
               JahiaUpdateLockException {
           boolean out = true;
  @@ -108,7 +105,7 @@
           engineMap.put(engineName+"."+"theField",theField);
           engineMap.put("theField",theField);
   
  -        int pageDefID = jParams.getPage ().getPageTemplateID ();
  +        final int pageDefID = jParams.getPage ().getPageTemplateID ();
   
           int fieldType = theField.getDefinition ().getType (pageDefID);
           logger.debug(" field type is " + fieldType);
  @@ -117,19 +114,19 @@
           }
           // get the engine className
   
  -        String fieldEngineName = theField.getEngineName ();
  +        final String fieldEngineName = theField.getEngineName ();
           if (fieldType == FieldTypes.UNDEFINED) {
               out = Undefined_Field.getInstance ().
                       handleField (jParams, new Integer (mode), engineMap);
           } else {
   
               try {
  -                Class theParams[] = null;
  -                Method thisMethod = Class.forName (fieldEngineName).
  +                final Class theParams[] = null;
  +                final Method thisMethod = Class.forName (fieldEngineName).
                           getDeclaredMethod ("getInstance", theParams);
  -                Object args[] = null;
  +                final Object args[] = null;
   
  -                FieldSubEngine engine = (FieldSubEngine) thisMethod.invoke 
(null, args);
  +                final FieldSubEngine engine = (FieldSubEngine) 
thisMethod.invoke (null, args);
   
                   out = engine.handleField(jParams, new Integer(mode), 
engineMap);
   
  @@ -167,7 +164,8 @@
           /** @todo is there a way to do this only when we really update a
            * field ? Maybe move this to a field.save() generic method.
            */
  -        
ServicesRegistry.getInstance().getJahiaFieldService().invalidateCacheField(theField.getID());
  +        ServicesRegistry.getInstance().getJahiaFieldService().
  +                invalidateCacheField(theField.getID());
           return out;
       } // end processFieldTypes
   
  @@ -176,7 +174,7 @@
        *
        * @param jParams a ProcessingContext object
        */
  -    public void displayScreen (ProcessingContext jParams, HashMap engineMap)
  +    public void displayScreen (final ProcessingContext jParams, final 
HashMap engineMap)
               throws JahiaException {
           EngineRenderer.getInstance ().render (jParams, engineMap);
       } // end displayScreen
  @@ -189,7 +187,8 @@
        * @param objectType an <code>int</code> representing the type of the 
object processed
        * @param engineMap  then engine map, to be forwarded to the JSP file
        */
  -    public void loadLogData (ProcessingContext jParams, int objectType, 
HashMap engineMap)
  +    public void loadLogData (final ProcessingContext jParams, 
  +            final int objectType, final HashMap engineMap)
               throws JahiaException {
   
           // set default values
  @@ -198,17 +197,17 @@
           int deletedRows = 0;
   
           // get parameters
  -        String userAgent = jParams.getUserAgent();
  +        final String userAgent = jParams.getUserAgent();
           //boolean sendAsFile = (jParams.getRequest ().getParameter ("send") 
!= null);
           if (jParams.getParameter ("flush") != null) {
               flushLogs = Integer.parseInt (jParams.getParameter ("flush"));
           }
  -        int objectID = JahiaObjectTool.getInstance ().getObjectID 
(objectType, engineMap);
  -        String objectName = JahiaObjectTool.getInstance ().getObjectName 
(objectType,
  +        final int objectID = JahiaObjectTool.getInstance ().getObjectID 
(objectType, engineMap);
  +        final String objectName = JahiaObjectTool.getInstance 
().getObjectName (objectType,
                   engineMap);
   
           // Try to get the Audit Log Manager Service
  -        ServicesRegistry registry = ServicesRegistry.getInstance ();
  +        final ServicesRegistry registry = ServicesRegistry.getInstance ();
           if (registry != null) {
               mAuditLogManager = registry.getJahiaAuditLogManagerService ();
               if (mAuditLogManager == null) {
  @@ -245,7 +244,7 @@
                   deletedRows = mAuditLogManager.flushLogs (objectType, 
objectID, jParams);
   
               default:
  -                List logData = mAuditLogManager.getLog (objectType, objectID,
  +                final List logData = mAuditLogManager.getLog (objectType, 
objectID,
                           jParams);
                   engineMap.put ("logData", logData);
                   engineMap.put ("deletedRows", new Integer (deletedRows));
  
  
  
  Index: LockEngine.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/engines/lock/LockEngine.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LockEngine.java   5 Jul 2005 15:46:11 -0000       1.4
  +++ LockEngine.java   5 Aug 2005 13:58:18 -0000       1.5
  @@ -173,6 +173,9 @@
       private void processAction (ProcessingContext jParams, HashMap engineMap)
               throws JahiaException {
           String actionScreen = jParams.getParameter ("action");
  +        
  +        logger.debug("processAction: " + actionScreen);
  +        
           // screen = display
           if ("display".equals (actionScreen)) {
               String lockKeyStr = jParams.getParameter ("lockKey");
  @@ -185,6 +188,9 @@
                       lpr.setShowDetails (Boolean.valueOf 
(showDetails).booleanValue ());
                   }
                   initLockEngine (jParams, engineMap, lockKey);
  +                
  +                logger.debug("engineMap: " + engineMap);
  +                
                   LockService lockRegistry = ServicesRegistry.getInstance 
().getLockService ();
                   Long timeRemaining = lockRegistry.getTimeRemaining (lockKey);
                   if (timeRemaining != null && timeRemaining.longValue () < 0) 
{
  @@ -195,15 +201,18 @@
           }
           // apply modifications
           else if ("save".equals (actionScreen) || "apply".equals 
(actionScreen)) {
  -            Iterator paramNames = jParams.getParameterNames ();
  +            final Iterator paramNames = jParams.getParameterNames ();
  +            final LockService lockRegistry = ServicesRegistry.getInstance 
().getLockService ();
               while (paramNames.hasNext ()) {
                   String paramName = (String) paramNames.next ();
                   LockKey lockKey = LockKey.composeLockKey (paramName);
  +                logger.debug("lockKey: " + lockKey + ", from: " + paramName);
                   if (lockKey != null) {
  -                    LockService lockRegistry = ServicesRegistry.getInstance 
().getLockService ();
                       if (LockPrerequisites.getInstance 
().isLockAlreadyAcquired (lockKey)) {
  +                        logger.debug("steal: " + jParams.getUser 
().getUsername()); 
                           lockRegistry.steal (lockKey, jParams.getUser (), 
jParams.getSessionID ());
                       } else {
  +                        logger.debug("nuke: " + jParams.getUser 
().getUsername()); 
                           lockRegistry.nuke (lockKey, jParams.getUser (), 
jParams.getSessionID ());
                       }
                   }
  
  
  
  Index: UpdateContainer_Engine.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/engines/updatecontainer/UpdateContainer_Engine.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- UpdateContainer_Engine.java       21 Jul 2005 15:07:25 -0000      1.16
  +++ UpdateContainer_Engine.java       5 Aug 2005 13:58:18 -0000       1.17
  @@ -124,16 +124,16 @@
       /**
        * authoriseRender
        */
  -    public boolean authoriseRender (ProcessingContext jParams) {
  +    public boolean authoriseRender (final ProcessingContext jParams) {
           return EngineToolBox.getInstance().authoriseRender (jParams);
       } // end authoriseRender
       
       /**
        * renderLink
        */
  -    public String renderLink (ProcessingContext jParams, Object theObj)
  +    public String renderLink (final ProcessingContext jParams, final Object 
theObj)
               throws JahiaException {
  -        ContentContainer contentContainer = (ContentContainer) theObj;
  +        final ContentContainer contentContainer = (ContentContainer) theObj;
           String params = "?mode=display&cid=" + contentContainer.getID();
           return jParams.composeEngineUrl(ENGINE_NAME, params);
       } // end renderLink
  
  
  
  Index: ParamBean.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/params/ParamBean.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ParamBean.java    21 Jul 2005 15:07:27 -0000      1.25
  +++ ParamBean.java    5 Aug 2005 13:58:19 -0000       1.26
  @@ -268,11 +268,15 @@
        * @throws JahiaException
        *      when a general internal exception occured
        */
  -    ParamBean (HttpServletRequest request, HttpServletResponse response,
  -               ServletContext context, SettingsBean jSettings,
  -               long startTime, int httpMethod, JahiaSite site,
  -               JahiaUser user, ContentPage contentPage)
  -
  +    ParamBean(final HttpServletRequest request,
  +            final HttpServletResponse response,
  +            final ServletContext context, 
  +            final SettingsBean jSettings,
  +            final long startTime, 
  +            final int httpMethod, 
  +            final JahiaSite site,
  +            final JahiaUser user, 
  +            final ContentPage contentPage)
           throws JahiaPageNotFoundException, JahiaSessionExpirationException,
           JahiaSiteNotFoundException, JahiaException {
   
  @@ -299,7 +303,7 @@
           entryLoadRequest = new EntryLoadRequest(EntryLoadRequest.STAGED);
   
           if (getRequest() != null) {
  -            HttpSession session = getRequest().getSession();
  +            final HttpSession session = getRequest().getSession();
   
               // last requested page
               Integer lrpID = (Integer) session.getAttribute(
  @@ -317,14 +321,14 @@
                   setUserGuest(this.getSiteID());
               }
   
  -            Enumeration userAgentValues = 
getRequest().getHeaders("user-agent");
  +            final Enumeration userAgentValues = 
getRequest().getHeaders("user-agent");
               if (userAgentValues.hasMoreElements()) {
                   // we only take the first value.
                   userAgent = (String) userAgentValues.nextElement();
               }
   
               // keep the last language
  -            Locale lastLocale = (Locale) session.getAttribute(ParamBean.
  +            final Locale lastLocale = (Locale) 
session.getAttribute(ParamBean.
                   SESSION_LOCALE);
               if (lastLocale != null) {
                   this.changeLanguage(lastLocale);
  @@ -341,7 +345,7 @@
           }
       }
   
  -    /***
  +    /**
        * constructor
        * EV    03.11.2000
        * EV    04.11.2000  now request object in parameters
  @@ -349,12 +353,12 @@
        * EV    20.11.2000  okay, everything changed... old framework, get a 
life
        *
        */
  -    public ParamBean (HttpServletRequest request,
  -                      HttpServletResponse response,
  -                      ServletContext context,
  -                      SettingsBean jSettings,
  -                      long startTime,
  -                      int httpMethod)
  +    public ParamBean (final HttpServletRequest request,
  +                      final HttpServletResponse response,
  +                      final ServletContext context,
  +                      final SettingsBean jSettings,
  +                      final long startTime,
  +                      final int httpMethod)
           throws JahiaPageNotFoundException,
           JahiaSessionExpirationException,
           JahiaSiteNotFoundException,
  @@ -384,7 +388,7 @@
               // for Session ID creation that are classes loaded at run-time.
               // eg. in Tomcat 4 a java.security.random class is loaded and
               // called.
  -            HttpSession session = getRequest().getSession();
  +            final HttpSession session = getRequest().getSession();
   
               // activate the following code to test reading the request
               // testInputReader();
  @@ -404,7 +408,7 @@
   
               resolveUser(request, session);
   
  -            Enumeration userAgentValues = 
getRequest().getHeaders("user-agent");
  +            final Enumeration userAgentValues = 
getRequest().getHeaders("user-agent");
               if (userAgentValues.hasMoreElements()) {
                   // we only take the first value.
                   userAgent = (String) userAgentValues.nextElement();
  @@ -442,7 +446,7 @@
   
                   processLockAction(response, pageID);
   
  -                String verInfo = resolveEntryState();
  +                final String verInfo = resolveEntryState();
   
                   resolveDiffVersionID(verInfo);
   
  @@ -485,7 +489,7 @@
           } catch (NumberFormatException nfe) {
               String errorMsg = "Error in translating number : " + 
nfe.getMessage() +
                                 " -> BAILING OUT";
  -            logger.debug(errorMsg, nfe);
  +            logger.warn(errorMsg, nfe);
               throw new JahiaException("Error in request parameters",
                                        errorMsg, JahiaException.PAGE_ERROR,
                                        JahiaException.ERROR_SEVERITY, nfe);
  
  
  
  Index: ProcessingContextFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/params/ProcessingContextFactoryImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProcessingContextFactoryImpl.java 5 Jul 2005 15:46:20 -0000       1.1
  +++ ProcessingContextFactoryImpl.java 5 Aug 2005 13:58:19 -0000       1.2
  @@ -20,11 +20,13 @@
    */
   public class ProcessingContextFactoryImpl implements 
ProcessingContextFactory {
   
  -    public ParamBean getContext(HttpServletRequest request, 
HttpServletResponse response, ServletContext servletContext) throws 
JahiaException, JahiaSiteNotFoundException, JahiaPageNotFoundException {
  -        URLGenerator urlGenerator = new ServletURLGeneratorImpl(request, 
response);
  -        long startTime = System.currentTimeMillis();
  +    public ParamBean getContext(final HttpServletRequest request, 
  +            final HttpServletResponse response, 
  +            final ServletContext servletContext) throws JahiaException, 
JahiaSiteNotFoundException, JahiaPageNotFoundException {
  +        final URLGenerator urlGenerator = new 
ServletURLGeneratorImpl(request, response);
  +        final long startTime = System.currentTimeMillis();
           // get the main http method...
  -        String requestMethod = request.getMethod();
  +        final String requestMethod = request.getMethod();
           int intRequestMethod = 0;
   
           if (requestMethod.equals("GET")) {
  @@ -32,7 +34,7 @@
           } else if (requestMethod.equals("POST")) {
               intRequestMethod = ProcessingContext.POST_METHOD;
           }
  -        ParamBean paramBean = new ParamBean(request, response, 
servletContext,
  +        final ParamBean paramBean = new ParamBean(request, response, 
servletContext,
                   Jahia.getSettings(), startTime,
                   intRequestMethod);
           paramBean.setUrlGenerator(urlGenerator);
  @@ -45,11 +47,10 @@
               String id = "internal_session_id";
               sessionState = new BasicSessionState(id);
           }
  -        URLGenerator urlGenerator = new BasicURLGeneratorImpl();
  -        ProcessingContext processingContext = new ProcessingContext();
  +        final URLGenerator urlGenerator = new BasicURLGeneratorImpl();
  +        final ProcessingContext processingContext = new ProcessingContext();
           processingContext.setUrlGenerator(urlGenerator);
           processingContext.setSessionState(sessionState);
           return processingContext;
       }
  -
   }
  
  
  
  Index: JahiaResourceBundle.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/resourcebundle/JahiaResourceBundle.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JahiaResourceBundle.java  5 Jul 2005 15:46:22 -0000       1.3
  +++ JahiaResourceBundle.java  5 Aug 2005 13:58:19 -0000       1.4
  @@ -79,9 +79,9 @@
        *
        * @author Khue Nguyen
        */
  -    public static String getEngineResource( String resourceName,
  -                                            ProcessingContext jParams,
  -                                            Locale locale ){
  +    public static String getEngineResource( final String resourceName,
  +                                            final ProcessingContext jParams,
  +                                            final Locale locale ){
   
           ResourceBundle res = null;
           String resValue = null;
  @@ -89,7 +89,7 @@
           if ( resourceName == null || resourceName.trim().equals("") )
               return null;
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           boolean adminMode = false;
           try {
  @@ -173,9 +173,9 @@
        *
        * @author Khue Nguyen
        */
  -    public static String getAdminResource( String resourceName,
  -                                           ProcessingContext jParams,
  -                                           Locale locale ){
  +    public static String getAdminResource( final String resourceName,
  +                                           final ProcessingContext jParams,
  +                                           final Locale locale ){
   
           ResourceBundle res = null;
           String resValue = null;
  @@ -183,7 +183,7 @@
           if ( resourceName == null || resourceName.trim().equals("") )
               return null;
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           boolean adminMode = false;
           try {
  @@ -232,26 +232,28 @@
        *
        * @author Khue Nguyen
        */
  -    public static String getMessageResource( String resourceName,
  -                                                  Locale locale ){
  -
  -        ResourceBundle res = 
ResourceBundle.getBundle(MESSAGE_DEFAULT_RESOURCE_BUNDLE,locale);
  -        String resValue = null;
  -
  +    public static String getMessageResource( final String resourceName,
  +                                             final Locale locale ){
  +        
  +        final String resValue;
  +        
           if ( resourceName == null || resourceName.trim().equals("") )
               return null;
  +        
  +        final ResourceBundle res = ResourceBundle.getBundle(
  +                MESSAGE_DEFAULT_RESOURCE_BUNDLE,locale);
   
           if ( res != null ){
  -            try {
  -                resValue = getString(res, resourceName, locale);
  -                return resValue;
  -            } catch ( Throwable t ){
  -            }
  +            resValue = getString(res, resourceName, locale);
  +            return resValue;
  +        } else {
  +            resValue = null;
           }
  +        
           logger.warn("Resource [" + resourceName +
                       "] not found in message resource bundles using locale [" 
+
                       locale + "]");
  -        return null;
  +        return resValue;
       }
   
       
//--------------------------------------------------------------------------
  @@ -291,13 +293,15 @@
        *
        * @author Khue Nguyen
        */
  -    public static String getUrlPathResourceEngineResource( String 
resourceName,
  -                                                           ProcessingContext 
jParams,
  -                                                           Locale locale )
  +    public static String getUrlPathResourceEngineResource( final String 
resourceName,
  +                                                           final 
ProcessingContext jParams,
  +                                                           final Locale 
locale )
       {
  -        String res = getEngineResource(resourceName,jParams,locale);
  +        final String res = getEngineResource(resourceName, jParams, locale);
           if ( res != null ){
  -            res = jParams.getContextPath() + res;
  +            final StringBuffer buff = new StringBuffer();
  +            buff.append(jParams.getContextPath()).append(res);
  +            return buff.toString();
           }
           return res;
       }
  @@ -325,8 +329,11 @@
        * bundle specified by the bundle code, or null if the key couldn't be
        * found.
        */
  -    public static String getResource(String bundleCode, String resourceKey, 
Locale locale, ProcessingContext jParams) {
  -        String result = null;
  +    public static String getResource(final String bundleCode, 
  +                                     final String resourceKey, 
  +                                     final Locale locale, 
  +                                     final ProcessingContext jParams) {
  +        final String result;
   
           if ("administration".equals(bundleCode)) {
               result = getAdminResource(resourceKey, jParams, locale);
  @@ -349,9 +356,10 @@
        * @return
        *    Null if no resource found.
        */
  -    public static String getCommonResource(String resourceName, 
ProcessingContext jParams) {
  +    public static String getCommonResource(final String resourceName, 
  +            final ProcessingContext jParams) {
   
  -        ResourceBundle res = 
ResourceBundle.getBundle(ENGINE_DEFAULT_RESOURCE_BUNDLE);
  +        final ResourceBundle res = 
ResourceBundle.getBundle(ENGINE_DEFAULT_RESOURCE_BUNDLE);
           try {
               if (res != null) {
                   return res.getString(resourceName);
  @@ -373,11 +381,14 @@
        * @return
        *    Null if no resource found.
        */
  -    public static String getUrlPathCommonResource(String resourceName, 
ProcessingContext jParams) {
  +    public static String getUrlPathCommonResource(final String resourceName, 
  +            final ProcessingContext jParams) {
   
  -        String res = getCommonResource(resourceName,jParams);
  +        final String res = getCommonResource(resourceName,jParams);
           if ( res != null ){
  -            res = jParams.getContextPath() + res;
  +            final StringBuffer buff = new StringBuffer();
  +            buff.append(jParams.getContextPath()).append(res);
  +            return buff.toString();
           }
           return res;
       }
  @@ -417,14 +428,14 @@
        * @author Khue Nguyen
        */
       public static ResourceBundle getEngineResourceBundle(
  -                                                    String resourceBundle,
  -                                                    ProcessingContext 
jParams,
  -                                                    Locale locale,
  -                                                    boolean useDefault ){
  +                                                    final String 
resourceBundle,
  +                                                    final ProcessingContext 
jParams,
  +                                                    final Locale locale,
  +                                                    final boolean useDefault 
){
   
           ResourceBundle res = null;
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           try {
               res = ResourceBundle.getBundle(resourceBundle,loc);
  @@ -464,10 +475,10 @@
        * @return ResourceBundle, the Jahia engines' default resource bundle or 
null if not found
        */
       public static ResourceBundle getEngineDefaultResourceBundle(
  -                                                    ProcessingContext 
jParams,
  -                                                    Locale locale ){
  +                                                    final ProcessingContext 
jParams,
  +                                                    final Locale locale ){
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           ResourceBundle res = null;
   
  @@ -492,10 +503,10 @@
        * @return ResourceBundle, the Jahia engines' default resource bundle or 
null if not found
        */
       public static ResourceBundle getAdminDefaultResourceBundle(
  -                                                    ProcessingContext 
jParams,
  -                                                    Locale locale ){
  +                                                    final ProcessingContext 
jParams,
  +                                                    final Locale locale ){
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           ResourceBundle res = null;
   
  @@ -520,10 +531,10 @@
        * @return ResourceBundle, the Jahia engines' default resource bundle or 
null if not found
        */
       public static ResourceBundle getMessageDefaultResourceBundle(
  -                                                    ProcessingContext 
jParams,
  -                                                    Locale locale ){
  +                                                    final ProcessingContext 
jParams,
  +                                                    final Locale locale ){
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           ResourceBundle res = null;
   
  @@ -552,14 +563,14 @@
        *
        * @return ResourceBundle, the site engines' default resource bundle or 
null if not found
        */
  -    public static ResourceBundle getSiteEngineResourceBundle( JahiaSite site,
  -                                                              
ProcessingContext jParams,
  -                                                              Locale locale 
){
  +    public static ResourceBundle getSiteEngineResourceBundle( final 
JahiaSite site,
  +                                                              final 
ProcessingContext jParams,
  +                                                              final Locale 
locale ){
   
           if ( site == null )
               return null;
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           ResourceBundle res = null;
   
  @@ -589,14 +600,14 @@
        *
        * @return ResourceBundle, the site engines' default resource bundle or 
null if not found
        */
  -    public static ResourceBundle getSiteAdminResourceBundle( JahiaSite site,
  -                                                             
ProcessingContext jParams,
  -                                                             Locale locale ){
  +    public static ResourceBundle getSiteAdminResourceBundle( final JahiaSite 
site,
  +                                                             final 
ProcessingContext jParams,
  +                                                             final Locale 
locale ){
   
           if ( site == null )
               return null;
   
  -        Locale loc = checkLocale(locale,jParams);
  +        final Locale loc = checkLocale(locale,jParams);
   
           ResourceBundle res = null;
   
  @@ -624,7 +635,8 @@
        *
        * @return ResourceBundle, the site engines' default resource bundle or 
null if not found
        */
  -    public static ResourceBundle getPageEngineResourceBundle( int pageID , 
ProcessingContext jParams){
  +    public static ResourceBundle getPageEngineResourceBundle( final int 
pageID , 
  +                                                              final 
ProcessingContext jParams){
   
   
           if ( jParams == null )
  @@ -669,7 +681,7 @@
        *
        * @return ResourceBundle, the grp or usr engines' default resource 
bundle or null if not found
        */
  -    public static ResourceBundle getGrpUsrEngineResourceBundle( int pageID , 
JahiaUser user){
  +    public static ResourceBundle getGrpUsrEngineResourceBundle( final int 
pageID , final JahiaUser user){
   
   
           if ( pageID == -1 || user==null )
  @@ -699,33 +711,36 @@
       }
   
   
  -    private static Locale checkLocale(Locale locale, ProcessingContext 
jParams){
  -        Locale resLocale = locale;
  -        if ( resLocale == null ){
  +    private static Locale checkLocale(final Locale locale, final 
ProcessingContext jParams){
  +        final Locale resLocale;
  +        if ( locale == null ){
               if ( jParams != null ){
                   resLocale = jParams.getLocale();
               } else {
                   resLocale = Locale.getDefault();
               }
  +            
  +        } else {
  +            resLocale = locale;
           }
           return resLocale;
       }
   
  -    private static org.apache.log4j.Logger logger =
  +    private static final org.apache.log4j.Logger logger =
               org.apache.log4j.Logger.getLogger(JahiaResourceBundle.class);
   
  -        
//--------------------------------------------------------------------------
  -        /**
  -         * Returns the resource string.
  -         * This is a convenience way to used such as Chinese to translate 
from encoding.
  -         *
  -         * @param ResourceBundle
  -         * @param String
  -         * @return String
  -         */
  -        public static String getString( ResourceBundle res, String resName, 
Locale locale) {
  -            String resValue = res.getString(resName);
  -            return resValue;
  -        }
  +    
//--------------------------------------------------------------------------
  +    /**
  +     * Returns the resource string.
  +     * This is a convenience way to used such as Chinese to translate from 
encoding.
  +     *
  +     * @param ResourceBundle
  +     * @param String
  +     * @return String
  +     */
  +    public static String getString( final ResourceBundle res,
  +            final String resName, final Locale locale) {
  +        return res.getString(resName);
  +    }
   }
   
  
  
  
  Index: ContentContainer.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/containers/ContentContainer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ContentContainer.java     2 Aug 2005 09:11:29 -0000       1.14
  +++ ContentContainer.java     5 Aug 2005 13:58:19 -0000       1.15
  @@ -931,6 +931,10 @@
       public static void invalidateContainerCache(int containerID) {
           
ContentContainerTools.getInstance().invalidateContainerFromCache(containerID);
       }
  +    
  +    public String toString() {
  +        return "ContentContainer: " + getID();
  +    }
   
   }
   
  
  
  
  Index: LockKey.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/lock/LockKey.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LockKey.java      8 Jul 2005 09:03:07 -0000       1.2
  +++ LockKey.java      5 Aug 2005 13:58:20 -0000       1.3
  @@ -81,7 +81,7 @@
               DATABASE_LOCKNAME;
   
   
  -    private LockKey(String name, int id, String action, int pageID) {
  +    private LockKey(final String name, final int id, final String action, 
final int pageID) {
           this.name = name;
           this.id = id;
           this.action = action;
  @@ -105,7 +105,9 @@
       }
   
       public ObjectKey getObjectKey() {
  -        String objectKey = name + ObjectKey.KEY_SEPARATOR + id;
  +        final StringBuffer buff = new StringBuffer();
  +        buff.append(name).append(ObjectKey.KEY_SEPARATOR).append(id);
  +        final String objectKey = buff.toString();
           try {
               return ObjectKey.getInstance(objectKey);
           } catch (ClassNotFoundException cnfe) {
  @@ -117,28 +119,25 @@
           }
       }
   
  -    public String toString() {
  -        return action + "_" + name + "_" + id;
  -    }
  -
  -    public static LockKey composeLockKey(String lockType, int id, int 
pageID) {
  -        int index = lockType.indexOf("_");
  +    public static LockKey composeLockKey(final String lockType, final int 
id, 
  +            final int pageID) {
  +        final int index = lockType.indexOf("_");
           return new LockKey(lockType.substring(index + 1),
                              id,
                              lockType.substring(0, index), pageID);
       }
   
  -    public static LockKey composeLockKey(String lockKeyStr) {
  -        StringTokenizer lockKeyToken = new StringTokenizer(lockKeyStr, "_");
  -        String action = lockKeyToken.nextToken();
  +    public static LockKey composeLockKey(final String lockKeyStr) {
  +        final StringTokenizer lockKeyToken = new StringTokenizer(lockKeyStr, 
"_");
  +        final String action = lockKeyToken.nextToken();
           if (!lockKeyToken.hasMoreTokens()) return null;
  -        String name = lockKeyToken.nextToken();
  +        final String name = lockKeyToken.nextToken();
           if (!lockKeyToken.hasMoreTokens()) return null;
  -        int id = Integer.parseInt(lockKeyToken.nextToken());
  +        final int id = Integer.parseInt(lockKeyToken.nextToken());
           return new LockKey(name, id, action, -1);
       }
   
  -    public boolean equals(Object obj) {
  +    public boolean equals(final Object obj) {
           if (this == obj) return true;
           
           if (obj != null && this.getClass() == obj.getClass()) {
  @@ -159,21 +158,28 @@
       }
   
       // Serialization methods
  -
  -    private void readObject(java.io.ObjectInputStream stream)
  +    private void readObject(final java.io.ObjectInputStream stream)
           throws IOException, ClassNotFoundException {
           name = (String) stream.readObject();
           id = stream.readInt();
           action = (String) stream.readObject();
       }
   
  -    private void writeObject(java.io.ObjectOutputStream stream)
  +    private void writeObject(final java.io.ObjectOutputStream stream)
           throws IOException {
           stream.writeObject(name);
           stream.writeInt(id);
           stream.writeObject(action);
       }
  -
  +    
  +    public String toString() {
  +        final StringBuffer buff = new StringBuffer();
  +        buff.append(action).append("_").
  +                append(name).append("_").
  +                append(id);
  +        return buff.toString();
  +    }
  +    
       private String name;
       private String action;
       private int id;
  @@ -182,6 +188,6 @@
       // objects that only exist in memory like container lists that are empty
       private int pageID = -1;
   
  -    private static org.apache.log4j.Logger logger =
  +    private static final org.apache.log4j.Logger logger =
               org.apache.log4j.Logger.getLogger(LockKey.class);
   }
  \ No newline at end of file
  

Reply via email to