1   package org.apache.jcs.auxiliary.remote;
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 java.io.IOException;
23  import java.io.Serializable;
24  import java.rmi.RemoteException;
25  import java.util.Set;
26  
27  import org.apache.jcs.access.exception.ObjectExistsException;
28  import org.apache.jcs.access.exception.ObjectNotFoundException;
29  import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
30  import org.apache.jcs.engine.behavior.ICacheElement;
31  
32  /***
33   * This is a mock impl of the remote cache service.
34   * <p>
35   * @author admin
36   */
37  public class RemoteCacheServiceMockImpl
38      implements IRemoteCacheService
39  {
40      /*** The object that was last passed to update. */
41      public Object lastUpdate;
42  
43      /*** The key that was last passed to remove. */
44      public Object lastRemoveKey;
45  
46      /***
47       * The cache name that was last passed to removeAll.
48       */
49      public String lastRemoveAllCacheName;
50  
51      /*
52       * (non-Javadoc)
53       * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService#get(java.lang.String,
54       *      java.io.Serializable, long)
55       */
56      public ICacheElement get( String cacheName, Serializable key, long requesterId )
57          throws IOException
58      {
59          // TODO Auto-generated method stub
60          return null;
61      }
62  
63      /*
64       * (non-Javadoc)
65       * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService#getGroupKeys(java.lang.String,
66       *      java.lang.String)
67       */
68      public Set getGroupKeys( String cacheName, String groupName )
69          throws RemoteException
70      {
71          // TODO Auto-generated method stub
72          return null;
73      }
74  
75      /*
76       * (non-Javadoc)
77       * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService#remove(java.lang.String,
78       *      java.io.Serializable, long)
79       */
80      public void remove( String cacheName, Serializable key, long requesterId )
81          throws IOException
82      {
83          lastRemoveKey = key;
84      }
85  
86      /***
87       * Set the lastRemoveAllCacheName to the cacheName.
88       * <p>
89       * (non-Javadoc)
90       * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService#removeAll(java.lang.String,
91       *      long)
92       */
93      public void removeAll( String cacheName, long requesterId )
94          throws IOException
95      {
96          lastRemoveAllCacheName = cacheName;
97      }
98  
99      /*
100      * (non-Javadoc)
101      * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService#update(org.apache.jcs.engine.behavior.ICacheElement,
102      *      long)
103      */
104     public void update( ICacheElement item, long requesterId )
105         throws ObjectExistsException, IOException
106     {
107         lastUpdate = item;
108     }
109 
110     public void dispose( String cacheName )
111         throws IOException
112     {
113         // TODO Auto-generated method stub
114 
115     }
116 
117     /*
118      * (non-Javadoc)
119      * @see org.apache.jcs.engine.behavior.ICacheService#get(java.lang.String, java.io.Serializable)
120      */
121     public ICacheElement get( String cacheName, Serializable key )
122         throws ObjectNotFoundException, IOException
123     {
124         // TODO Auto-generated method stub
125         return null;
126     }
127 
128     /*
129      * (non-Javadoc)
130      * @see org.apache.jcs.engine.behavior.ICacheService#release()
131      */
132     public void release()
133         throws IOException
134     {
135         // TODO Auto-generated method stub
136 
137     }
138 
139     /*
140      * (non-Javadoc)
141      * @see org.apache.jcs.engine.behavior.ICacheService#remove(java.lang.String,
142      *      java.io.Serializable)
143      */
144     public void remove( String cacheName, Serializable key )
145         throws IOException
146     {
147         lastRemoveKey = key;
148     }
149 
150     /*
151      * (non-Javadoc)
152      * @see org.apache.jcs.engine.behavior.ICacheService#removeAll(java.lang.String)
153      */
154     public void removeAll( String cacheName )
155         throws IOException
156     {
157         lastRemoveAllCacheName = cacheName;
158     }
159 
160     /*
161      * (non-Javadoc)
162      * @see org.apache.jcs.engine.behavior.ICacheService#update(org.apache.jcs.engine.behavior.ICacheElement)
163      */
164     public void update( ICacheElement item )
165         throws ObjectExistsException, IOException
166     {
167         lastUpdate = item;
168     }
169 
170 }