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

package sensei.middleware.domains;

import java.rmi.server.UnicastRemoteObject;

/**
  * Defines an abstract rmi class to implement the DomainGroupHandler interface
  **/
public abstract class DomainGroupHandlerBaseImpl extends UnicastRemoteObject implements DomainGroupHandler
{

  public DomainGroupHandlerBaseImpl() throws Exception
  {
    thisDomainGroupHandler=this;
  }

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

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

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

  public final DomainGroupHandler theDomainGroupHandler()
  {
    return thisDomainGroupHandler;
  }

  protected DomainGroupHandler thisDomainGroupHandler;
};