1 /* 2 * $Id: ObjectStore.java 12058 2008-06-16 12:02:56Z rossmason $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com 5 * 6 * The software in this package is published under the terms of the CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 package org.mule.api.store; 11 12 /** 13 * TODO 14 */ 15 16 public interface ObjectStore 17 { 18 /** 19 * Check whether the given Object is already registered with this store. 20 * 21 * @param id the ID to check 22 * @return <code>true</code> if the ID is stored or <code>false</code> if it could 23 * not be found 24 * @throws IllegalArgumentException if the given ID is <code>null</code> 25 * @throws Exception if any implementation-specific error occured, e.g. when the store 26 * is not available 27 */ 28 boolean containsObject(String id) throws Exception; 29 30 /** 31 * Store the given Object. 32 * 33 * @param id the ID to store 34 * @param item the Object to store with the id 35 * @return <code>true</code> if the ID was stored properly, or <code>false</code> 36 * if it already existed 37 * @throws IllegalArgumentException if the given ID cannot be stored or is 38 * <code>null</code> 39 * @throws Exception if the store is not available or any other 40 * implementation-specific error occured 41 */ 42 boolean storeObject(String id, Object item) throws Exception; 43 44 /** 45 * Retrieve the given Object. 46 * 47 * @param id the ID to store 48 * @return the object instance associated with this id or null if there was no entry for the supplied id. 49 * @throws IllegalArgumentException if the given ID cannot be stored or is 50 * <code>null</code> 51 * @throws Exception if the store is not available or any other 52 * implementation-specific error occured 53 */ 54 Object retrieveObject(String id) throws Exception; 55 56 boolean removeObject(String id) throws Exception; 57 58 }