Package net.jini.security

Examples of net.jini.security.BasicProxyPreparer


              listener,
              mHandback,
              leaseDuration)
      logger.log(Level.FINEST, "Preparing fiddler registration");
      Configuration c = config.getConfiguration();
      ProxyPreparer p = new BasicProxyPreparer();
      if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
      p = (ProxyPreparer) c.getEntry("test",
                 "fiddlerRegistrationPreparer",
                 ProxyPreparer.class);
      }
      registrationMap.put(p.prepareProxy(ldsReg),listener);
  } catch (ConfigurationException e) {
      throw new RemoteException("Configuration Error", e);
  }
    }//end doRegistration
View Full Code Here


        {
            super();
            this.regInfo = regInfo;
      Configuration c = getConfig().getConfiguration();
      Exporter exporter = QAConfig.getDefaultExporter();
      registrarPreparer = new BasicProxyPreparer();
      if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
    try {
        exporter = (Exporter) c.getEntry("test",
                 "fiddlerListenerExporter",
                 Exporter.class);
View Full Code Here

        // Get activatable settings, if activated
        if (activationID != null) {
            ProxyPreparer activationSystemPreparer =
                (ProxyPreparer) Config.getNonNullEntry(config,
                    TxnManager.MAHALO, "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.CONFIG)) {
    initLogger.log(Level.CONFIG, "Prepared activation system is: {0}",
                    activationSystem);
            }
            ProxyPreparer activationIdPreparer =
                (ProxyPreparer) Config.getNonNullEntry(config,
                    TxnManager.MAHALO, "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.CONFIG)) {
    initLogger.log(Level.CONFIG, "Prepared activationID is: {0}",
                    activationID);
            }
      activationPrepared = true;
            exporter = (Exporter)Config.getNonNullEntry(config,
          TxnManager.MAHALO, "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 {
            exporter = (Exporter) Config.getNonNullEntry(config,
                TxnManager.MAHALO, "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);
            }
  }
 
  ProxyPreparer recoveredParticipantPreparer =
      (ProxyPreparer)Config.getNonNullEntry(config,
                TxnManager.MAHALO, "recoveredParticipantPreparer",
    ProxyPreparer.class, new BasicProxyPreparer());
        if(initLogger.isLoggable(Level.CONFIG)) {
      initLogger.log(Level.CONFIG, "Recovered participant preparer is: {0}",
                recoveredParticipantPreparer);
        }
  participantPreparer = (ProxyPreparer)Config.getNonNullEntry(config,
            TxnManager.MAHALO, "participantPreparer", ProxyPreparer.class,
            new BasicProxyPreparer());
        if(initLogger.isLoggable(Level.CONFIG)) {
      initLogger.log(Level.CONFIG, "Participant preparer is: {0}",
                participantPreparer);
        }
  // Create lease policy -- used by recovery logic, below??
View Full Code Here

        listenerPreparer = (ProxyPreparer)Config.getNonNullEntry
                                                   (config,
                                                    COMPONENT_NAME,
                                                    "listenerPreparer",
                                                    ProxyPreparer.class,
                                                    new BasicProxyPreparer());
        /* Get the proxy preparers for the lookup locators to join */
        locatorToJoinPreparer = (ProxyPreparer)Config.getNonNullEntry
                                                   (config,
                                                    COMPONENT_NAME,
                                                    "locatorToJoinPreparer",
                                                    ProxyPreparer.class,
                                                    new BasicProxyPreparer());
        /* Get the proxy preparers for the lookup locators to discover */
        locatorToDiscoverPreparer = (ProxyPreparer)Config.getNonNullEntry
                                                 (config,
                                                  COMPONENT_NAME,
                                                  "locatorToDiscoverPreparer",
                                                  ProxyPreparer.class,
                                                  new BasicProxyPreparer());
        if(persistent) {
            /* Retrieve the proxy preparers that will only be applied during
             * the state recovery process below, when any previously stored
             * listeners or locators are recovered from persistent storage.
             */
            recoveredListenerPreparer =
             (ProxyPreparer)Config.getNonNullEntry(config,
                                                   COMPONENT_NAME,
                                                   "recoveredListenerPreparer",
                                                   ProxyPreparer.class,
                                                   new BasicProxyPreparer());
            recoveredLocatorToJoinPreparer =
             (ProxyPreparer)Config.getNonNullEntry
                                             (config,
                                              COMPONENT_NAME,
                                              "recoveredLocatorToJoinPreparer",
                                              ProxyPreparer.class,
                                              new BasicProxyPreparer());
            recoveredLocatorToDiscoverPreparer =
             (ProxyPreparer)Config.getNonNullEntry
                                         (config,
                                          COMPONENT_NAME,
                                          "recoveredLocatorToDiscoverPreparer",
                                          ProxyPreparer.class,
                                          new BasicProxyPreparer());


            /* Get the log directory for persisting this service's state */
            persistDir = (String)Config.getNonNullEntry(config,
                                                        COMPONENT_NAME,
                                                        "persistenceDirectory",
                                                        String.class);
            /* Recover the state that was persisted on prior runs (if any) */
            log = new ReliableLog(persistDir, new LocalLogHandler());
            inRecovery = true;
            log.recover();
            inRecovery = false;
        }//endif(persistent)

        /* For the two persistent versions of this service (activatable and
         * non-activatable), state recovery is complete. For the non-persistent
         * version of this service, no state recovery occurred (because it
         * wasn't necessary).
         *
         * For the two persistent versions, there is a circumstance in which
         * 'one time', initial items must be retrieved from the configuration:
         * when the service is started for the very first time. For the
         * non-persistent version, those items will be retrieved every time
         * the service is started.
         *
         * The flag 'initialStartup' is used below to determine whether
         * or not to retrieve the initial configuration items. This is the
         * only purpose for that flag.
         *
         * For either persistent version of the service, the flag's value
         * will be changed to false during the startup process only when
         * there already exists a 'snapshot' of the service's state from
         * a previous run. This is because the flag's value is only
         * changed during the recovery of the snapshot (see the method
         * recoverSnapshot()). Note that the only time such a snapshot
         * should NOT already exist at startup, is when the service is
         * being started for the very first time. Thus, when either
         * persistent version of the service is started for the first
         * time, the service's configuration is consulted for the initial
         * values of the items below; otherwise, when the service is being
         * re-started (after a crash for example), the values used for
         * those items will be the values retrieved above during recovery
         * of the service's persistent state.
         *
         * With respect to the non-persistent version of the service, the
         * values of the items below will always be retrieved at startup.
         * This is because the non-persistent version of the service never
         * attempts to recover previously stored state; thus, the flag's
         * value will never change. Note that this will be true even if a
         * snapshot exists from a previous run of one of the persistent
         * versions of the service.
         *
         * The service's Uuid is also handled here.
         */
        if(initialStartup) {
            if(log != null) {
                snapshotWt = ((Float)config.getEntry
                                         (COMPONENT_NAME,
                                          "initialPersistenceSnapshotWeight",
                                          float.class,
                                          new Float(snapshotWt))).floatValue();
                snapshotThresh =
                       Config.getIntEntry
                                  (config,
                                   COMPONENT_NAME,
                                   "initialPersistenceSnapshotThreshold",
                                   snapshotThresh, 0, Integer.MAX_VALUE);
            }//endif(log != null)
            leaseBound = Config.getLongEntry(config,
                                             COMPONENT_NAME,
                                             "initialLeaseBound",
                                             leaseBound, 0, Long.MAX_VALUE);
            /* Get any additional attributes with which to associate this
             * service when registering it with any lookup services.
             */
            Entry[] initAttrs = (Entry[])config.getEntry
                                                   (COMPONENT_NAME,
                                                    "initialLookupAttributes",
                                                    Entry[].class,
                                                    null );
            if(initAttrs != null) {
                ArrayList attrsList
                   = new ArrayList(thisServicesAttrs.length+initAttrs.length);
                for(int i=0;i<thisServicesAttrs.length;i++) {
                    attrsList.add(thisServicesAttrs[i]);
                }//end loop
                for(int i=0;i<initAttrs.length;i++) {
                    attrsList.add(initAttrs[i]);
                }//end loop
                thisServicesAttrs = (Entry[])attrsList.toArray
                                                (new Entry[attrsList.size()]);
            }//endif(initAttrs != null)

            /* Get the initial groups this service should join. */
            thisServicesGroups =
                 (String[])config.getEntry(COMPONENT_NAME,
                                           "initialLookupGroups",
                                           String[].class,
                                           thisServicesGroups);
            /* Get the initial locators this service should join. */
            thisServicesLocators =
                     (LookupLocator[])config.getEntry(COMPONENT_NAME,
                                                      "initialLookupLocators",
                                                      LookupLocator[].class,
                                                      new LookupLocator[0]);
            if(thisServicesLocators == null) {
                thisServicesLocators = new LookupLocator[0];
            }//endif

            /* Generate the private, universally unique (over space and time)
             * ID that will be used by the outer proxy to test for equality
             * with other proxies.
             */
            proxyID = UuidFactory.generate();
        }//endif(initialStartup)

        /* The proxyID should never be null at this point. It should have
         * been either recovered from the persisted state, or generated above.
         */
        if(proxyID == null) throw new NullPointerException("proxyID == null");

        /* Get the various configurable constants */
        leaseMax = Config.getLongEntry(config,
                                       COMPONENT_NAME,
                                       "leaseMax",
                                       leaseMax, 0, Long.MAX_VALUE);
        /* Take a snapshot of the current state to "clean up" the log file,
         * and to record the items set above.
         */
  if(log != null) log.snapshot();
        /* The service ID used to register this service with lookup services
         * is always derived from the proxyID that is associated with the
         * service for the lifetime of the service.
         */
        serviceID = new ServiceID(proxyID.getMostSignificantBits(),
                                  proxyID.getLeastSignificantBits());
        /* Get a general-purpose task manager for this service */
        taskMgr = (TaskManager)Config.getNonNullEntry
                                          (config,
                                           COMPONENT_NAME,
                                           "taskManager",
                                           TaskManager.class,
                                           new TaskManager(10,1000*15,1.0f) );
        /* Get the discovery manager to pass to this service's join manager. */
        try {
            joinMgrLDM  =
                (DiscoveryManagement)Config.getNonNullEntry
                                                  (config,
                                                   COMPONENT_NAME,
                                                   "discoveryManager",
                                                   DiscoveryManagement.class);
            if( joinMgrLDM instanceof DiscoveryGroupManagement ) {
                String[] groups0 =
                           ((DiscoveryGroupManagement)joinMgrLDM).getGroups();
                if(    (groups0 == DiscoveryGroupManagement.ALL_GROUPS)
                    || (groups0.length != 0) )
                {
                    throw new ConfigurationException
                                 ("discoveryManager entry must be configured "
                                  +"to initially discover/join NO_GROUPS");
                }//endif
            } else {// !(joinMgrLDM instanceof DiscoveryGroupManagement)
                throw new ConfigurationException
                                       ("discoveryManager entry must "
                                        +"implement DiscoveryGroupManagement");
            }//endif
            if( joinMgrLDM instanceof DiscoveryLocatorManagement ) {
                LookupLocator[] locs0 =
                        ((DiscoveryLocatorManagement)joinMgrLDM).getLocators();
                if( (locs0 != null) && (locs0.length != 0) ) {
                    throw new ConfigurationException
                                 ("discoveryManager entry must be configured "
                                  +"to initially discover/join no locators");
                }//endif
            } else {// !(joinMgrLDM instanceof DiscoveryLocatorManagement)
                throw new ConfigurationException
                                     ("discoveryManager entry must "
                                      +"implement DiscoveryLocatorManagement");
            }//endif
        } catch (NoSuchEntryException e) {
            joinMgrLDM
               = new LookupDiscoveryManager(DiscoveryGroupManagement.NO_GROUPS,
                                            new LookupLocator[0], null,config);
        }

        /* Handle items and duties related to exporting this service. */
        ServerEndpoint endpoint = TcpServerEndpoint.getInstance(0);
        InvocationLayerFactory ilFactory = new BasicILFactory();
        Exporter defaultExporter = new BasicJeriExporter(endpoint,
                                                         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,
View Full Code Here

        // 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)) {
                initLogger.log(Level.CONFIG, "Persistence directory is: {0}",
          persistenceDirectory);
     
      // Note: referenced by recovery logic in rebuildTransientState() 
            recoveredListenerPreparer =
          (ProxyPreparer) Config.getNonNullEntry(
          config, MERCURY, "recoveredListenerPreparer", ProxyPreparer.class,
                new BasicProxyPreparer());
            if (initLogger.isLoggable(Level.CONFIG)) {
                initLogger.log(Level.CONFIG, "Recovered listener preparer is: {0}",
          recoveredListenerPreparer)
      }
      // Note: referenced by recovery logic, below 
            recoveredLocatorToJoinPreparer = (ProxyPreparer)Config.getNonNullEntry
                 (config, MERCURY, "recoveredLocatorToJoinPreparer",
                  ProxyPreparer.class, new BasicProxyPreparer());
            if (initLogger.isLoggable(Level.CONFIG)) {
                initLogger.log(Level.CONFIG, "Recovered locator preparer is: {0}",
          recoveredLocatorToJoinPreparer);
     

View Full Code Here

    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

        /* Lookup service proxy preparer */
        registrarPreparer = (ProxyPreparer)config.getEntry
                                                    (COMPONENT_NAME,
                                                     "registrarPreparer",
                                                     ProxyPreparer.class,
                                                     new BasicProxyPreparer());
  /* constraints */
  MethodConstraints constraints = (MethodConstraints)config.getEntry
                (COMPONENT_NAME,
                 "discoveryConstraints",
                 MethodConstraints.class,
View Full Code Here

  /* 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(
View Full Code Here

        /* Proxy preparers */
        registrarPreparer = (ProxyPreparer)thisConfig.getEntry
                                                    (COMPONENT_NAME,
                                                     "registrarPreparer",
                                                     ProxyPreparer.class,
                                                     new BasicProxyPreparer());
        eventLeasePreparer = (ProxyPreparer)thisConfig.getEntry
                                                   (COMPONENT_NAME,
                                                    "eventLeasePreparer",
                                                    ProxyPreparer.class,
                                                    new BasicProxyPreparer());
        /* Lease renewal manager */
        leaseRenewalMgr = leaseMgr;
  if(leaseRenewalMgr == null) {
            try {
                leaseRenewalMgr
View Full Code Here

        if (servicePreparer == null) {
            servicePreparer =
            (ProxyPreparer) Config.getNonNullEntry(config,
                ServiceStarter.START_PACKAGE,
                "servicePreparer", ProxyPreparer.class,
                new BasicProxyPreparer());
        }
           
        /* Warn user of inaccessible codebase(s) */
        HTTPDStatus.httpdWarning(getExportCodebase());

View Full Code Here

TOP

Related Classes of net.jini.security.BasicProxyPreparer

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.