/**
  * File: PropertiesListenerBaseImpl.java
  * Content: Defines an abstract rmi class to implement the PropertiesListener interface
  * Author: LuisM Pena
  * Date: 28th October 2001
  * Version:  0.51.00
  * Last change:
  *
  **/

package sensei.middleware.domains;

import java.rmi.server.UnicastRemoteObject;

/**
  * Implementation of the PropertiesListener RMI interface.
  **/
public abstract class PropertiesListenerBaseImpl extends UnicastRemoteObject implements PropertiesListener
{

  public PropertiesListenerBaseImpl() throws Exception
  {
    thisPropertiesListener=this;
  }

  public PropertiesListenerBaseImpl(boolean activate) throws Exception
  {
    if (!activate)
      deactivate();
  }

  public void activate() throws Exception
  {
    if (thisPropertiesListener==null)
    {
      thisPropertiesListener=this;
      exportObject(this);
    }
  }

  public void deactivate() throws Exception
  {
    synchronized (this)
    {
      if (thisPropertiesListener!=null)
        unexportObject(thisPropertiesListener,true);
      thisPropertiesListener=null;
    }
  }

  public final PropertiesListener thePropertiesListener()
  {
    return thisPropertiesListener;
  }

  protected PropertiesListener thisPropertiesListener;
};