001package org.apache.commons.jcs.auxiliary.remote.behavior;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
023import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
024
025/**
026 * This defines the behavior expected of a remote cache client. This extends Auxiliary cache which
027 * in turn extends ICache.
028 * <p>
029 * I'd like generalize this a bit.
030 * <p>
031 * @author Aaron Smuts
032 */
033public interface IRemoteCacheClient<K, V>
034    extends AuxiliaryCache<K, V>
035{
036    /**
037     * Replaces the current remote cache service handle with the given handle. If the current remote
038     * is a Zombie, the propagate the events that may be queued to the restored service.
039     * <p>
040     * @param remote ICacheServiceNonLocal -- the remote server or proxy to the remote server
041     */
042    void fixCache( ICacheServiceNonLocal<?, ?> remote );
043
044    /**
045     * Gets the listenerId attribute of the RemoteCacheListener object.
046     * <p>
047     * All requests to the remote cache must include a listener id. This allows the server to avoid
048     * sending updates the the listener associated with this client.
049     * <p>
050     * @return The listenerId value
051     */
052    long getListenerId();
053
054    /**
055     * This returns the listener associated with this remote cache. TODO we should try to get this
056     * out of the interface.
057     * <p>
058     * @return IRemoteCacheListener
059     */
060    IRemoteCacheListener<K, V> getListener();
061}