View Javadoc

1   package org.apache.jcs.auxiliary.lateral;
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.apache.jcs.auxiliary.AuxiliaryCache;
23  import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
24  import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
25  import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
26  import org.apache.jcs.engine.behavior.ICompositeCacheManager;
27  
28  
29  /***
30   * Particular lateral caches should define their own factory.  It is
31   * not necessary to extend this base factory, but it can be useful.
32   * <p>
33   * The old factory tried to handle all types of laterals.  It was
34   * gettting cluttered by ad hoc if statements.  Since the javagroups
35   * lateral was jdk1.4 dependent it had to be moved.  As such, the
36   * old factory could no longer import it.  This motivated the change.
37   * <p>
38   * This abstraction layer should keep things cleaner.
39   * <p>
40   * @author Aaron Smuts
41   */
42  public abstract class LateralCacheAbstractFactory
43  	implements AuxiliaryCacheFactory
44  {
45  
46      private String name;
47  
48      /* (non-Javadoc)
49       * @see org.apache.jcs.auxiliary.AuxiliaryCacheFactory#createCache(org.apache.jcs.auxiliary.AuxiliaryCacheAttributes, org.apache.jcs.engine.behavior.ICompositeCacheManager)
50       */
51      public abstract AuxiliaryCache createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr );
52  
53      /***
54       * Makes sure a listener gets created. It will get monitored as soon as it
55       * is used.
56       * <p>
57       * This should be called by create cache.
58       * <p>
59       * @param lac  ILateralCacheAttributes
60       * @param cacheMgr
61       */
62      public abstract void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr );
63  
64      /***
65       * Gets the name attribute of the LateralCacheFactory object
66       * <p>
67       * @return The name value
68       */
69      public String getName()
70      {
71          return this.name;
72      }
73  
74      /***
75       * Sets the name attribute of the LateralCacheFactory object
76       * <p>
77       * @param name
78       *            The new name value
79       */
80      public void setName( String name )
81      {
82          this.name = name;
83      }
84  }