View Javadoc
1   package org.eclipse.aether.impl;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   * 
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   * 
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.eclipse.aether.RepositorySystemSession;
23  
24  /**
25   * Evaluates update policies.
26   * 
27   * @noimplement This interface is not intended to be implemented by clients.
28   * @noextend This interface is not intended to be extended by clients.
29   * @provisional This type is provisional and can be changed, moved or removed without prior notice.
30   */
31  public interface UpdatePolicyAnalyzer
32  {
33  
34      /**
35       * Returns the policy with the shorter update interval.
36       * 
37       * @param session The repository system session during which the request is made, must not be {@code null}.
38       * @param policy1 A policy to compare, may be {@code null}.
39       * @param policy2 A policy to compare, may be {@code null}.
40       * @return The policy with the shorter update interval.
41       */
42      String getEffectiveUpdatePolicy( RepositorySystemSession session, String policy1, String policy2 );
43  
44      /**
45       * Determines whether the specified modification timestamp satisfies the freshness constraint expressed by the given
46       * update policy.
47       * 
48       * @param session The repository system session during which the check is made, must not be {@code null}.
49       * @param lastModified The timestamp to check against the update policy.
50       * @param policy The update policy, may be {@code null}.
51       * @return {@code true} if the specified timestamp is older than acceptable by the update policy, {@code false}
52       *         otherwise.
53       */
54      boolean isUpdatedRequired( RepositorySystemSession session, long lastModified, String policy );
55  
56  }