You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2004/07/28 15:24:16 UTC

cvs commit: jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/window FailedToCreateWindowException.java FailedToRetrievePortletWindow.java PortletWindowAccessor.java

weaver      2004/07/28 06:24:16

  Modified:    portal/src/java/org/apache/jetspeed/container/window/impl
                        PortletWindowAccessorImpl.java
               jetspeed-api/src/java/org/apache/jetspeed/container/window
                        PortletWindowAccessor.java
  Added:       jetspeed-api/src/java/org/apache/jetspeed/container/window
                        FailedToCreateWindowException.java
                        FailedToRetrievePortletWindow.java
  Log:
  Use checked exceptions to indicate a failure in retrieving/creating windows instead of consuming and logging.
  
  Revision  Changes    Path
  1.8       +18 -13    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java
  
  Index: PortletWindowAccessorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PortletWindowAccessorImpl.java	20 Jul 2004 13:52:20 -0000	1.7
  +++ PortletWindowAccessorImpl.java	28 Jul 2004 13:24:16 -0000	1.8
  @@ -15,8 +15,6 @@
    */
   package org.apache.jetspeed.container.window.impl;
   
  -import groovy.swing.impl.Startable;
  -
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  @@ -26,6 +24,8 @@
   import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
   import org.apache.jetspeed.components.portletentity.PortletEntityNotGeneratedException;
   import org.apache.jetspeed.components.portletentity.PortletEntityNotStoredException;
  +import org.apache.jetspeed.container.window.FailedToCreateWindowException;
  +import org.apache.jetspeed.container.window.FailedToRetrievePortletWindow;
   import org.apache.jetspeed.container.window.PortletWindowAccessor;
   import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
   import org.apache.jetspeed.om.page.Fragment;
  @@ -33,8 +33,6 @@
   import org.apache.pluto.om.entity.PortletEntity;
   import org.apache.pluto.om.window.PortletWindow;
   import org.apache.pluto.om.window.PortletWindowCtrl;
  -import org.apache.pluto.om.window.PortletWindowList;
  -import org.apache.pluto.om.window.PortletWindowListCtrl;
   
   /**
    * Portlet Window Accessor Implementation
  @@ -86,17 +84,24 @@
           return getWindowFromCache(windowId);
       }
       
  -    public PortletWindow getPortletWindow(Fragment fragment)
  +    public PortletWindow getPortletWindow(Fragment fragment) throws FailedToRetrievePortletWindow
       {
           PortletWindow portletWindow = getWindowFromCache(fragment);
           if (portletWindow == null)
           {
  -            return createPortletWindow(fragment);
  +            try
  +            {
  +                return createPortletWindow(fragment);
  +            }
  +            catch (FailedToCreateWindowException e)
  +            {
  +                throw new FailedToRetrievePortletWindow(e.toString(), e);
  +            }
           }
           return portletWindow;
       }
       
  -    public PortletWindow getPortletWindow(Fragment fragment, String principal)
  +    public PortletWindow getPortletWindow(Fragment fragment, String principal) throws FailedToCreateWindowException
       {
           PortletWindow portletWindow = getWindowFromCache(fragment);
           if (portletWindow == null)
  @@ -106,12 +111,12 @@
           return portletWindow;
       }
   
  -    private PortletWindow createPortletWindow(Fragment fragment)
  +    private PortletWindow createPortletWindow(Fragment fragment) throws FailedToCreateWindowException
       {
           return createPortletWindow(fragment, null);
       }
       
  -    private PortletWindow createPortletWindow(Fragment fragment, String principal)
  +    private PortletWindow createPortletWindow(Fragment fragment, String principal) throws FailedToCreateWindowException
       {
           PortletWindow portletWindow = new PortletWindowImpl(fragment.getId());
                   
  @@ -126,16 +131,16 @@
               }
               catch (PortletEntityNotGeneratedException e)
               {
  -                log.error("Error generating new PortletEntity: "+e.toString(), e);                
  +                throw new FailedToCreateWindowException("Error generating new PortletEntity: "+e.toString(), e);                
               }
               catch (PortletEntityNotStoredException e)
               {
  -                log.error("Error storing new PortletEntity: "+e.toString(), e);
  +                throw new FailedToCreateWindowException("Error storing new PortletEntity: "+e.toString(), e);
               }
               
               if(portletEntity == null)
               {
  -                throw new IllegalStateException("Unable to generate portlet entity.");
  +                throw new FailedToCreateWindowException("Unable to generate portlet entity.");
               }
               
           }
  
  
  
  1.5       +5 -3      jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/window/PortletWindowAccessor.java
  
  Index: PortletWindowAccessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/window/PortletWindowAccessor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletWindowAccessor.java	2 Jul 2004 13:42:10 -0000	1.4
  +++ PortletWindowAccessor.java	28 Jul 2004 13:24:16 -0000	1.5
  @@ -32,16 +32,18 @@
        * 
        * @param fragment
        * @return
  +     * @throws FailedToRetrievePortletWindow
        */
  -    PortletWindow getPortletWindow(Fragment fragment);
  +    PortletWindow getPortletWindow(Fragment fragment) throws FailedToRetrievePortletWindow;
       
       /**
        * Get the portlet window for a fragment and given principal
        * @param fragment
        * @param principal
        * @return
  +     * @throws FailedToCreateWindowException
        */
  -    PortletWindow getPortletWindow(Fragment fragment, String principal);
  +    PortletWindow getPortletWindow(Fragment fragment, String principal) throws FailedToCreateWindowException;
   
       /**
        * Lookup a portlet window in the cache
  
  
  
  1.1                  jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/window/FailedToCreateWindowException.java
  
  Index: FailedToCreateWindowException.java
  ===================================================================
  /*
   * Copyright 2000-2001,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.container.window;
  
  import org.apache.jetspeed.exception.JetspeedException;
  
  /**
   * <p>
   * FailedToCreateWindowException
   * </p>
   * <p>
   *
   * </p>
   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
   * @version $Id: FailedToCreateWindowException.java,v 1.1 2004/07/28 13:24:16 weaver Exp $
   *
   */
  public class FailedToCreateWindowException extends JetspeedException
  {
  
      
  
      /**
       * 
       */
      public FailedToCreateWindowException()
      {
          super();
      }
      /**
       * @param message
       */
      public FailedToCreateWindowException( String message )
      {
          super(message);
      }
      /**
       * @param msg
       * @param nested
       */
      public FailedToCreateWindowException( String msg, Throwable nested )
      {
          super(msg, nested);
      }
      /**
       * @param nested
       */
      public FailedToCreateWindowException( Throwable nested )
      {
          super(nested);
      }
  }
  
  
  
  1.1                  jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/window/FailedToRetrievePortletWindow.java
  
  Index: FailedToRetrievePortletWindow.java
  ===================================================================
  /*
   * Copyright 2000-2001,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.container.window;
  
  import org.apache.jetspeed.exception.JetspeedException;
  
  /**
   * <p>
   * FailedToRetrievePortletWindow
   * </p>
   * <p>
   *
   * </p>
   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
   * @version $Id: FailedToRetrievePortletWindow.java,v 1.1 2004/07/28 13:24:16 weaver Exp $
   *
   */
  public class FailedToRetrievePortletWindow extends JetspeedException
  {
  
      /**
       * 
       */
      public FailedToRetrievePortletWindow()
      {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @param message
       */
      public FailedToRetrievePortletWindow( String message )
      {
          super(message);
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @param nested
       */
      public FailedToRetrievePortletWindow( Throwable nested )
      {
          super(nested);
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @param msg
       * @param nested
       */
      public FailedToRetrievePortletWindow( String msg, Throwable nested )
      {
          super(msg, nested);
          // TODO Auto-generated constructor stub
      }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org