Package com.sun.jini.start

Examples of com.sun.jini.start.SharedActivationGroupDescriptor


     *
     * @param sd the descriptor to check, which must be a
     *        <code>SharedActivatableServiceDescriptor</code
     */
    private void checkDirectory(SharedActivatableServiceDescriptor d) {
  SharedActivationGroupDescriptor gd = envCheck.getGroupDescriptor();
  String source = getString("descfor", d.getImplClassName());
  Object o = envCheck.launch(d, gd, taskName("GetEntriesTask"));
  if (o instanceof String[]) {
      checkEntries((String[]) o, d, source);
  } else if (o instanceof String) {
View Full Code Here


  if (dir == null) {
      return getString("nulldir");
  }
  String taskName = taskName("CheckDirTask");
  String[] args = new String[]{dir};
  SharedActivationGroupDescriptor g =  envCheck.getGroupDescriptor();
  return envCheck.launch(d, g, taskName, args);
    }
View Full Code Here

            + sharedGroupLog);
  }
  config.registerDeletion(sharedGroupLog);
  try {
      ServiceDescriptor desc =
    new SharedActivationGroupDescriptor(
               getServicePolicyFile(),
               getServiceClasspath(),
               sharedGroupLog.getAbsolutePath(),
               getServiceJVM(),
               getServiceOptions(),
               getServiceProperties(),
               getActivationHost(),
               getActivationPort());
      Configuration starterConfig = getStarterConfiguration();
      logServiceParameters(); // log debug output
      desc.create(starterConfig);
      String groupImpl = getMandatoryParameter("implPrefix");
      ActivatableServiceStarterAdmin implAdmin =
    new ActivatableServiceStarterAdmin(config,
               groupImpl,
               index,
View Full Code Here

     * @param d the descriptor
     */
    private void checkDescriptor(ServiceDescriptor d) {
  String policy;
  NonActivatableServiceDescriptor nad = null;
  SharedActivationGroupDescriptor gd = null;
  String source = null;
  if (d instanceof SharedActivationGroupDescriptor) {
      gd = (SharedActivationGroupDescriptor) d;
      policy = gd.getPolicy();
      source = getString("for",
            policy,
            "SharedActivationGroupDescriptor");
  } else {
      nad = (NonActivatableServiceDescriptor) d;
View Full Code Here

       
  String sharedVmLog = "/tmp/sharedvm.log";
        String[] sharedvm_props = new String[] {// server properties
        "com.sun.jini.start.activatewrapper.debug", "init",
          };
        SharedActivationGroupDescriptor sharedvm =
            new SharedActivationGroupDescriptor(
          "/view/resendes/vob/jive/policy/policy.sharedvm",
          "/view/resendes/vob/jive/lib/bogus_sharedvm.jar",
          sharedVmLog,
              "/bin/java", //server command
          new String[] {// server options
        "-ea",
    },
          sharedvm_props);

        SharedActivatableServiceDescriptor sasd =
            new SharedActivatableServiceDescriptor(
          "http://resendes:8080/mercury-dl.jar",
          "http://resendes:8086/policy.mercury",
          "http://resendes:8080/mercury.jar",
          "com.sun.jini.mercury.MailboxBogusImpl",
          sharedVmLog,
          new String[] {
        "http://resendes:8089/mercury_service_act.config"
    },
          true);

        SharedActivatableServiceDescriptor sasdWithExtras =
            new SharedActivatableServiceDescriptor(
          "http://resendes:8080/mercury-dl.jar",
          "http://resendes:8086/policy.mercury",
          "http://resendes:8080/mercury.jar",
          "com.sun.jini.mercury.MailboxBogusImpl",
          sharedVmLog,
          new String[] {
        "http://resendes:8089/mercury_service_act.config"
    },
                pp,
                pp,
          true,
                "localhost",
                1234);
               
        ServiceDescriptor[] serviceDescriptors =
      new ServiceDescriptor[] {
    // sasdWithExtras & nasdWithExtras not written because
                // default/recovered preparer and lifecycle objects won't match.
                nasdWithoutExtras,
    sharedvm,
    sasd
      };

        // Serialize service descriptors to a file
  FileOutputStream f = new FileOutputStream("tmp");   
  ObjectOutput oos = new ObjectOutputStream(f);   
  oos.writeObject(nasdWithExtras);   
         oos.writeObject(nasdWithoutExtras);   
  oos.writeObject(sharedvm);   
  oos.writeObject(sasd);   
  oos.writeObject(sasdWithExtras);   
        oos.writeObject(serviceDescriptors);   
  oos.flush();
  oos.close();
        logger.log(Level.INFO, "Wrote: " + nasdWithExtras);
        logger.log(Level.INFO, "Wrote: " + nasdWithoutExtras);       
        logger.log(Level.INFO, "Wrote: " + sharedvm);
        logger.log(Level.INFO, "Wrote: " + sasd);
        logger.log(Level.INFO, "Wrote: " + sasdWithExtras);
        logger.log(Level.INFO, "Wrote: " + Arrays.asList(serviceDescriptors));

        // Deserialize objects from a file.   
  FileInputStream in = new FileInputStream("tmp");   
  ObjectInputStream ois = new ObjectInputStream(in);   
  NonActivatableServiceDescriptor nasdWithExtras_r =
      (NonActivatableServiceDescriptor)ois.readObject();
  nasdWithExtras_r.setLifeCycle(lc);
        nasdWithExtras_r.setServicePreparer(pp);
  NonActivatableServiceDescriptor nasdWithoutExtras_r =
      (NonActivatableServiceDescriptor)ois.readObject();       
  SharedActivationGroupDescriptor sharedvm_r =
      (SharedActivationGroupDescriptor)ois.readObject();
  SharedActivatableServiceDescriptor sasd_r =
      (SharedActivatableServiceDescriptor)ois.readObject();
  SharedActivatableServiceDescriptor sasdWithExtras_r =
      (SharedActivatableServiceDescriptor)ois.readObject();
  //sasdWithExtras_r.setLifeCycle(lc);
        sasdWithExtras_r.setServicePreparer(pp);
        sasdWithExtras_r.setInnerProxyPreparer(pp);
  ServiceDescriptor[] recovered =
            (ServiceDescriptor[])ois.readObject();
  ois.close();
 
        logger.log(Level.INFO, "Read: " + nasdWithExtras_r);
        logger.log(Level.INFO, "Read: " + nasdWithoutExtras_r);
        logger.log(Level.INFO, "Read: " + sharedvm_r);
        logger.log(Level.INFO, "Read: " + sasd_r);
        logger.log(Level.INFO, "Read: " + sasdWithExtras_r);
        logger.log(Level.INFO, "Read: " + Arrays.asList(recovered));

  if (!verifyNonActivatableServiceDescriptors(nasdWithExtras, nasdWithExtras_r)) {
      throw new TestException(
          "Written and recovered NonActivatableServiceDescriptors don't match");
  }
  if (!verifyNonActivatableServiceDescriptors(nasdWithoutExtras, nasdWithoutExtras_r)) {
      throw new TestException(
          "Written and recovered NonActivatableServiceDescriptors don't match");
  }
        if (!verifySharedActivationGroupDescriptors(sharedvm, sharedvm_r)) {
      throw new TestException(
          "Written and recovered SharedActivationGroupDescriptors don't match");
  }
  if (!verifySharedActivatableServiceDescriptors(sasd, sasd_r)) {
      throw new TestException(
          "Written and recovered SharedActivatableServiceDescriptors don't match");
  }
  if (!verifySharedActivatableServiceDescriptors(sasdWithExtras, sasdWithExtras_r)) {
      throw new TestException(
          "Written and recovered SharedActivatableServiceDescriptors don't match");
  }
  if (!verifyServiceDescriptors(serviceDescriptors, recovered)) {
      throw new TestException(
          "Written and recovered ServiceDescriptor[] don't match");
  }
 
  //Do some negative tests - Ensure bad descriptor doesn't match
        NonActivatableServiceDescriptor bogus_nasd =
            new NonActivatableServiceDescriptor(
                nasdWithoutExtras.getExportCodebase(),
                nasdWithoutExtras.getPolicy(),
                nasdWithoutExtras.getImportCodebase(),
                nasdWithoutExtras.getImplClassName() + "_bogus",
                nasdWithoutExtras.getServerConfigArgs(),
          nasdWithoutExtras.getLifeCycle());
        if (verifyNonActivatableServiceDescriptors(bogus_nasd, nasdWithoutExtras)) {
      throw new TestException("Bogus NASD passed verification");
  }
  //Do some negative tests - Ensure setLifeCycle can't be called after creation
  try {
      nasdWithoutExtras.create(EmptyConfiguration.INSTANCE); //Original descriptor
  } catch (Exception e) {
            logger.log(Level.INFO, "exception creating NASD ... ignoring", e);
  }
  try {
      nasdWithoutExtras.setLifeCycle(lc);
  } catch (IllegalStateException ie) {
            logger.log(Level.INFO, "Expected exception setting NASD LifeCycle ... ignoring", ie);
  } catch (Exception e) {
      e.printStackTrace();
      throw new TestException("Unexpected exception: " + e);
  }
 
  try {
      nasdWithoutExtras_r.create(EmptyConfiguration.INSTANCE); //Recovered descriptor
  } catch (Exception e) {
            logger.log(Level.INFO, "exception creating recovered NASD ... ignoring", e);
  }
  try {
      nasdWithoutExtras_r.setLifeCycle(lc);
  } catch (IllegalStateException ie) {
            logger.log(Level.INFO, "Expected exception setting recovered NASD LifeCycle ... ignoring", ie);
  } catch (Exception e) {
      e.printStackTrace();
      throw new TestException("Unexpected exception: " + e);
  }

  //Do some negative tests - Ensure bad descriptor doesn't match
        SharedActivatableServiceDescriptor bogus_sasd =
            new SharedActivatableServiceDescriptor(
          sasd.getExportCodebase(),
          sasd.getPolicy(),
          sasd.getImportCodebase(),
          sasd.getImplClassName(),
          sasd.getSharedGroupLog() + "_bogus",
          sasd.getServerConfigArgs(),
          sasd.getRestart());
  if (verifySharedActivatableServiceDescriptors(bogus_sasd, sasd)) {
      throw new TestException("Bogus SASD passed verification");
  }
 
  //Do some negative tests - Ensure setLifeCycle can't be called after creation
  try {
      sasd.create(EmptyConfiguration.INSTANCE); //Original descriptor
  } catch (Exception e) {
            logger.log(Level.INFO, "exception creating SASD ... ignoring", e);
  }
  try {
      sasd.setLifeCycle(lc);
  } catch (IllegalStateException ie) {
            logger.log(Level.INFO, "Expected exception setting SASD LifeCycle ... ignoring", ie);
  } catch (Exception e) {
      e.printStackTrace();
      throw new TestException("Unexpected exception: " + e);
  }
  try {
      sasd_r.create(EmptyConfiguration.INSTANCE); //Recovered descriptor
  } catch (Exception e) {
            logger.log(Level.INFO, "exception creating recovered SASD ... ignoring", e);
  }
  try {
      sasd_r.setLifeCycle(lc);
  } catch (IllegalStateException ie) {
            logger.log(Level.INFO, "Expected exception setting recovered SASD LifeCycle ... ignoring", ie);
  } catch (Exception e) {
      e.printStackTrace();
      throw new TestException("Unexpected exception: " + e);
  }
   
        SharedActivationGroupDescriptor bogus_sharedvm =
            new SharedActivationGroupDescriptor(
          sharedvm.getPolicy(),
          sharedvm.getClasspath(),
          sharedvm.getLog() + "_bogus",
          sharedvm.getServerCommand(),
          sharedvm.getServerOptions(),
View Full Code Here

        (NonActivatableServiceDescriptor)read[i];
    if (!verifyNonActivatableServiceDescriptors(nasdw, nasdr)) {
        return false;
    }
      } else if (wrote[i] instanceof SharedActivationGroupDescriptor) {
          SharedActivationGroupDescriptor sagdw =
        (SharedActivationGroupDescriptor)wrote[i];
          SharedActivationGroupDescriptor sagdr =
        (SharedActivationGroupDescriptor)read[i];
    if (!verifySharedActivationGroupDescriptors(sagdw, sagdr)) {
        return false;
    }
      } else {
View Full Code Here

            throw new TestException(
                "Shared group classpath, "
                + "or policy was null");
        }

        SharedActivationGroupDescriptor sharedGroup =
            new SharedActivationGroupDescriptor(
                policy,
                classpath,
                ServiceDescriptorUtil.getLogDir(),
                null,
                null,
                null);
  create(sharedGroup);
        SharedActivationGroupDescriptor sharedGroupWithOpts =
            new SharedActivationGroupDescriptor(
                policy,
                classpath,
                ServiceDescriptorUtil.getLogDir(),
                "/bin/javax",
                new String[] { "-Xdebug" },
View Full Code Here

      }
  }

  for (int i=0; i < goodArgsList.length; i++) {
      try {
    SharedActivationGroupDescriptor sagd =
        (SharedActivationGroupDescriptor)
      cons.newInstance(goodArgsList[i]);
    if (!checkArgs(goodArgsList[i], sagd)) {
              throw new TestException(
                        "Failed -- check args");
    }
      } catch (Exception e) {
          throw new TestException(
                    "Failed -- failed good args: ["
        + i + "] ", e);
      }
  }

  String[] negOpts = (String[])opts.clone();
  negOpts[negOpts.length-1] = negOpts[negOpts.length-1] + "_diff";
  String[] negProps = (String[])props.clone();
  negProps[negProps.length-1] = negProps[negProps.length-1] + "_diff";

  try {
      SharedActivationGroupDescriptor sagd =
          (SharedActivationGroupDescriptor)
              cons.newInstance(goodArgsList[goodArgsList.length-1]);
            if (checkOptions(negOpts, sagd.getServerOptions())) {
                throw new TestException(
                    "Failed -- check options");
            }
            if (checkProperties(negProps, sagd.getServerProperties())) {
                throw new TestException(
                    "Failed -- check properties");
            }
  } catch (Exception e) {
      throw new TestException(
View Full Code Here

  }

        //Test good args
  for (int i=0; i < goodArgsList.length; i++) {
      try {
    SharedActivationGroupDescriptor sagd =
        (SharedActivationGroupDescriptor)
      cons.newInstance(goodArgsList[i]);
    if (!checkArgs(goodArgsList[i], sagd)) {
              throw new TestException(
                        "Failed -- check args");
    }
      } catch (Exception e) {
          throw new TestException(
                    "Failed -- failed good args: ["
        + i + "] ", e);
      }
  }

  String[] negOpts = (String[])opts.clone();
  negOpts[negOpts.length-1] = negOpts[negOpts.length-1] + "_diff";
  String[] negProps = (String[])props.clone();
  negProps[negProps.length-1] = negProps[negProps.length-1] + "_diff";

  try {
      SharedActivationGroupDescriptor sagd =
          (SharedActivationGroupDescriptor)
              cons.newInstance(goodArgsList[goodArgsList.length-1]);
            if (checkOptions(negOpts, sagd.getServerOptions())) {
                throw new TestException(
                    "Failed -- check options");
            }
            if (checkProperties(negProps, sagd.getServerProperties())) {
                throw new TestException(
                    "Failed -- check properties");
            }
  } catch (Exception e) {
      throw new TestException(
View Full Code Here

                    files[i].delete();
                }//endif
                sharedVMDirFD.delete();
            }//endif
            /* create activation group for no-op service & TestService-v */
            SharedActivationGroupDescriptor sharedActivationGroupDescriptor =
                   new SharedActivationGroupDescriptor(sharedVMPolicyFile,
                                                       sharedVMClasspath,
                                                       sharedVMDir,
                                                       serverCommand,
                                                       serverOptions,
                                                       serverProperties);
            sharedActivationGroupDescriptor.create(starterConfig);
            /* start no-op service in the shared VM just created */
            SharedActivatableServiceDescriptor destroyVMServiceDescriptor =
                new SharedActivatableServiceDescriptor(noopServiceCodebase,
                                                       noopServicePolicyFile,
                                                       noopServiceClasspath,
View Full Code Here

TOP

Related Classes of com.sun.jini.start.SharedActivationGroupDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.