home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / rmi / activation / ActivationGroupDesc.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  4.0 KB  |  129 lines

  1. /*
  2.  * @(#)ActivationGroupDesc.java    1.7 98/03/18
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.rmi.activation;
  16.  
  17. import java.io.IOException;
  18. import java.rmi.MarshalledObject;
  19. import java.security.CodeSource;
  20. import java.util.Properties;
  21.  
  22.  
  23. /**
  24.  * An activation group descriptor contains the information necessary to
  25.  * create/recreate an activation group in which to activate objects.
  26.  * Such a descriptor contains: <ul>
  27.  * <li> the group's class name,
  28.  * <li> the group's code source (the location of the group's class), and
  29.  * <li> a "marshalled" object that can contain group specific
  30.  * initialization data. </ul> <p>
  31.  *
  32.  * The group's class must be a concrete subclass of
  33.  * <code>ActivationGroup</code>. A subclass of
  34.  * <code>ActivationGroup</code> is created/recreated via the
  35.  * <code>ActivationGroup.createGroup</code> static method that invokes
  36.  * a special constructor that takes two arguments: <ul>
  37.  *
  38.  * <li> the group's <code>ActivationGroupID</code>, and
  39.  * <li> the group's initialization data (in a
  40.  * <code>java.rmi.MarshalledObject</code>)</ul><p>
  41.  *
  42.  * @version    1.7, 03/18/98
  43.  * @author    Ann Wollrath
  44.  * @since    JDK1.2
  45.  * @see        ActivationGroup
  46.  * @see        ActivationGroupID
  47.  */
  48. public final class ActivationGroupDesc implements java.io.Serializable
  49. {
  50.     private String className;
  51.     private CodeSource source;
  52.     private MarshalledObject data;
  53.     /** indicate compatibility with JDK 1.2 version of class */
  54.     private static final long serialVersionUID = -4936225423168276595L;
  55.  
  56.     /**
  57.      * Constructs a group descriptor that uses system default for
  58.      * group implementation and code source.  Properties specify
  59.      * environment.  The additional property
  60.      * <code>java.rmi.activation.security.class</code> and
  61.      * <code>java.rmi.activation.security.codebase</code> specifies
  62.      * (respectively) the class name of the security manager, and the
  63.      * codebase, the location, of the class. If former property is not
  64.      * set, then the <code>java.rmi.RMISecurityManager</code> will be
  65.      * used as the security manager for group.
  66.      *
  67.      * @param properties the set of properties to set when the group
  68.      * is recreated
  69.      * @exception IllegalArgumentException if <code>properties</code> is null
  70.      * @exception IOException if a <code>MarshalledObject</code> could
  71.      * not be created from the properties
  72.      */
  73.     public ActivationGroupDesc(Properties properties)
  74.     throws IOException
  75.     {
  76.     if (properties == null)
  77.         throw new IllegalArgumentException("properties can't be null");
  78.     
  79.     this.data = new MarshalledObject(properties);
  80.     this.className = "sun.rmi.server.ActivationGroupImpl";
  81.     }
  82.  
  83.     /**
  84.      * Specifies an alternate group implementation to be
  85.      * used for the group.
  86.      *
  87.      * @param className the group's fully package qualified className
  88.      * @param source the CodeSource from where to load the group's class
  89.      * @param data the group's initialization data contained in
  90.      * marshalled form (could contain properties, for example)
  91.      */
  92.     public ActivationGroupDesc(String className,
  93.                    CodeSource source,
  94.                    MarshalledObject data)
  95.     {
  96.     this.className = className;
  97.     this.source = source;
  98.     this.data = data;
  99.     }
  100.  
  101.     /**
  102.      * Returns the group's class name.
  103.      * @return the group's class name
  104.      */
  105.     public String getClassName() 
  106.     {
  107.     return className;
  108.     }
  109.  
  110.     /**
  111.      * Returns the group's code source.
  112.      * @return the group's code source
  113.      */
  114.     public CodeSource getCodeSource()
  115.     {
  116.     return source;
  117.     }
  118.  
  119.     /**
  120.      * Returns the group's initialization data.
  121.      * @return the group's initialization data
  122.      */
  123.     public MarshalledObject getData() 
  124.     {
  125.     return data;
  126.     }
  127. }
  128.  
  129.