Package net.jini.config

Examples of net.jini.config.ConfigurationException


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


                String[] groups =
                    ((DiscoveryGroupManagement)lookupDiscMgr).getGroups();
                if( (groups == DiscoveryGroupManagement.ALL_GROUPS) ||
                    (groups.length != 0) )
                {
                    throw new ConfigurationException(
                        "discoveryManager entry must be configured " +
            " with no groups.");
                }//endif
      } else {
               throw new ConfigurationException(
                    "discoveryManager entry must implement " +
                    "DiscoveryGroupManagement");
            }
     
            if(lookupDiscMgr instanceof DiscoveryLocatorManagement) {
                LookupLocator[] locs =
                        ((DiscoveryLocatorManagement)lookupDiscMgr).getLocators();
                if( (locs != null) && (locs.length != 0) ) {
                    throw new ConfigurationException(
                        "discoveryManager entry must be configured " +
            "with no locators");
                }//endif
      } else {
                throw new ConfigurationException(
                    "discoveryManager entry must implement " +
                    "DiscoveryLocatorManagement");
           
     
      ((DiscoveryGroupManagement)lookupDiscMgr).setGroups(lookupGroups);
View Full Code Here

      recoverTxns();
  } else if (activationID != null || persistent) {
      /* else we don't have a store, if we need one complain
       * will be logged by constructor
       */
      throw new ConfigurationException("Must provide for a " +
          "store for component " + COMPONENT_NAME + ", by providing " +
    "valid values for the store or " +
          PERSISTENCE_DIR_CONFIG_ENTRY + " entries if creating " +
    " a persistent space");
  }
View Full Code Here

    lookupLocators);
      memberGroups = (String[]) config.getEntry(
    COMPONENT, "initialMemberGroups", String[].class,
    memberGroups);
      if (memberGroups == null) {
    throw new ConfigurationException(
        "member groups cannot be ALL_GROUPS (null)");
      }
      memberGroups = (String[]) removeDups(memberGroups);
      unicastPort = Config.getIntEntry(
    config, COMPONENT, "initialUnicastDiscoveryPort",
    unicastPort, 0, 0xFFFF);

      if (initialLookupAttributes != null &&
    initialLookupAttributes.length > 0)
      {
    List l = new ArrayList(Arrays.asList(baseAttrs));
    l.addAll(Arrays.asList(initialLookupAttributes));
    lookupAttrs = (Entry[]) l.toArray(new Entry[l.size()]);
      } else {
    lookupAttrs = baseAttrs;
      }
  }

  /* fetch remaining config entries */
  MethodConstraints discoveryConstraints =
      (MethodConstraints) config.getEntry(COMPONENT,
            "discoveryConstraints",
            MethodConstraints.class, null);
  if (discoveryConstraints == null) {
      discoveryConstraints =
    new BasicMethodConstraints(InvocationConstraints.EMPTY);
  }
  try {
      discoer = (DiscoveryManagement) config.getEntry(
    COMPONENT, "discoveryManager", DiscoveryManagement.class);
  } catch (NoSuchEntryException e) {
      discoer = new LookupDiscoveryManager(
    DiscoveryGroupManagement.NO_GROUPS, null, null, config);
  }
  listenerPreparer = (ProxyPreparer) Config.getNonNullEntry(
      config, COMPONENT, "listenerPreparer", ProxyPreparer.class,
      listenerPreparer);
  locatorPreparer = (ProxyPreparer) Config.getNonNullEntry(
      config, COMPONENT, "locatorPreparer", ProxyPreparer.class,
      locatorPreparer);
  minMaxEventLease = Config.getLongEntry(
      config, COMPONENT, "minMaxEventLease",
      minMaxEventLease, 1, MAX_LEASE);
  minMaxServiceLease = Config.getLongEntry(
      config, COMPONENT, "minMaxServiceLease",
      minMaxServiceLease, 1, MAX_LEASE);
  minRenewalInterval = Config.getLongEntry(
      config, COMPONENT, "minRenewalInterval",
      minRenewalInterval, 0, MAX_RENEW);
  multicastAnnouncementInterval = Config.getLongEntry(
      config, COMPONENT, "multicastAnnouncementInterval",
      multicastAnnouncementInterval, 1, Long.MAX_VALUE);

  multicastInterfaceRetryInterval = Config.getIntEntry(
      config, COMPONENT, "multicastInterfaceRetryInterval",
      multicastInterfaceRetryInterval, 1, Integer.MAX_VALUE);
  try {
      multicastInterfaces = (NetworkInterface[]) config.getEntry(
    COMPONENT, "multicastInterfaces", NetworkInterface[].class);
      multicastInterfacesSpecified = true;
  } catch (NoSuchEntryException e) {
      Enumeration en = NetworkInterface.getNetworkInterfaces();
      List l = (en != null) ?
    Collections.list(en) : Collections.EMPTY_LIST;
      multicastInterfaces = (NetworkInterface[])
    l.toArray(new NetworkInterface[l.size()]);
      multicastInterfacesSpecified = false;
  }
  if (multicastInterfaces == null) {
      logger.config("using system default interface for multicast");
  } else if (multicastInterfaces.length == 0) {
      if (multicastInterfacesSpecified) {
    logger.config("multicast disabled");
      } else {
    logger.severe("no network interfaces detected");
      }
  } else if (logger.isLoggable(Level.CONFIG)) {
      logger.log(Level.CONFIG, "multicasting on interfaces {0}",
           new Object[]{ Arrays.asList(multicastInterfaces) });
  }

  try {
      multicastRequestSubjectChecker =
    (ClientSubjectChecker) Config.getNonNullEntry(
        config, COMPONENT, "multicastRequestSubjectChecker",
        ClientSubjectChecker.class);
  } catch (NoSuchEntryException e) {
      // leave null
  }
  resourceIdGenerator = (UuidGenerator) Config.getNonNullEntry(
      config, COMPONENT, "resourceIdGenerator", UuidGenerator.class,
      resourceIdGenerator);
  serviceIdGenerator = (UuidGenerator) Config.getNonNullEntry(
      config, COMPONENT, "serviceIdGenerator", UuidGenerator.class,
      serviceIdGenerator);
  tasker = (TaskManager) Config.getNonNullEntry(
      config, COMPONENT, "taskManager", TaskManager.class,
      new TaskManager(50, 1000 * 15, 1.0F));
  unexportTimeout = Config.getLongEntry(
         config, COMPONENT, "unexportTimeout", unexportTimeout,
         0, Long.MAX_VALUE);
  unexportWait = Config.getLongEntry(
         config, COMPONENT, "unexportWait", unexportWait,
         0, Long.MAX_VALUE);
  String unicastDiscoveryHost;
  try {
      unicastDiscoveryHost = (String) Config.getNonNullEntry(
    config, COMPONENT, "unicastDiscoveryHost", String.class);
  } catch (NoSuchEntryException e) {
      // fix for 4906732: only invoke getCanonicalHostName if needed
      unicastDiscoveryHost =
    InetAddress.getLocalHost().getCanonicalHostName();
  }
  try {
      unicastDiscoverySubjectChecker =
    (ClientSubjectChecker) Config.getNonNullEntry(
        config, COMPONENT, "unicastDiscoverySubjectChecker",
        ClientSubjectChecker.class);
  } catch (NoSuchEntryException e) {
      // leave null
  }

  /* initialize state based on recovered/configured values */
  objectServiceType = new ServiceType(Object.class, null, null);
  computeMaxLeases();
  protocol2 = Discovery.getProtocol2(null);
  /* cache unprocessed unicastDiscovery constraints to handle
           reprocessing of time constraints associated with that method */
  rawUnicastDiscoveryConstraints = discoveryConstraints.getConstraints(
         DiscoveryConstraints.unicastDiscoveryMethod);   
  multicastRequestConstraints = DiscoveryConstraints.process(
      discoveryConstraints.getConstraints(
    DiscoveryConstraints.multicastRequestMethod));
  multicastAnnouncementConstraints = DiscoveryConstraints.process(
      discoveryConstraints.getConstraints(
    DiscoveryConstraints.multicastAnnouncementMethod));
  unicastDiscoveryConstraints = DiscoveryConstraints.process(
      rawUnicastDiscoveryConstraints);
  serviceExpirer = new ServiceExpireThread();
  eventExpirer = new EventExpireThread();
  unicaster = new UnicastThread(unicastPort);
  multicaster = new MulticastThread();
  announcer = new AnnounceThread();
  snapshotter = new SnapshotThread();
  if (myServiceID == null) {
      myServiceID = newServiceID();
  }
  myRef = (Registrar) serverExporter.export(this);
  proxy = RegistrarProxy.getInstance(myRef, myServiceID);
  myLocator = (proxy instanceof RemoteMethodControl) ?
      new ConstrainableLookupLocator(
    unicastDiscoveryHost, unicaster.port, null) :
      new LookupLocator(unicastDiscoveryHost, unicaster.port);
  /* register myself */
  Item item = new Item(new ServiceItem(myServiceID,
               proxy,
               lookupAttrs));
  SvcReg reg = new SvcReg(item, myLeaseID, Long.MAX_VALUE);
  addService(reg);
  if (log != null) {
      log.snapshot();
  }

  try {
      DiscoveryGroupManagement dgm = (DiscoveryGroupManagement) discoer;
      String[] groups = dgm.getGroups();
      if (groups == null || groups.length > 0) {
    throw new ConfigurationException(
        "discoveryManager must be initially configured with " +
        "no groups");
      }
      DiscoveryLocatorManagement dlm =
    (DiscoveryLocatorManagement) discoer;
      if (dlm.getLocators().length > 0) {
    throw new ConfigurationException(
        "discoveryManager must be initially configured with " +
        "no locators");
      }
      dgm.setGroups(lookupGroups);
      dlm.setLocators(lookupLocators);
  } catch (ClassCastException e) {
      throw new ConfigurationException(null, e);
  }
  joiner = new JoinManager(proxy, lookupAttrs, myServiceID,
         discoer, null, config);

  /* start up all the daemon threads */
 
View Full Code Here

        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
   * the prepared activationID.
   */
  exporter = (Exporter) config.getEntry(
                START_PACKAGE, "exporter", Exporter.class,
    new ActivationExporter(
        activationID,
        new BasicJeriExporter(
      TcpServerEndpoint.getInstance(0),
      new BasicILFactory(), false, true)),
    activationID);
  if (exporter == null) {
             throw new ConfigurationException(START_PACKAGE
       + ".exporter entry should not be null");
        }
        logger.log(Level.FINE, START_PACKAGE + ".exporter: {0}",
            exporter);
 
View Full Code Here

            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");
  }
View Full Code Here

     */
    private static ConfigurationException throwNewConfigurationException(
            String msg)
  throws ConfigurationException
    {
  final ConfigurationException e = new ConfigurationException(msg);

  if (logger.isLoggable(Levels.FAILED)) {
      logger.log(Levels.FAILED, msg, e);
  }

View Full Code Here

                String[] groups =
                    ((DiscoveryGroupManagement)lookupDiscMgr).getGroups();
                if( (groups == DiscoveryGroupManagement.ALL_GROUPS) ||
                    (groups.length != 0) )
                {
                    throw new ConfigurationException(
                        "discoveryManager entry must be configured " +
            " with no groups.");
                }//endif
      } else {
               throw new ConfigurationException(
                    "discoveryManager entry must implement " +
                    "DiscoveryGroupManagement");
            }
     
            if(lookupDiscMgr instanceof DiscoveryLocatorManagement) {
                LookupLocator[] locs =
                        ((DiscoveryLocatorManagement)lookupDiscMgr).getLocators();
                if( (locs != null) && (locs.length != 0) ) {
                    throw new ConfigurationException(
                        "discoveryManager entry must be configured " +
            "with no locators");
                }//endif
      } else {
                throw new ConfigurationException(
                    "discoveryManager entry must implement " +
                    "DiscoveryLocatorManagement");
           
     
      ((DiscoveryGroupManagement)lookupDiscMgr).setGroups(lookupGroups);
View Full Code Here

                                      (COMPONENT_NAME,
                                       "maxLeaseDuration",
                                       long.class,
                                       new Long(renewalDuration))).longValue();
        if( (renewalDuration == 0) || (renewalDuration < Lease.ANY) ) {
            throw new ConfigurationException("invalid configuration entry: "
                                             +"renewalDuration ("
                                             +renewalDuration+") must be "
                                             +"positive or Lease.ANY");
        }//endif
  this.callback = callback;
View Full Code Here

      recoverTxns();
  } else if (activationID != null || persistent) {
      /* else we don't have a store, if we need one complain
       * will be logged by constructor
       */
      throw new ConfigurationException("Must provide for a " +
          "store for component " + COMPONENT_NAME + ", by providing " +
    "valid values for the store or " +
          PERSISTENCE_DIR_CONFIG_ENTRY + " entries if creating " +
    " a persistent space");
  }
View Full Code Here

TOP

Related Classes of net.jini.config.ConfigurationException

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.