View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.chemistry.opencmis.client.bindings.cache;
20  
21  import java.io.Serializable;
22  
23  import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
24  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
25  
26  /**
27   * A cache for type definition objects.
28   * <p>
29   * Implementations of this interface have to be tread-safe.
30   */
31  public interface TypeDefinitionCache extends Serializable {
32  
33      /**
34       * Initializes the cache.
35       */
36      void initialize(BindingSession session);
37  
38      /**
39       * Adds a type definition object to the cache.
40       * 
41       * @param repositoryId
42       *            the repository id
43       * @param typeDefinition
44       *            the type definition object
45       */
46      void put(String repositoryId, TypeDefinition typeDefinition);
47  
48      /**
49       * Retrieves a type definition object from the cache.
50       * 
51       * @param repositoryId
52       *            the repository id
53       * @param typeId
54       *            the type id
55       * @return the type definition object or <code>null</code> if the object is
56       *         not in the cache
57       */
58      TypeDefinition get(String repositoryId, String typeId);
59  
60      /**
61       * Removes a type definition object from the cache.
62       * 
63       * @param repositoryId
64       *            the repository id
65       * @param typeId
66       *            the type id
67       */
68      void remove(String repositoryId, String typeId);
69  
70      /**
71       * Removes all type definition objects of a repository from the cache.
72       * 
73       * @param repositoryId
74       *            the repository id
75       */
76      void remove(String repositoryId);
77  
78      /**
79       * Removes all cache entries.
80       */
81      void removeAll();
82  }