Package net.jini.config

Examples of net.jini.config.Configuration


    {
       if (operationsLogger.isLoggable(Level.FINER)) {
      operationsLogger.entering(mailboxSourceClass,
          "init", (Object[])configArgs);
       }
       final Configuration config =
            ConfigurationProvider.getInstance(
          configArgs, getClass().getClassLoader());
        loginContext = (LoginContext) config.getEntry(
            MERCURY, "loginContext", LoginContext.class, null);
        if (loginContext != null) {
            doInitWithLogin(config, loginContext);
        } else {
            doInit(config);
View Full Code Here


     @param configFileName The configuration file.
     */
    private void getConfiguration(String configFileName) {
        System.out.println("Opening configuration file: " + configFileName);

        Configuration configuration = null;

        // We have to get a configuration file or we can't continue
        try {
            configuration = ConfigurationProvider
                    .getInstance(new String[] { configFileName });
        } catch (ConfigurationException e) {
            System.err.println(e.toString());
            KernelException.stackTraceToString(e);
        }

        // The config file must have an exporter, a service and a codebase
        try {
            System.out.print("Reading exporter: ");
            exporter = (Exporter) configuration.getEntry(SERVER, "exporter",
                    Exporter.class);
            System.out.println(exporter);
            System.out.print("Reading service: ");
            service = (Remote) configuration.getEntry(SERVER, "service",
                    Remote.class);
            System.out.println(service);
            System.out.print("Reading codebase: ");
            codebase = (String) configuration.getEntry(SERVER, "codebase",
                    String.class);
            System.out.println(codebase);
        } catch (NoSuchEntryException e) {
            System.err.println("No config entry for " + e);
        } catch (Exception e) {
            System.err.println(e.toString());
            KernelException.stackTraceToString(e);
        }

        // These fields can fallback to a default value
        try {
            System.out.println("Reading unicastLocators: ");
            unicastLocators = (LookupLocator[]) configuration.getEntry(SERVER,
                    "unicastLocators", LookupLocator[].class, null); // default

            for (int i = 0; i < unicastLocators.length; i++) {
                System.out.println("    " + unicastLocators[i]);
            }

            System.out.println("Reading entries: ");
            entries = (Entry[]) configuration.getEntry(SERVER, "entries",
                    Entry[].class, null); // default

            for (int i = 0; i < entries.length; i++) {
                System.out.println("    " + entries[i]);
            }

            System.out.print("Reading serviceIdFile: ");
            serviceIdFile = (File) configuration.getEntry(SERVER,
                    "serviceIdFile", File.class, null); // default
            System.out.println(serviceIdFile);
            System.out.println("Reading groups: ");
            groups = (String[]) configuration.getEntry(SERVER, "groups",
                    String[].class, null); // default

            if (groups.length != 0) {
                for (int i = 0; i < groups.length; i++) {
                    System.out.println("    " + groups[i]);
View Full Code Here

        if (VERBOSE) {
            System.out.println("Opening configuration file: " + configFileName);
            System.out.println("Entry: " + CLIENT);
        }

        Configuration configuration = null;

        // We have to get a configuration file or we can't continue
        try {
            configuration = ConfigurationProvider
                    .getInstance(new String[] { configFileName });
        } catch (ConfigurationException e) {
            KernelException.stackTraceToString(e);
        }

        // The config file must have an exporter, a service and a codebase
        try {
            if (VERBOSE) {
                System.out.print("Reading service: " + CLIENT);
            }

            service = (Remote) configuration.getEntry(CLIENT, "service",
                    Remote.class);

            if (VERBOSE) {
                System.out.println(service);
            }
        } catch (NoSuchEntryException e) {
            System.err.println("No config entry for " + e);
        } catch (Exception e) {
            KernelException.stackTraceToString(e);
        }

        // These fields can fallback to a default value
        try {
            if (VERBOSE) {
                System.out.println("Reading unicastLocators: ");
            }

            unicastLocators = (LookupLocator[]) configuration.getEntry(CLIENT,
                    "unicastLocators", LookupLocator[].class, null); // default

            if (VERBOSE) {
                for (int i = 0; i < unicastLocators.length; i++) {
                    System.out.println("    " + unicastLocators[i]);
                }

                System.out.println("Reading entries: ");
            }

            entries = (Entry[]) configuration.getEntry(CLIENT, "entries",
                    Entry[].class, null); // default

            if (VERBOSE) {
                for (int i = 0; i < entries.length; i++) {
                    System.out.println("    " + entries[i]);
                }

                System.out.println("Reading groups: ");
            }

            groups = (String[]) configuration.getEntry(CLIENT, "groups",
                    String[].class, null); // default

            if (groups.length != 0) {
                if (VERBOSE) {
                    for (int i = 0; i < groups.length; i++) {
View Full Code Here

  this.lifeCycle = lifeCycle;
  this.activationID = activationID;
  this.serverGate = wrapper;

  try {
      final Configuration config =
    ConfigurationProvider.getInstance(configArgs,
              getClass().getClassLoader());

      loginContext = (LoginContext) config.getEntry(
    COMPONENT_NAME, "loginContext", LoginContext.class, null);
      if (loginContext == null) {
    init(config, persistent);
      } else {
    loginContext.login();
View Full Code Here

    {
  if (activationID != null && !persistent) {
      throw new IllegalArgumentException();
  }
  try {
      final Configuration config = ConfigurationProvider.getInstance(
    configArgs, getClass().getClassLoader());
      loginContext = (LoginContext) config.getEntry(
         COMPONENT, "loginContext", LoginContext.class, null);

      PrivilegedExceptionAction init = new PrivilegedExceptionAction() {
    public Object run() throws Exception {
        init(config, activationID, persistent, lifeCycle);
View Full Code Here

     * from <code>args</code>.
     */
     static class GetDescriptors implements SubVMTask {

  public Object run(String[] args) {
      Configuration starterConfig = null;
      try {
    starterConfig = ConfigurationProvider.getInstance(args);
      } catch (ConfigurationException e) {
    return e;
      }
      try {
    ServiceDescriptor[] d1 =  (ServiceDescriptor[])
        starterConfig.getEntry("com.sun.jini.start",
             "serviceDescriptors",
             ServiceDescriptor[].class,
             new ServiceDescriptor[0]);
    ServiceDescriptor[] d2 =  (ServiceDescriptor[])
        starterConfig.getEntry("com.sun.jini.start",
             "serviceDestructors",
             ServiceDescriptor[].class,
             new ServiceDescriptor[0]);
    ServiceDescriptor[] descriptors =
        new ServiceDescriptor[d1.length + d2.length];
View Full Code Here

        listen.unexport();
        if (lc != null)
      lc.unregister(Browser.this);
    }
      });
  final Configuration config =
      ConfigurationProvider.getInstance(
            args, Browser.class.getClassLoader());
  LoginContext login =
      (LoginContext) config.getEntry(BROWSER, "loginContext",
             LoginContext.class, null);
  if (login == null) {
      init(exiter, config);
  } else {
      login.login();
View Full Code Here

     */
    public static void main (String[] args) {
  if (System.getSecurityManager() == null)
      System.setSecurityManager(new SecurityManager());
  try {
      final Configuration config =
    ConfigurationProvider.getInstance(
          args, Browser.class.getClassLoader());
      LoginContext login =
    (LoginContext) config.getEntry(BROWSER, "loginContext",
                 LoginContext.class, null);
      if (login != null) {
    login.login();
      }
      PrivilegedExceptionAction action =
View Full Code Here

    {
        if (operationsLogger.isLoggable(Level.FINER)) {
            operationsLogger.entering(TxnManagerImpl.class.getName(), "init",
          (Object[])configArgs );
  }
        final Configuration config =
            ConfigurationProvider.getInstance(
    configArgs, getClass().getClassLoader());
        loginContext = (LoginContext) config.getEntry(
            TxnManager.MAHALO, "loginContext", LoginContext.class, null);
        if (loginContext != null) {
            doInitWithLogin(config, loginContext);
        } else {
            doInit(config);
View Full Code Here

    {
       if (operationsLogger.isLoggable(Level.FINER)) {
      operationsLogger.entering(mailboxSourceClass,
          "init", (Object[])configArgs);
       }
       final Configuration config =
            ConfigurationProvider.getInstance(
          configArgs, getClass().getClassLoader());
        loginContext = (LoginContext) config.getEntry(
            MERCURY, "loginContext", LoginContext.class, null);
        if (loginContext != null) {
            doInitWithLogin(config, loginContext);
        } else {
            doInit(config);
View Full Code Here

TOP

Related Classes of net.jini.config.Configuration

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.