You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2002/03/28 00:08:33 UTC

cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/control/group GroupAttrName.java

jmcnally    02/03/27 15:08:32

  Modified:    .        build.xml
               src/java/org/apache/stratum/jcs/access GroupCacheAccess.java
               src/java/org/apache/stratum/jcs/access/behavior
                        IGroupCacheAccess.java
               src/java/org/apache/stratum/jcs/access/exception
                        CacheException.java
               src/java/org/apache/stratum/jcs/engine/control/group
                        GroupAttrName.java
  Log:
  fixed several places that were assuming keys were Strings, they can be
  any Serializable object.
  
  fixed one place that assumed the group name was an Object.  It is currently
  always a String.
  
  made CacheException extend commons NestedException.  This gave a classpath
  issue in RMI, that I do not fully understand, but giving the commons-lang jar
  as a classpath attribute allows the build to work.
  
  fixed a few places where jcs was ignoring exceptions with no explanation as to
  why.  There are quite a few more.
  
  Revision  Changes    Path
  1.26      +1 -1      jakarta-turbine-stratum/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/build.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- build.xml	28 Feb 2002 23:22:10 -0000	1.25
  +++ build.xml	27 Mar 2002 23:08:32 -0000	1.26
  @@ -177,7 +177,7 @@
   
       <rmic
         base="${build.dest}"
  -      classname="org.apache.stratum.jcs.auxiliary.remote.server.RemoteCacheServer"/>
  +      classname="org.apache.stratum.jcs.auxiliary.remote.server.RemoteCacheServer" classpath="${commons-lang.jar}"/>
   
        <rmic
          base="${build.dest}"
  
  
  
  1.17      +34 -42    jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/GroupCacheAccess.java
  
  Index: GroupCacheAccess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/GroupCacheAccess.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- GroupCacheAccess.java	1 Mar 2002 18:31:55 -0000	1.16
  +++ GroupCacheAccess.java	27 Mar 2002 23:08:32 -0000	1.17
  @@ -53,7 +53,9 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   import java.io.Serializable;
  +import java.io.IOException;
   
   import java.util.Collection;
   import java.util.ConcurrentModificationException;
  @@ -173,7 +175,7 @@
        * @param group The group name.
        * @return The cahe value, null if not found.
        */
  -    public Object getFromGroup( String name, String group )
  +    public Object getFromGroup( Object name, String group )
       {
           return getAttribute( name, group );
       }
  @@ -184,7 +186,7 @@
        *
        * @return The attribute value
        */
  -    public Object getAttribute( String name, String group )
  +    public Object getAttribute( Object name, String group )
       {
           //try {
           return ( Object ) cacheControl.get( new GroupAttrName( group, name ) );
  @@ -206,7 +208,7 @@
       public void putInGroup( Object key, String group, Object value )
           throws CacheException
       {
  -        setAttribute( ( String ) key, group, value );
  +        setAttribute( key, group, value );
       }
   
   
  @@ -223,7 +225,7 @@
       public void putInGroup( Object key, String group, Object value, IElementAttributes attr )
           throws CacheException
       {
  -        setAttribute( ( String ) key, group, value, attr );
  +        setAttribute( key, group, value, attr );
       }
   
   
  @@ -255,10 +257,11 @@
           }
           try
           {
  -            cacheControl.put( ( Serializable ) groupId, ( Serializable ) attrNameSet );
  +            cacheControl.put( groupId, (Serializable) attrNameSet );
           }
  -        catch ( Exception ioe )
  +        catch (IOException ioe)
           {
  +            throw new CacheException(ioe);
           }
       }
   
  @@ -289,13 +292,13 @@
           }
           try
           {
  -            //cacheControl.put((Serializable)groupId, (Serializable)attrNameSet, attr );
               // TODO: revisit and verify that this works
               // not sure it will, need special id putting
               cacheControl.put( groupId, ( Serializable ) attrNameSet, attr );
           }
  -        catch ( Exception ioe )
  +        catch (IOException ioe)
           {
  +            throw new CacheException(ioe);
           }
       }
   
  @@ -307,7 +310,7 @@
        *
        * @return The Element Attributes for the group
        */
  -    public IElementAttributes getGroupAttributes( Object name )
  +    public IElementAttributes getGroupAttributes( String name )
           throws CacheException
       {
           IElementAttributes attr = null;
  @@ -315,9 +318,10 @@
           {
               attr = cacheControl.getElementAttributes( ( Serializable ) name );
           }
  -        catch ( Exception ioe )
  +        catch ( IOException ioe )
           {
  -            log.error( "Failure getting element attributes", ioe );
  +            throw new CacheException(
  +                "Failure getting element attributes due to ", ioe);
           }
           return attr;
       }
  @@ -327,7 +331,7 @@
        *
        * @return The attributeNames value
        */
  -    public Enumeration getAttributeNames( Object group_name )
  +    public Enumeration getAttributeNames( String group_name )
       {
           //Set s = getAttributeNameSet( name );
           //p( s.toString() );
  @@ -341,7 +345,7 @@
        *
        * @return The attributeNameSet value
        */
  -    public Set getAttributeNameSet( Object group_name )
  +    public Set getAttributeNameSet( String group_name )
       {
           Object obj = null;
           //try {
  @@ -365,20 +369,19 @@
        * @param group The new attribute value
        * @param value The new attribute value
        */
  -    public void setAttribute( String name, String group, Object value )
  +    public void setAttribute( Object name, String group, Object value )
  +        throws CacheException
       {
           removeAttribute( name, group, SET_ATTR_INVOCATION );
           try
           {
  -            cacheControl.put( new GroupAttrName( group, name ), ( Serializable ) value );
  -            //} catch( ObjectExistsException onfe ) {
  -            //  return;
  +            cacheControl.put( new GroupAttrName(group, name), 
  +                              (Serializable) value );
           }
  -        catch ( Exception ioe )
  +        catch (IOException ioe)
           {
  -            return;
  +            throw new CacheException(ioe);
           }
  -        return;
       }
   
   
  @@ -390,35 +393,33 @@
        * @param value The new attribute value
        * @param attr The new attribute value
        */
  -    public void setAttribute( String name, String group, Object value, IElementAttributes attr )
  +    public void setAttribute( Object name, String group, Object value, IElementAttributes attr )
  +        throws CacheException
       {
           // unbind object first if any.
           removeAttribute( name, group, SET_ATTR_INVOCATION );
           try
           {
  -            cacheControl.put( new GroupAttrName( group, name ), ( Serializable ) value, attr );
  +            cacheControl.put( new GroupAttrName(group, name), 
  +                              (Serializable) value, attr );
           }
  -        catch ( Exception e )
  +        catch (IOException ioe)
           {
  -            return;
  -            //} catch ( IOException ioe ) {
  -            //  return;
  +            throw new CacheException(ioe);
           }
  -        return;
       }
   
   
       /** Description of the Method */
  -    public void removeAttribute( String name, String group )
  +    public void removeAttribute( Object name, String group )
       {
           removeAttribute( name, group, REMOVE_ATTR_INVOCATION );
       }
   
   
       /** Description of the Method */
  -    private void removeAttribute( String name, String group, boolean invocation )
  +    private void removeAttribute( Object name, String group, boolean invocation )
       {
  -
           GroupAttrName key = new GroupAttrName( group, name );
           // Needs to retrive the attribute so as to do object unbinding, if necessary.
           Serializable val = null;
  @@ -446,13 +447,13 @@
        *
        * @deprecated
        */
  -    public void destroy( String name, String group )
  +    public void destroy( Object name, String group )
       {
           removeAttribute( name, group );
       }
   
       /** Description of the Method */
  -    public void remove( String name, String group )
  +    public void remove( Object name, String group )
       {
           removeAttribute( name, group );
       }
  @@ -470,18 +471,9 @@
           int arS = ar.length;
           for ( int i = 0; i < arS; i++ )
           {
  -            removeAttribute( ( String ) ar[i], group );
  -            //System.out.println( ( String )ar[i] );
  +            removeAttribute( ar[i], group );
           }
   
  -        //        for ( Enumeration en = getAttributeNames( group ); en.hasMoreElements();  )
  -//        {
  -//            //try {
  -//              removeAttribute( ( String ) en.nextElement(), group );
  -//            //} catch ( ConcurrentModificationException cme ) {
  -//              //log.warn( cme );
  -//            //}
  -//        }
           // get into concurrent modificaiton problems here.
           // could make the removal of the ID invalidate the list?
           cacheControl.remove( new GroupId( cacheControl.getCacheName(), group ), false );
  
  
  
  1.9       +8 -6      jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/behavior/IGroupCacheAccess.java
  
  Index: IGroupCacheAccess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/behavior/IGroupCacheAccess.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- IGroupCacheAccess.java	18 Feb 2002 17:14:24 -0000	1.8
  +++ IGroupCacheAccess.java	27 Mar 2002 23:08:32 -0000	1.9
  @@ -73,7 +73,7 @@
        *
        * @return The g value
        */
  -    Object getFromGroup( String name, String group );
  +    Object getFromGroup( Object name, String group );
   
   
       /** Description of the Method */
  @@ -106,7 +106,7 @@
        *
        * @return The groupAttributes value
        */
  -    IElementAttributes getGroupAttributes( Object name )
  +    IElementAttributes getGroupAttributes( String name )
           throws CacheException;
   
   
  @@ -115,7 +115,7 @@
        *
        * @return The attributeNames value
        */
  -    Enumeration getAttributeNames( Object name );
  +    Enumeration getAttributeNames( String name );
   
   
       /**
  @@ -125,7 +125,8 @@
        * @param group The new attribute value
        * @param value The new attribute value
        */
  -    void setAttribute( String name, String group, Object value );
  +    void setAttribute( Object name, String group, Object value )
  +        throws CacheException;
   
   
       /**
  @@ -136,7 +137,8 @@
        * @param value The new attribute value
        * @param attr The new attribute value
        */
  -    void setAttribute( String name, String group, Object value, IElementAttributes attr );
  +    void setAttribute( Object name, String group, Object value, IElementAttributes attr )
  +        throws CacheException;
   
   
       /**
  @@ -144,6 +146,6 @@
        *
        * @return The attribute value
        */
  -    Object getAttribute( String name, String group );
  +    Object getAttribute( Object name, String group );
   
   }
  
  
  
  1.6       +17 -16    jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/exception/CacheException.java
  
  Index: CacheException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/access/exception/CacheException.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CacheException.java	16 Feb 2002 02:37:16 -0000	1.5
  +++ CacheException.java	27 Mar 2002 23:08:32 -0000	1.6
  @@ -53,18 +53,18 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
  +import org.apache.commons.lang.exception.NestableException;
  +
   /**
    * Description of the Class
    *
    * @author asmuts
    * @created January 15, 2002
    */
  -public class CacheException extends Exception
  +public class CacheException 
  +    extends NestableException
   {
  -
  -    String message = "Cache Exception";
  -
  -
       /** Constructor for the CacheException object */
       public CacheException()
       {
  @@ -75,11 +75,11 @@
       /**
        * Constructor for the CacheException object
        *
  -     * @param e
  +     * @param nested
        */
  -    public CacheException( Exception e )
  +    public CacheException(Throwable nested)
       {
  -        message = e.getMessage();
  +        super(nested);
       }
   
   
  @@ -88,20 +88,21 @@
        *
        * @param message
        */
  -    public CacheException( String message )
  +    public CacheException(String message)
       {
  -        super( message );
  +        super(message);
       }
   
  -
       /**
  -     * Gets the message attribute of the CacheException object
  +     * Constructs a new <code>CacheException</code> with specified detail
  +     * message and nested <code>Throwable</code>.
        *
  -     * @return The message value
  +     * @param msg the error message.
  +     * @param nested the exception or error that caused this exception
  +     *               to be thrown.
        */
  -    public String getMessage()
  +    public CacheException(String msg, Throwable nested)
       {
  -        return message;
  +        super(msg, nested);
       }
  -
   }
  
  
  
  1.4       +2 -2      jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/control/group/GroupAttrName.java
  
  Index: GroupAttrName.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/control/group/GroupAttrName.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GroupAttrName.java	18 Feb 2002 05:10:43 -0000	1.3
  +++ GroupAttrName.java	27 Mar 2002 23:08:32 -0000	1.4
  @@ -13,7 +13,7 @@
       //final GroupId groupId;
       /** Description of the Field */
       public final String groupId;
  -    final String attrName;
  +    final Object attrName;
   
   
       /**
  @@ -22,7 +22,7 @@
        * @param groupId
        * @param attrName
        */
  -    public GroupAttrName( String groupId, String attrName )
  +    public GroupAttrName( String groupId, Object attrName )
       {
           //this.groupId = new GroupId(groupId);
           this.groupId = groupId;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>