View Javadoc
1   /*
2    * This file is part of dependency-check-core.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   * Copyright (c) 2012 Jeremy Long. All Rights Reserved.
17   */
18  package org.owasp.dependencycheck.data.update;
19  
20  import org.owasp.dependencycheck.Engine;
21  import org.owasp.dependencycheck.data.update.exception.UpdateException;
22  
23  /**
24   * Defines a data source who's data is retrieved from the Internet. This data
25   * can be downloaded and the local cache updated.
26   *
27   * @author Jeremy Long
28   */
29  public interface CachedWebDataSource {
30  
31      /**
32       * Determines if an update to the current data store is needed, if it is the
33       * new data is downloaded from the Internet and imported into the current
34       * cached data store.
35       *
36       * @param engine a reference to the dependency-check engine
37       * @return whether or not an update was made to the CveDB
38       * @throws UpdateException is thrown if there is an exception downloading
39       * the data or updating the data store.
40       */
41      boolean update(Engine engine) throws UpdateException;
42  
43      /**
44       * Deletes any locally cached data.
45       *
46       * @param engine a reference to the dependency-check engine
47       * @return <code>true</code> if the purge was successful; otherwise
48       * <code>false</code>
49       */
50      boolean purge(Engine engine);
51  }