/**
  * File: 		PropertiesHandler.java
  * Content: 	part of the RMI specification of sensei domains
  *           Interface to handle properties
  * Author: 	LuisM Pena
  * Date: 		27th October 2001
  * Version:  0.51.00
  * Last change:
  *
  **/


package sensei.middleware.domains;

import java.rmi.Remote;
import java.rmi.RemoteException;

/**
  * Interface to handle properties
  */
public interface PropertiesHandler extends Remote
{
  /**
   * Enables the use of properties, which is disabled by default.
   * This method must be invoked before the member joins the group, or an exception is raised.
   * Every member in the group must use the same properties
   * policy.
   */
  public void enableProperties() throws RemoteException, MemberStateException;

  /**
   * Returns the properties policy
   */
  public boolean arePropertiesEnabled() throws RemoteException;

  /**
   * Sets a PropertiesListener, that will receive the properties update notifications. The user
   * can be set at any moment, and if a nil user is specified, no user will be used.
   */
  public void setPropertiesListener(PropertiesListener listener) throws RemoteException, PropertiesDisabledException;

  /**
   * Returns the properties of all the members with state.
   * Properties are only available once the member has received the state. Otherwise, an
   * MemberStateException is thrown
   */
  public MemberProperties[] getAllProperties ()
    throws RemoteException, PropertiesDisabledException, MemberStateException;

  /**
   * Returns the property with the given name of all the members with state.
   * Properties are only available once the member has received the state. Otherwise, an
   * MemberStateException is thrown
   */
  public MemberProperties[] getPropertyForAllMembers (String nam)
    throws RemoteException, PropertiesDisabledException, MemberStateException;

  /**
   * Returns the properties of the specified member.
   * Properties are only available once the member has received the state. Otherwise, an
   * MemberStateException is thrown
   */
  public Property[] getMemberProperties (int loc)
    throws RemoteException, PropertiesDisabledException, MemberStateException;

  /**
   * Returns the property with the given name for the specified member.
   * Properties are only available once the member has received the state. Otherwise, an
   * MemberStateException is thrown
   */
  public String getMemberProperty (int loc, String name)
    throws RemoteException, PropertiesDisabledException, MemberStateException;

  /**
   * Returns the properties of the member handled by this PropertyHandler.
   * Properties for a given member are available at any moment, not just after the member receives the state
   */
  public Property[] getProperties()
    throws RemoteException, PropertiesDisabledException;

  /**
   * Returns the property with the given name for the member handled by this PropertyHandler.
   * Properties for a given member are available at any moment, not just after the member receives the state
   */
  public String getProperty(String name)
    throws RemoteException, PropertiesDisabledException;

  /**
   * Sets the properties for the member handled by this PropertyHandler.
   * Properties for a given member are available at any moment, not just after the member receives the state.
   * The properties are propagated to the group if the member has state, otherwise the other members will
   * know the changes once the transfer finishes.
   */
  public void setProperties (Property[] props)
    throws RemoteException, PropertiesDisabledException, MemberStateException;

  /**
   * Adds the properties for the member handled by this PropertyHandler. If some property were already
   * existing, its value is overriden.
   * Properties for a given member are available at any moment, not just after the member receives the state.
   * The properties are propagated to the group if the member has state, otherwise the other members will
   * know the changes once the transfer finishes.
   */
  public void addProperties (Property[] props)
    throws RemoteException, PropertiesDisabledException, MemberStateException;

  /**
   * Removes the properties for the member handled by this PropertyHandler. If some property were not
   * existing, it is ignored.
   * Properties for a given member are available at any moment, not just after the member receives the state.
   * The properties are propagated to the group if the member has state, otherwise the other members will
   * know the changes once the transfer finishes.
   */
  public void removeProperties (Property[] props)
    throws RemoteException, PropertiesDisabledException, MemberStateException;
}