jmcnally    2002/06/05 22:31:11

  Modified:    src/java/org/apache/jcs/utils/servlet/session
                        DistSession.java
               src/java/org/apache/jcs/access GroupCacheAccess.java
               src/java/org/apache/jcs/access/behavior
                        IGroupCacheAccess.java
  Log:
  removed some duplicated methods.
  
  Revision  Changes    Path
  1.2       +1 -1      
jakarta-turbine-jcs/src/java/org/apache/jcs/utils/servlet/session/DistSession.java
  
  Index: DistSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/utils/servlet/session/DistSession.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DistSession.java  7 Apr 2002 16:55:27 -0000       1.1
  +++ DistSession.java  6 Jun 2002 05:31:11 -0000       1.2
  @@ -320,7 +320,7 @@
           if ( invocation == REMOVE_ATTR_INVOCATION )
           {
               // remove attribute - name set taken care of by the session cache.
  -            sessCache.destroy( name, session_id );
  +            sessCache.remove( name, session_id );
           }
           // Generate object unbinding event if necessary.
           if ( val instanceof HttpSessionBindingListener )
  
  
  
  1.7       +35 -90    
jakarta-turbine-jcs/src/java/org/apache/jcs/access/GroupCacheAccess.java
  
  Index: GroupCacheAccess.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/access/GroupCacheAccess.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- GroupCacheAccess.java     23 May 2002 15:22:22 -0000      1.6
  +++ GroupCacheAccess.java     6 Jun 2002 05:31:11 -0000       1.7
  @@ -78,6 +78,7 @@
    * Access for groups.
    *
    * @author asmuts
  + * @author <a href="mailto:[EMAIL PROTECTED]";>John McNally</a>
    * @created January 15, 2002
    */
   public class GroupCacheAccess extends CacheAccess implements IGroupCacheAccess
  @@ -143,59 +144,26 @@
           return new GroupCacheAccess( ( CompositeCache ) cacheMgr.getCache( region, 
icca ) );
       }
   
  +    
  +
       /**
        * Gets an item out of the cache that is in a specified group.
        *
        * @param name The key name.
        * @param group The group name.
  -     * @return The cahe value, null if not found.
  +     * @return The cached value, null if not found.
        */
       public Object getFromGroup( Object name, String group )
       {
  -        return getAttribute( name, group );
  -    }
  -
  -    /**
  -     * Gets the attribute attribute of the GroupCacheAccess object
  -     *
  -     * @return The attribute value
  -     */
  -    public Object getAttribute( Object name, String group )
  -    {
           ICacheElement element
  -            = cacheControl.get( new GroupAttrName( group, name ) );
  +            = cacheControl.get( getGroupAttrName( group, name ) );
           return ( element != null ) ? element.getVal() : null;
       }
   
  -    /**
  -     * Allows the user to put an object into a group within a particular cache
  -     * region. This method sets the object's attributes to the default for the
  -     * region.
  -     *
  -     * @param key The key name.
  -     * @param group The group name.
  -     * @param value The object to cache
  -     */
  -    public void putInGroup( Object key, String group, Object value )
  -        throws CacheException
  -    {
  -        setAttribute( key, group, value );
  -    }
  -
  -    /**
  -     * Allows the user to put an object into a group within a particular cache
  -     * region. This method allows the object's attributes to be individually
  -     * specified.
  -     *
  -     * @param key The key name.
  -     * @param group The group name.
  -     * @param value The object to cache
  -     * @param attr The objects attributes.
  -     */
  -    public void putInGroup( Object key, String group, Object value, 
IElementAttributes attr )
  -        throws CacheException
  +    private GroupAttrName getGroupAttrName(String group, Object name)
       {
  -        setAttribute( key, group, value, attr );
  +        GroupId gid = new GroupId(cacheControl.getCacheName(), group);
  +        return new GroupAttrName(gid, name);
       }
   
       /**
  @@ -292,28 +260,32 @@
       }
   
       /**
  -     * Sets the attribute attribute of the GroupCacheAccess object
  +     * Allows the user to put an object into a group within a particular cache
  +     * region. This method sets the object's attributes to the default for the
  +     * region.
        *
  -     * @param name The new attribute value
  -     * @param group The new attribute value
  -     * @param value The new attribute value
  +     * @param key The key name.
  +     * @param group The group name.
  +     * @param value The object to cache
        */
  -    public void setAttribute( Object name, String groupName, Object value )
  +    public void putInGroup( Object name, String groupName, Object value )
           throws CacheException
       {
  -        setAttribute(name, groupName, value, null);
  +        putInGroup(name, groupName, value, null);
       }
   
       /**
  -     * Sets the attribute attribute of the GroupCacheAccess object
  +     * Allows the user to put an object into a group within a particular cache
  +     * region. This method allows the object's attributes to be individually
  +     * specified.
        *
  -     * @param name The new attribute value
  -     * @param group The new attribute value
  -     * @param value The new attribute value
  -     * @param attr The new attribute value
  +     * @param key The key name.
  +     * @param group The group name.
  +     * @param value The object to cache
  +     * @param attr The objects attributes.
        */
  -    public void setAttribute( Object name, String groupName, Object value, 
  -                              IElementAttributes attr )
  +    public void putInGroup( Object name, String groupName, Object value, 
  +                            IElementAttributes attr )
           throws CacheException
       {
           Set group = (Set)
  @@ -325,15 +297,15 @@
           }
   
           // unbind object first if any.
  -        boolean isPreviousObj = removeAttribute( name, groupName, false);
  +        boolean isPreviousObj = remove( name, groupName, false);
   
           if (attr == null) 
           {
  -            put( new GroupAttrName(groupName, name), value );            
  +            put( getGroupAttrName(groupName, name), value );            
           }
           else 
           {
  -            put( new GroupAttrName(groupName, name), value, attr );            
  +            put( getGroupAttrName(groupName, name), value, attr );            
           }
   
           if (!isPreviousObj) 
  @@ -343,16 +315,16 @@
       }
   
       /** Description of the Method */
  -    public void removeAttribute( Object name, String group )
  +    public void remove( Object name, String group )
       {
  -        removeAttribute( name, group, true );
  +        remove( name, group, true );
       }
   
       /** Description of the Method */
  -    private boolean removeAttribute( Object name, String groupName, 
  -                                     boolean removeFromGroup )
  +    private boolean remove( Object name, String groupName, 
  +                            boolean removeFromGroup )
       {
  -        GroupAttrName key = new GroupAttrName( groupName, name );
  +        GroupAttrName key = getGroupAttrName( groupName, name );
           // Needs to retrieve the attribute so as to do object unbinding, 
           // if necessary.
           boolean isPreviousObj = cacheControl.get(key) != null;
  @@ -368,22 +340,6 @@
           return isPreviousObj;
       }
   
  -    /**
  -     * Removes an element from the group
  -     *
  -     * @deprecated
  -     */
  -    public void destroy( Object name, String group )
  -    {
  -        removeAttribute( name, group );
  -    }
  -
  -    /** Description of the Method */
  -    public void remove( Object name, String group )
  -    {
  -        removeAttribute( name, group );
  -    }
  -
       /** Invalidates a group */
       public void invalidateGroup( String group )
       {
  @@ -397,22 +353,11 @@
           int arS = ar.length;
           for ( int i = 0; i < arS; i++ )
           {
  -            removeAttribute( ar[i], group, false );
  +            remove( ar[i], group, false );
           }
   
  -        // get into concurrent modificaiton problems here.
  +        // get into concurrent modification problems here.
           // could make the removal of the ID invalidate the list?
           cacheControl.remove(new GroupId( cacheControl.getCacheName(), group ));
       }
  -
  -    /**
  -     * Gets the valueNames attribute of the GroupCacheAccess object
  -     *
  -     * @return The valueNames value
  -     */
  -    public String[] getValueNames( String group )
  -    {
  -        return ( String[] ) getAttributeNameSet( group ).toArray( new String[ 0 ] );
  -    }
  -
   }
  
  
  
  1.2       +0 -33     
jakarta-turbine-jcs/src/java/org/apache/jcs/access/behavior/IGroupCacheAccess.java
  
  Index: IGroupCacheAccess.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/access/behavior/IGroupCacheAccess.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IGroupCacheAccess.java    7 Apr 2002 16:55:21 -0000       1.1
  +++ IGroupCacheAccess.java    6 Jun 2002 05:31:11 -0000       1.2
  @@ -67,7 +67,6 @@
    */
   public interface IGroupCacheAccess extends ICacheAccess
   {
  -
       /**
        * Gets the g attribute of the IGroupCacheAccess object
        *
  @@ -116,36 +115,4 @@
        * @return The attributeNames value
        */
       Enumeration getAttributeNames( String name );
  -
  -
  -    /**
  -     * Sets the attribute attribute of the IGroupCacheAccess object
  -     *
  -     * @param name The new attribute value
  -     * @param group The new attribute value
  -     * @param value The new attribute value
  -     */
  -    void setAttribute( Object name, String group, Object value )
  -        throws CacheException;
  -
  -
  -    /**
  -     * Sets the attribute attribute of the IGroupCacheAccess object
  -     *
  -     * @param name The new attribute value
  -     * @param group The new attribute value
  -     * @param value The new attribute value
  -     * @param attr The new attribute value
  -     */
  -    void setAttribute( Object name, String group, Object value, IElementAttributes 
attr )
  -        throws CacheException;
  -
  -
  -    /**
  -     * Gets the attribute attribute of the IGroupCacheAccess object
  -     *
  -     * @return The attribute value
  -     */
  -    Object getAttribute( Object name, String group );
  -
   }
  
  
  

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

Reply via email to