Package net.jini.security

Examples of net.jini.security.ProxyPreparer


  Configuration c = config.getConfiguration();
  if (!(c instanceof com.sun.jini.qa.harness.QAConfiguration)) { // if none configuration
      return reg.getLease();
  }
  try {
      ProxyPreparer p = (ProxyPreparer) c.getEntry("test",
               "fiddlerLeasePreparer",
               ProxyPreparer.class);
      Lease l = reg.getLease();
      logger.log(Level.FINEST, "Returning prepared fiddler lease");
      return (Lease) p.prepareProxy(l);
  } catch (ConfigurationException e) {
      throw new RemoteException("Configuration Error", e);
  }
    }
View Full Code Here


    void startManager(Configuration config, LogOps log, Object service,
          ServiceID serviceID, Entry[] baseAttributes)
  throws IOException, ConfigurationException
    {
  // Default do nothing preparer
  final ProxyPreparer defaultPreparer =
      new net.jini.security.BasicProxyPreparer();

  if (serviceID == null)
      throw new NullPointerException("serviceID can't be null");

  this.log = log;

  lookupLocatorPreparer =
      (ProxyPreparer)Config.getNonNullEntry(config,
    OutriggerServerImpl.COMPONENT_NAME, "lookupLocatorPreparer",
    ProxyPreparer.class, defaultPreparer);

  dgm = (DiscoveryGroupManagement)
      Config.getNonNullEntry(config,
    OutriggerServerImpl.COMPONENT_NAME, "discoveryManager",
    DiscoveryGroupManagement.class,
    new LookupDiscoveryManager(
                    DiscoveryGroupManagement.NO_GROUPS, null, null,
        config));

  if (!(dgm instanceof DiscoveryManagement))
      throw throwNewConfigurationException("Entry for component " +
    OutriggerServerImpl.COMPONENT_NAME + ", name " +
    "discoveryManager must implement " +
          "net.jini.discovery.DiscoveryGroupManagement");

  if (!(dgm instanceof DiscoveryLocatorManagement))
      throw throwNewConfigurationException("Entry for component " +
    OutriggerServerImpl.COMPONENT_NAME + ", name " +
    "discoveryManager must implement " +
    "net.jini.discovery.DiscoveryLocatorManagement");

  final String[] toCheck = dgm.getGroups();
  if (toCheck == null || toCheck.length != 0)
      throw throwNewConfigurationException("Entry for component " +
    OutriggerServerImpl.COMPONENT_NAME + ", name " +
    "discoveryManager must be initially configured with no " +
                "groups");

  if (((DiscoveryLocatorManagement)dgm).getLocators().length != 0)
      throw throwNewConfigurationException("Entry for component " +
                OutriggerServerImpl.COMPONENT_NAME + ", name " +
    "discoveryManager must be initially configured with no " +
    "locators");

  // if this is the first incarnation, consult config for groups,
  // locators and attributes.
  if (initial) {
      groups = (String[])
    config.getEntry(OutriggerServerImpl.COMPONENT_NAME,
        "initialLookupGroups", String[].class,
        new String[]{""});

      locators = (LookupLocator[])
    Config.getNonNullEntry(config,
        OutriggerServerImpl.COMPONENT_NAME,
                    "initialLookupLocators", LookupLocator[].class,
                    new LookupLocator[0]);

      final Entry[] cAttrs = (Entry[])
    Config.getNonNullEntry(config,
                    OutriggerServerImpl.COMPONENT_NAME,
        "initialLookupAttributes", Entry[].class, new Entry[0]);

      if (cAttrs.length == 0) {
    attributes = baseAttributes;
      } else {
    attributes =
        new Entry[cAttrs.length + baseAttributes.length];
    System.arraycopy(baseAttributes, 0, attributes,
         0, baseAttributes.length);
    System.arraycopy(cAttrs, 0, attributes,
         baseAttributes.length, cAttrs.length);
      }
  } else {
      /* recovery : if there are any locators get and
       * use recoveredLookupLocatorPreparer
       */
      if (locators.length > 0) {
    final ProxyPreparer recoveredLookupLocatorPreparer =
        (ProxyPreparer)Config.getNonNullEntry(config,
            OutriggerServerImpl.COMPONENT_NAME,
      "recoveredLookupLocatorPreparer", ProxyPreparer.class,
       defaultPreparer);

    final List prepared = new java.util.LinkedList();
    for (int i=0; i<locators.length; i++) {
        final LookupLocator locator = locators[i];
        try {
      prepared.add(recoveredLookupLocatorPreparer.
             prepareProxy(locator));
        } catch (Throwable t) {
      logger.log(Level.INFO,
          "Encountered exception preparing lookup locator " +
          "for " + locator + ", dropping locator", t);
View Full Code Here

        "com.sun.jini.example.hello.Server", "configOptions",
        String[].class),
    createServiceID()));

  /* Get the activation system */
  ProxyPreparer actSysPreparer = (ProxyPreparer) config.getEntry(
      "com.sun.jini.example.hello.Server", "activationSystemPreparer",
      ProxyPreparer.class, new BasicProxyPreparer());
  ActivationSystem actSys =
      (ActivationSystem) actSysPreparer.prepareProxy(
    ActivationGroup.getSystem());

  /* Create the activation group */
  ActivationGroupID gid = actSys.registerGroup(groupDesc);

  /* Create the activation descriptor */
  ActivationDesc actDesc =
      new ActivationDesc(
    gid, ActivatableServer.class.getName(),
    null /* location */, data, true /* restart */);

  /* Register the activation descriptor */
  ProxyPreparer actIdPreparer = (ProxyPreparer) config.getEntry(
      "com.sun.jini.example.hello.Server", "activationIdPreparer",
      ProxyPreparer.class, new BasicProxyPreparer());
  ActivationID aid = (ActivationID) actIdPreparer.prepareProxy(
      actSys.registerObject(actDesc));

  /* Activate the server */
  aid.activate(true);

 
View Full Code Here

     */
    protected Exporter getExporter()
  throws ConfigurationException, RemoteException
    {
  /* Prepare the activation ID */
  ProxyPreparer actIdPreparer = (ProxyPreparer) config.getEntry(
      "com.sun.jini.example.hello.Server", "activationIdPreparer",
      ProxyPreparer.class, new BasicProxyPreparer());
  aid = (ActivationID) actIdPreparer.prepareProxy(aid);

  /* Provide the activation ID to the exporter */
  return (Exporter) config.getEntry(
      "com.sun.jini.example.hello.Server", "exporter", Exporter.class,
      Configuration.NO_DEFAULT, aid);
View Full Code Here

    new LookupDiscovery(new String[] { "" }, config),
    null, config);
  }

        /* Retrieve the server proxy preparer from the configuration */
  ProxyPreparer preparer = (ProxyPreparer) config.getEntry(
      "com.sun.jini.example.hello.Client",
      "preparer", ProxyPreparer.class, new BasicProxyPreparer());

        /* Create the filter to pass to the SDM for proxy preparation */
        ServiceItemFilter filter = new ProxyPreparerFilter(preparer);
View Full Code Here

      log = null;
  }

  /* activation-specific initialization */
  if (activationID != null) {
      ProxyPreparer activationIdPreparer = (ProxyPreparer)
    Config.getNonNullEntry(
        config, COMPONENT, "activationIdPreparer",
        ProxyPreparer.class, new BasicProxyPreparer());
      ProxyPreparer activationSystemPreparer = (ProxyPreparer)
    Config.getNonNullEntry(
        config, COMPONENT, "activationSystemPreparer",
        ProxyPreparer.class, new BasicProxyPreparer());

      this.activationID = (ActivationID)
    activationIdPreparer.prepareProxy(activationID);
      activationSystem = (ActivationSystem)
    activationSystemPreparer.prepareProxy(
        ActivationGroup.getSystem());

      serverExporter = (Exporter) Config.getNonNullEntry(
    config, COMPONENT, "serverExporter", Exporter.class,
    new ActivationExporter(
View Full Code Here

  final int p = (port <= 0) ? getActivationSystemPort() : port;
  try {
      sys = (ActivationSystem)
    Naming.lookup("//" + h + ":" + p +
            "/java.rmi.activation.ActivationSystem");
            ProxyPreparer activationSystemPreparer =
    (ProxyPreparer) Config.getNonNullEntry(config,
        START_PACKAGE, "activationSystemPreparer",
        ProxyPreparer.class, new BasicProxyPreparer());
      sys = (ActivationSystem) activationSystemPreparer.prepareProxy(sys);
  } catch (Exception e) {
      throw new ActivationException(
          "ActivationSystem @ " + host + ":" + port +
    " could not be obtained", e);
  }
View Full Code Here

                                                         ilFactory,
                                                         false,
                                                         true);
        /* For the activatable server */
        if(activationID != null) {
            ProxyPreparer aidPreparer =
              (ProxyPreparer)Config.getNonNullEntry(config,
                                                    COMPONENT_NAME,
                                                    "activationIdPreparer",
                                                    ProxyPreparer.class,
                                                    new BasicProxyPreparer());
            ProxyPreparer aSysPreparer =
              (ProxyPreparer)Config.getNonNullEntry(config,
                                                    COMPONENT_NAME,
                                                    "activationSystemPreparer",
                                                    ProxyPreparer.class,
                                                    new BasicProxyPreparer());
            activationID = (ActivationID)aidPreparer.prepareProxy
                                                               (activationID);
            activationSystem = (ActivationSystem)aSysPreparer.prepareProxy
                                                            (activationSystem);
            defaultExporter = new ActivationExporter(activationID,
                                                     defaultExporter);
        }//endif(activationID != null)

View Full Code Here

  String[] entryTokens = splitKey(preparerName);
  if (entryTokens == null) {
      throw new TestException("Illegal Preparer name: " + preparerName);
  }
  try {
      ProxyPreparer p = (ProxyPreparer) c.getEntry(entryTokens[0],
               entryTokens[1],
               ProxyPreparer.class);
      return p.prepareProxy(target);
  } catch (ConfigurationException e) {
      throw new TestException("Configuration Error preparing "
            + target, e);
  } catch (RemoteException e) {
      throw new TestException("Remote Exception preparing "
View Full Code Here

    {
  if (activationID != null) {
      activationSystem = ActivationGroup.getSystem();
      // if not the none configuration, prepare proxies
      if (!noneConfiguration) {
    ProxyPreparer activationIdPreparer =
        (ProxyPreparer) Config.getNonNullEntry(config,
                   "lookupSimulator",
                   "activationIdPreparer",
                   ProxyPreparer.class);
 
    ProxyPreparer activationSystemPreparer = (ProxyPreparer)
        Config.getNonNullEntry(config,
               "lookupSimulator",
               "activationSystemPreparer",
               ProxyPreparer.class);

    activationID = (ActivationID)
        activationIdPreparer.prepareProxy(activationID);
    activationSystem = (ActivationSystem)
        activationSystemPreparer.prepareProxy(activationSystem);
      }
  }
  if (noneConfiguration) {
      serverExporter =
    new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
View Full Code Here

TOP

Related Classes of net.jini.security.ProxyPreparer

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.