/*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
 * 
 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
 * language governing rights and limitations under the License.
 * 
 * The Original Code is the Venice Web Communities System.
 * 
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 * Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 * 
 * Contributor(s): 
 */
package com.silverwrist.dynamo.iface;

import java.util.Collection;
import com.silverwrist.dynamo.except.DatabaseException;
import com.silverwrist.dynamo.except.DynamoSecurityException;

/**
 * An extension to {@link com.silverwrist.dynamo.iface.ObjectProvider ObjectProvider} which allows objects to be
 * set into this object as well as retrieved from it.  This interface is used in place of
 * {@link com.silverwrist.dynamo.iface.ObjectStore ObjectStore} in cases where the object store is restricted
 * to access by specified users or groups of users.
 *
 * @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
 * @version X
 */
public interface SecureObjectStore extends ObjectProvider
{
  /**
   * Sets an object into this <CODE>SecureObjectStore</CODE>.
   *
   * @param caller The user performing the operation.
   * @param namespace The namespace to interpret the name relative to.
   * @param name The name of the object to be set.
   * @param value The object to set into the <CODE>SecureObjectStore</CODE>.
   * @return The previous object that was set into the <CODE>SecureObjectStore</CODE> under this namespace and name, or
   *         <CODE>null</CODE> if there was no such object.
   * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error setting the object value.
   * @exception com.silverwrist.dynamo.except.DynamoSecurityException If the specified user is not permitted to
   *            set this object value into this <CODE>SecureObjectStore</CODE>.
   */
  public Object setObject(DynamoUser caller, String namespace, String name, Object value)
      throws DatabaseException, DynamoSecurityException;

  /**
   * Removes an object from this <CODE>SecureObjectStore</CODE>.
   *
   * @param caller The user performing the operation.
   * @param namespace The namespace to interpret the name relative to.
   * @param name The name of the object to be removed.
   * @return The previous object that was set into the <CODE>SecureObjectStore</CODE> under this namespace and name, or
   *         <CODE>null</CODE> if there was no such object.
   * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error removing the object value.
   * @exception com.silverwrist.dynamo.except.DynamoSecurityException If the specified user is not permitted to
   *            remove this object value from this <CODE>SecureObjectStore</CODE>.
   */
  public Object removeObject(DynamoUser caller, String namespace, String name)
      throws DatabaseException, DynamoSecurityException;

  /**
   * Returns a collection of all object namespaces that have been set into this <CODE>SecureObjectStore</CODE>.
   *
   * @return A {@link java.util.Collection Collection} containing {@link java.lang.String String} objects specifying
   *         all the object namespaces.
   * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error getting the namespace list.
   */
  public Collection getNamespaces() throws DatabaseException;

  /**
   * Returns a collection of all object names that have been set into this <CODE>SecureObjectStore</CODE> under
   * a given namespace.
   *
   * @param namespace The namespace to look for names under.
   * @return A {@link java.util.Collection Collection} containing {@link java.lang.String String} objects
   *         specifying all the object names for this namespace.
   * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error getting the object name list.
   */
  public Collection getNamesForNamespace(String namespace) throws DatabaseException;

} // end interface SecureObjectStore
