1 2 /* 3 * Enhydra Java Application Server Project 4 * 5 * The contents of this file are subject to the Enhydra Public License 6 * Version 1.1 (the "License"); you may not use this file except in 7 * compliance with the License. You may obtain a copy of the License on 8 * the Enhydra web site ( http://www.enhydra.org/ ). 9 * 10 * Software distributed under the License is distributed on an "AS IS" 11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 12 * the License for the specific terms governing rights and limitations 13 * under the License. 14 * 15 * The Initial Developer of the Enhydra Application Server is Lutris 16 * Technologies, Inc. The Enhydra Application Server and portions created 17 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc. 18 * All Rights Reserved. 19 * 20 * Contributor(s): 21 * 22 * $Id: PersistentStore.java,v 1.1 2005/07/13 11:09:06 slobodan Exp $ 23 */ 24 25 26 27 28 29 package com.lutris.util; 30 import java.io.Serializable; 31 32 /** 33 * Persitent storage interface. 34 * 35 * @author Kyle Clark 36 */ 37 public interface PersistentStore { 38 39 /** 40 * Method to store and object (persistent). 41 * 42 * @param key The key by which to identify the stored object. 43 * @param obj The serializable object to store. 44 * @exception com.lutris.util.PersistentStoreException 45 * if an error occurs. 46 */ 47 public void store(String key, Serializable obj) 48 throws com.lutris.util.PersistentStoreException; 49 50 /** 51 * Method to retrieve a stored object. 52 * 53 * @param key The key of the user whose session 54 * is to be retreived. 55 * @return The stored object. If an object is not 56 * stored under key, then <code>null</code> is returned. 57 * @see #remove 58 * @exception com.lutris.util.PersistentStoreException 59 * if an error occurs. 60 */ 61 public Object retrieve(String key) 62 throws com.lutris.util.PersistentStoreException; 63 64 /** 65 * Method to simultaneously retrieve and remove an 66 * object from persistent store. If an object is not 67 * stored under key, then null is returned. 68 * 69 * @param key The key by which to identify the stored object 70 * that is to be removed. 71 * @return The object that has been removed. 72 * @exception com.lutris.util.PersistentStoreException 73 * if an error occurs. 74 */ 75 public Object remove(String key) 76 throws com.lutris.util.PersistentStoreException; 77 78 /** 79 * Method to delete a a key. Any objects stored under 80 * key are also removed. If key is not defined, then 81 * this method does nothing. 82 * 83 * @param key 84 * The key to remove. 85 * @exception com.lutris.util.PersistentStoreException 86 * if an error occurs. 87 */ 88 public void delete(String key) 89 throws com.lutris.util.PersistentStoreException; 90 91 92 /** 93 * Method to query if an an object is stored. 94 * 95 * @param key The key by which to identify the stored object. 96 * @exception com.lutris.util.PersistentStoreException 97 * if an error occurs. 98 */ 99 public boolean exists(String key) 100 throws com.lutris.util.PersistentStoreException; 101 102 103 /** 104 * Method that returns an enumration of the keys 105 * of this persistent store. 106 * 107 * @exception com.lutris.util.PersistentStoreException 108 * if the enumeration could not be determined. 109 */ 110 public java.util.Enumeration keys() 111 throws com.lutris.util.PersistentStoreException; 112 113 114 } 115 116