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.remote.server.behavior.RemoteType;
023import org.apache.commons.jcs.engine.behavior.ICacheListener;
024
025import java.io.IOException;
026import java.rmi.Remote;
027
028/**
029 * Listens for remote cache event notification ( rmi callback ).
030 */
031public interface IRemoteCacheListener<K, V>
032    extends ICacheListener<K, V>, Remote
033{
034    /**
035     * Get the id to be used by this manager.
036     * <p>
037     * @return long
038     * @throws IOException
039     */
040    @Override
041    long getListenerId()
042        throws IOException;
043
044    /**
045     * Set the id to be used by this manager. The remote cache server identifies clients by this id.
046     * The value will be set by the server through the remote cache listener.
047     * <p>
048     * @param id
049     * @throws IOException
050     */
051    @Override
052    void setListenerId( long id )
053        throws IOException;
054
055    /**
056     * Gets the remoteType attribute of the IRemoteCacheListener object
057     * <p>
058     * @return The remoteType value
059     * @throws IOException
060     */
061    RemoteType getRemoteType()
062        throws IOException;
063
064    /**
065     * This is for debugging. It allows the remote cache server to log the address of any listeners
066     * that register.
067     * <p>
068     * @return the local host address.
069     * @throws IOException
070     */
071    String getLocalHostAddress()
072        throws IOException;
073
074    /**
075     * Deregisters itself.
076     * <p>
077     * @throws IOException
078     */
079    void dispose()
080        throws IOException;
081}