/**
  * File: DynamicSubgroupsUserBaseImpl.java
  * Content: Defines an abstract rmi class to implement the DynamicSubgroupsUser 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 DynamicSubgroupsUser RMI interface.
  **/
public abstract class DynamicSubgroupsUserBaseImpl extends UnicastRemoteObject implements DynamicSubgroupsUser
{

  public DynamicSubgroupsUserBaseImpl() throws Exception
  {
    thisDynamicSubgroupsUser=this;
  }

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

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

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

  public final DynamicSubgroupsUser theDynamicSubgroupsUser()
  {
    return thisDynamicSubgroupsUser;
  }

  protected DynamicSubgroupsUser thisDynamicSubgroupsUser;
};