Package net.jini.security

Examples of net.jini.security.ProxyPreparer


  }
//TODO - defer "big" default object to catch block around getNonNullEntry()
   
        // Get activation specific configuration items, if activated
  if (activationID != null) {
            ProxyPreparer activationSystemPreparer =
                (ProxyPreparer) Config.getNonNullEntry(config,
              MERCURY, "activationSystemPreparer",
        ProxyPreparer.class, new BasicProxyPreparer());
            if (initLogger.isLoggable(Level.CONFIG)) {
                initLogger.log(Level.CONFIG, "activationSystemPreparer: {0}",
          activationSystemPreparer);
      }   
            activationSystem =
                (ActivationSystem) activationSystemPreparer.prepareProxy(
                    ActivationGroup.getSystem());
            if (initLogger.isLoggable(Level.FINEST)) {
                initLogger.log(Level.FINEST, "Prepared activation system is: {0}",
          activationSystem);
      }   
            ProxyPreparer activationIdPreparer =
          (ProxyPreparerConfig.getNonNullEntry(config,
              MERCURY, "activationIdPreparer",
        ProxyPreparer.class, new BasicProxyPreparer());
            if (initLogger.isLoggable(Level.CONFIG)) {
                initLogger.log(Level.CONFIG, "activationIdPreparer: {0}",
          activationIdPreparer);
      }   
            activationID = (ActivationID) activationIdPreparer.prepareProxy(
                activationID);
            if (initLogger.isLoggable(Level.FINEST)) {
                initLogger.log(Level.FINEST, "Prepared activationID is: {0}",
          activationID);
      }   
            activationPrepared = true;
 
            exporter = (Exporter)Config.getNonNullEntry(config,
          MERCURY, "serverExporter", Exporter.class,
    new ActivationExporter(
        activationID,
        new BasicJeriExporter(
            TcpServerEndpoint.getInstance(0),
      new BasicILFactory(), false, true)),
    activationID);
            if (initLogger.isLoggable(Level.CONFIG)) {
                initLogger.log(Level.CONFIG, "Activatable service exporter is: {0}",
          exporter);
      }   
  } else { //Get non-activatable configuration items
            exporter = (Exporter) Config.getNonNullEntry(config,
                MERCURY, "serverExporter", Exporter.class,
    new BasicJeriExporter(
        TcpServerEndpoint.getInstance(0),
        new BasicILFactory(), false, true));
            if (initLogger.isLoggable(Level.CONFIG)) {
                initLogger.log(Level.CONFIG,
    "Non-activatable service exporter is: {0}", exporter);   
      }
  }

        listenerPreparer = (ProxyPreparer) Config.getNonNullEntry(
      config, MERCURY, "listenerPreparer", ProxyPreparer.class,
            new BasicProxyPreparer());
        if (initLogger.isLoggable(Level.CONFIG)) {
            initLogger.log(Level.CONFIG, "Listener preparer is: {0}",
      listenerPreparer)
  }
 
        /* Get the proxy preparers for the lookup locators to join */
        locatorToJoinPreparer = (ProxyPreparer)Config.getNonNullEntry
             (config, MERCURY, "locatorToJoinPreparer",
              ProxyPreparer.class, new BasicProxyPreparer());
        if (initLogger.isLoggable(Level.CONFIG)) {
            initLogger.log(Level.CONFIG, "Locator preparer is: {0}",
      locatorToJoinPreparer);
 
 
        // Create lease policy -- used by recovery logic, below
        leasePolicy = (LeasePeriodPolicy) Config.getNonNullEntry(config,
      MERCURY, "leasePeriodPolicy", LeasePeriodPolicy.class,
            new FixedLeasePeriodPolicy(3 * HOURS, 1 * HOURS));
        if (initLogger.isLoggable(Level.CONFIG)) {
            initLogger.log(Level.CONFIG, "LeasePeriodPolicy is: {0}",
      leasePolicy);
 
     
  // Note: referenced by recovery logic in rebuildTransientState() 
        ProxyPreparer recoveredListenerPreparer = null;
        if (persistent) {
      persistenceDirectory =
          (String)Config.getNonNullEntry(
                    config, MERCURY, "persistenceDirectory", String.class);
            if (initLogger.isLoggable(Level.CONFIG)) {
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

  txnMonitor = new TxnMonitor(this, config);

  /* Get the activation related preparers we need */

  // Default do nothing preparer
  final ProxyPreparer defaultPreparer =
      new net.jini.security.BasicProxyPreparer();

  if (activationID != null) {
      final ProxyPreparer aidPreparer =
    (ProxyPreparer)Config.getNonNullEntry(config,
        COMPONENT_NAME, "activationIdPreparer",
        ProxyPreparer.class, defaultPreparer);
               
      final ProxyPreparer aSysPreparer =
    (ProxyPreparer)Config.getNonNullEntry(config,
         COMPONENT_NAME, "activationSystemPreparer",
         ProxyPreparer.class, defaultPreparer);

      activationID =
    (ActivationID)aidPreparer.prepareProxy(activationID);
      activationSystem =
    (ActivationSystem)aSysPreparer.prepareProxy(
        ActivationGroup.getSystem());
  }


  // The preparers that all outrigger's need
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

      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

  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

            throw e.getException();
        }
    }
   
    private void doInit(Configuration config) throws Exception {
        ProxyPreparer activationSystemPreparer =
            (ProxyPreparer) config.getEntry(
                START_PACKAGE, "activationSystemPreparer",
                ProxyPreparer.class, new BasicProxyPreparer());
  if (activationSystemPreparer == null) {
             throw new ConfigurationException(START_PACKAGE
       + ".activationSystemPreparer entry should not be null");
        }
        logger.log(Level.FINE, START_PACKAGE + ".activationSystemPreparer: {0}",
            activationSystemPreparer);
     
  ProxyPreparer activationIdPreparer = (ProxyPreparer)
      config.getEntry(START_PACKAGE, "activationIdPreparer",
      ProxyPreparer.class, new BasicProxyPreparer());
  if (activationIdPreparer == null) {
             throw new ConfigurationException(START_PACKAGE
       + ".activationIdPreparer entry should not be null");
        }
        logger.log(Level.FINE, START_PACKAGE + ".activationIdPreparer: {0}",
            activationIdPreparer);
     
        // Prepare activation subsystem
  /*
   * ActivationGroup is trusted and returned ActivationSystem
   * might already have been prepared by the group itself.
   */
  activationSystem = (ActivationSystem)
      activationSystemPreparer.prepareProxy(
                ActivationGroup.getSystem());
        logger.log(Level.FINE, "Prepared ActivationSystem: {0}",
            activationSystem);
  activationID = (ActivationID
      activationIdPreparer.prepareProxy(activationID);
        logger.log(Level.FINEST, "Prepared ActivationID: {0}",
            activationID);

        /**
   * Would like to get this entry sooner, but need to use
View Full Code Here

  if (serviceID == null || serviceUuid == null)
            throw new AssertionError(
         "serviceID and serviceUuid must be set");
   
        // Default do nothing preparer
        final ProxyPreparer defaultPreparer =
            new net.jini.security.BasicProxyPreparer();
        lookupLocatorPreparer =
            (ProxyPreparer)Config.getNonNullEntry(config,
                TxnManager.MAHALO, "lookupLocatorPreparer",
                ProxyPreparer.class, defaultPreparer);
        if(initlogger.isLoggable(Level.CONFIG)) {
      initlogger.log(Level.CONFIG, "lookupLocatorPreparer: {0}",
           lookupLocatorPreparer);
  }
//TODO - defer creation of default LDM
  dm = (DiscoveryManagement)
      Config.getNonNullEntry(config, TxnManager.MAHALO,
    "discoveryManager", DiscoveryManagement.class,
    new LookupDiscoveryManager(
                    DiscoveryGroupManagement.NO_GROUPS, null, null, config));
        if(initlogger.isLoggable(Level.CONFIG)) {
      initlogger.log(Level.CONFIG, "discoveryManager: {0}", dm);
  }

  if (dm instanceof DiscoveryGroupManagement) {
      // Verify proper initial state ---> NO_GROUPS
            String[] groups =
                       ((DiscoveryGroupManagement)dm).getGroups();
            if( (groups == DiscoveryGroupManagement.ALL_GROUPS) ||
          (groups.length != 0) )
            {
                throw new ConfigurationException(
        "discoveryManager entry must be configured " +
        "to initially discover/join NO_GROUPS");
            }//endif
   
        } else {
            throw new ConfigurationException("Entry for component " +
    TxnManager.MAHALO + ", name " +
    "discoveryManager must implement " +
          "net.jini.discovery.DiscoveryGroupManagement");
  }
 
  if (dm instanceof DiscoveryLocatorManagement) {
            LookupLocator[] locs =
                    ((DiscoveryLocatorManagement)dm).getLocators();
            if( (locs != null) && (locs.length != 0) ) {
                throw new ConfigurationException
                    ("discoveryManager entry must be initially"
        + "configured with no locators");
            }//endif
  } else {
      throw new ConfigurationException("Entry for component " +
    TxnManager.MAHALO + ", name " +
    "discoveryManager must implement " +
    "net.jini.discovery.DiscoveryLocatorManagement");
  }

  // if this is the first incarnation, consult config for groups,
  // locators and attributes.
  if (initial) {
            if(initlogger.isLoggable(Level.FINEST)) {
          initlogger.log(Level.FINEST, "Obtaining initial values");
      }
      groups = (String[])
    config.getEntry(TxnManager.MAHALO,
        "initialLookupGroups", String[].class,
        new String[] { "" }); //default to public group
            if(initlogger.isLoggable(Level.CONFIG)) {
          initlogger.log(Level.CONFIG, "Obtaining initial groups: {0}",
    (groups==null?
        Arrays.asList(new String[] {"<ALL_GROUPS>"}):
        Arrays.asList(groups)));
      }
      locators = (LookupLocator[])
    Config.getNonNullEntry(config, TxnManager.MAHALO,
         "initialLookupLocators", LookupLocator[].class,
                     new LookupLocator[0]);
            if(initlogger.isLoggable(Level.CONFIG)) {
          initlogger.log(Level.CONFIG, "Obtaining initial locators: {0}",
    Arrays.asList(locators));
      }
      final Entry[] cAttrs = (Entry[])
    Config.getNonNullEntry(config, TxnManager.MAHALO,
        "initialLookupAttributes", Entry[].class, new Entry[0]);
            if(initlogger.isLoggable(Level.CONFIG)) {
          initlogger.log(Level.CONFIG, "Obtaining initial attributes: {0}",
    Arrays.asList(cAttrs));
      }
      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);
      }
            if(initlogger.isLoggable(Level.FINEST)) {
          initlogger.log(Level.FINEST, "Combined attributes: {0}",
    Arrays.asList(attributes));
      }

        } else {
            /* recovery : if there are any locators get and
             * use recoveredLookupLocatorPreparer
             */
            if(initlogger.isLoggable(Level.FINEST)) {
          initlogger.log(Level.FINEST, "Recovered locators: {0}",
    Arrays.asList(locators));
      }
            if (locators.length > 0) {
                final ProxyPreparer recoveredLookupLocatorPreparer =
                    (ProxyPreparer)Config.getNonNullEntry(config,
                        TxnManager.MAHALO,
                        "recoveredLookupLocatorPreparer", ProxyPreparer.class,
                         defaultPreparer);
                if(initlogger.isLoggable(Level.CONFIG)) {
              initlogger.log(Level.CONFIG, "recoveredLookupLocatorPreparer: {0}",
        recoveredLookupLocatorPreparer);
                }
    final List prepared = new java.util.LinkedList();
                for (int i=0; i<locators.length; i++) {
                    try {
                        prepared.add(recoveredLookupLocatorPreparer.
                                     prepareProxy(locators[i]));
                    } catch (Throwable t) {
                        if(initlogger.isLoggable(Levels.HANDLED)) {
                      initlogger.log(Levels.HANDLED,
          "Exception re-preparing LookupLocator: {0}. "
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

        Boolean.FALSE)).booleanValue();
     
      return (java.rmi.activation.ActivationGroup) doAction(
    new PrivilegedExceptionAction() {
        public Object run() throws Exception {
      ProxyPreparer sysPreparer =
          getPreparer(config, "systemPreparer");
      monPreparer = getPreparer(config,
              "monitorPreparer");
      TcpServerEndpoint se =
          TcpServerEndpoint.getInstance(0);
      Exporter defaultExporter =
          new BasicJeriExporter(se, new AccessILFactory());
      exporter = (Exporter) config.getEntry(
        PHOENIX, "instantiatorExporter",
        Exporter.class, defaultExporter);
      if (exporter == null) {
          exporter = new AlreadyExportedExporter();
      }
      refuseCalls =
          !(exporter instanceof AlreadyExportedExporter);
      unexportTimeout = getInt(config, "unexportTimeout",
             60000);
      unexportWait = getInt(config, "unexportWait", 10);
      ActivationSystem sys = (ActivationSystem)
          sysPreparer.prepareProxy(id.getSystem());
      ActivationGroupImpl.incarnation = incarnation;
      groupID = id;
      state = CREATING;
      ActivationGroupID gid = (sys == id.getSystem() ?
             id : new WrappedGID(id, sys));
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.