Пример #1
0
 /**
  * Starts a JADE container in the Single-container modality. Successive calls to this method will
  * take no effect.
  *
  * @param p the profile containing boostrap and configuration data for this container
  * @exception IllegalStateException if the Multiple-container modality was previously activated by
  *     calling the <code>createAgentContainer()</code> or <code>createMainContainer()</code>
  *     methods.
  */
 public void startUp(Profile p) {
   if (mode == MULTIPLE_MODE) {
     throw new IllegalStateException("Multiple-container modality already activated");
   }
   if (mode == UNKNOWN_MODE) {
     mode = SINGLE_MODE;
     theContainer = new AgentContainerImpl(p);
     beginContainer();
     theContainer.joinPlatform();
   }
 }
Пример #2
0
 /**
  * Creates a new main container in the current JVM, providing access through a proxy object. <br>
  * <b>NOT available in MIDP</b> <br>
  *
  * @param p the profile containing boostrap and configuration data for this container
  * @return A proxy object, through which services can be requested from the real JADE main
  *     container.
  * @exception IllegalStateException if the Single-container modality was previously activated by
  *     calling the <code>startUp()</code> method.
  */
 public jade.wrapper.AgentContainer createMainContainer(Profile p) {
   if (mode == UNKNOWN_MODE || mode == MULTIPLE_MODE) {
     mode = MULTIPLE_MODE;
     p.setParameter(Profile.MAIN, "true"); // set to a main container
     AgentContainerImpl impl = new AgentContainerImpl(p);
     beginContainer();
     if (impl.joinPlatform()) {
       return impl.getContainerController();
     } else {
       return null;
     }
   } else {
     throw new IllegalStateException("Single-container modality already activated");
   }
 }