avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source SourceValidity.java
Date Mon, 13 Jan 2003 13:14:12 GMT
cziegeler    2003/01/13 05:14:12

  Modified:    sourceresolve/src/java/org/apache/excalibur/source/impl/validity
                        TimeStampValidity.java
                        DeferredAggregatedValidity.java
                        AggregatedValidity.java FileTimeStampValidity.java
                        NOPValidity.java
               sourceresolve/src/java/org/apache/excalibur/source
                        SourceValidity.java
  Log:
  Changing SourceValidity interface to support deferred validities
  
  Revision  Changes    Path
  1.5       +4 -4      jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/TimeStampValidity.java
  
  Index: TimeStampValidity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/TimeStampValidity.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TimeStampValidity.java	15 Dec 2002 11:56:48 -0000	1.4
  +++ TimeStampValidity.java	13 Jan 2003 13:14:12 -0000	1.5
  @@ -84,15 +84,15 @@
           return 0;
       }
   
  -    public boolean isValid( SourceValidity newValidity )
  +    public int isValid( SourceValidity newValidity )
       {
           if( newValidity instanceof TimeStampValidity )
           {
               final long timeStamp =
                   ( (TimeStampValidity)newValidity ).getTimeStamp();
  -            return m_timeStamp == timeStamp;
  +            return (m_timeStamp == timeStamp ? +1 : 1);
           }
  -        return false;
  +        return -1;
       }
   
       public long getTimeStamp()
  
  
  
  1.2       +15 -8     jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/DeferredAggregatedValidity.java
  
  Index: DeferredAggregatedValidity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/DeferredAggregatedValidity.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeferredAggregatedValidity.java	10 Jan 2003 12:54:37 -0000	1.1
  +++ DeferredAggregatedValidity.java	13 Jan 2003 13:14:12 -0000	1.2
  @@ -108,7 +108,7 @@
           return 1;
       }
   
  -    public boolean isValid( final SourceValidity validity )
  +    public int isValid( final SourceValidity validity )
       {
           AbstractAggregatedValidity aggregatedValidity = null;
           
  @@ -122,22 +122,29 @@
               ArrayList otherList = aggregatedValidity.m_list;
               if( m_list.size() != otherList.size() )
               {
  -                return false;
  +                return -1;
               }
   
               for(int i=0; i < m_list.size(); i++) {
                   final SourceValidity srcA = this.getValidity(i);
  -                if ( srcA.isValid() < 1) {
  +                int result = srcA.isValid();
  +                if ( result == -1) 
  +                {
  +                    return -1;
  +                }
  +                if ( result == 0 )
  +                {
                       final SourceValidity srcB = aggregatedValidity.getValidity(i);
  -                    if( !srcA.isValid( srcB ) )
  +                    result = srcA.isValid( srcB );
  +                    if ( result < 1)
                       {
  -                        return false;
  +                        return result;
                       }
                   }
               }
  -            return true;
  +            return 1;
           }
  -        return false;
  +        return -1;
       }
   
       public String toString()
  
  
  
  1.6       +16 -7     jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/AggregatedValidity.java
  
  Index: AggregatedValidity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/AggregatedValidity.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AggregatedValidity.java	10 Jan 2003 12:54:37 -0000	1.5
  +++ AggregatedValidity.java	13 Jan 2003 13:14:12 -0000	1.6
  @@ -89,7 +89,7 @@
           return 1;
       }
   
  -    public boolean isValid( final SourceValidity validity )
  +    public int isValid( final SourceValidity validity )
       {
           if( validity instanceof AggregatedValidity )
           {
  @@ -97,21 +97,30 @@
               final List otherList = other.m_list;
               if( m_list.size() != otherList.size() )
               {
  -                return false;
  +                return -1;
               }
   
               for( final Iterator i = m_list.iterator(), j = otherList.iterator(); i.hasNext();
)
               {
                   final SourceValidity srcA = (SourceValidity)i.next();
                   final SourceValidity srcB = (SourceValidity)j.next();
  -                if( srcA.isValid() < 1 && !srcA.isValid( srcB ) )
  +                int result = srcA.isValid();
  +                if ( result == -1) 
                   {
  -                    return false;
  +                    return -1;
  +                }
  +                if ( result == 0 )
  +                {
  +                    result = srcA.isValid( srcB );
  +                    if ( result < 1)
  +                    {
  +                        return result;
  +                    }
                   }
               }
  -            return true;
  +            return 1;
           }
  -        return false;
  +        return -1;
       }
   
   }
  
  
  
  1.5       +4 -4      jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/FileTimeStampValidity.java
  
  Index: FileTimeStampValidity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/FileTimeStampValidity.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileTimeStampValidity.java	15 Dec 2002 11:56:48 -0000	1.4
  +++ FileTimeStampValidity.java	13 Jan 2003 13:14:12 -0000	1.5
  @@ -99,15 +99,15 @@
           return ( m_file.lastModified() == m_timeStamp ? 1 : -1 );
       }
   
  -    public boolean isValid( final SourceValidity newValidity )
  +    public int isValid( final SourceValidity newValidity )
       {
           if( newValidity instanceof FileTimeStampValidity )
           {
               final long timeStamp =
                   ( (FileTimeStampValidity)newValidity ).getTimeStamp();
  -            return ( m_timeStamp == timeStamp );
  +            return ( m_timeStamp == timeStamp ? 1 : -1);
           }
  -        return false;
  +        return -1;
       }
   
       public File getFile()
  
  
  
  1.5       +7 -3      jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/NOPValidity.java
  
  Index: NOPValidity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/NOPValidity.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NOPValidity.java	15 Dec 2002 11:56:48 -0000	1.4
  +++ NOPValidity.java	13 Jan 2003 13:14:12 -0000	1.5
  @@ -79,9 +79,13 @@
           return 1;
       }
   
  -    public boolean isValid( final SourceValidity newValidity )
  +    public int isValid( final SourceValidity newValidity )
       {
  -        return newValidity instanceof NOPValidity;
  +        if (newValidity instanceof NOPValidity)
  +        {
  +            return 1;
  +        }
  +        return -1;
       }
   
       public String toString()
  
  
  
  1.6       +13 -5     jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceValidity.java
  
  Index: SourceValidity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceValidity.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SourceValidity.java	15 Dec 2002 11:56:48 -0000	1.5
  +++ SourceValidity.java	13 Jan 2003 13:14:12 -0000	1.6
  @@ -87,9 +87,17 @@
       /**
        * Check if the component is still valid.
        * This is only true, if the incoming Validity is of the same
  -     * type and has the same values.
  -     * The invocation order is that the isValid method of the
  -     * old Validity object is called with the new one as a parameter
  +     * type and has the "same" values. 
  +     * The invocation order is that the isValid
  +     * method of the old Validity object is called with the new one as a
  +     * parameter.
  +     * @return -1 is returned, if the validity object is not valid anymore
  +     *          +1 is returned, if the validity object is still valid
  +     *          0  is returned, if the validity check could not be performed.
  +     *             In this case, the new validity object is not usable. Examples
  +     *             for this are: when the validity objects have different types,
  +     *             or when one validity object for any reason is not able to
  +     *             get the required information.
        */
  -    boolean isValid( SourceValidity newValidity );
  +    int isValid( SourceValidity newValidity );
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message