Package com.sun.sgs.impl.sharedutil

Examples of com.sun.sgs.impl.sharedutil.PropertiesWrapper


  super(systemRegistry, txnProxy,
        new LoggerWrapper(Logger.getLogger(CLASSNAME)),
        new LoggerWrapper(Logger.getLogger(CLASSNAME + ".abort")));
  logger.log(Level.CONFIG, "Creating DataStoreClient properties:{0}",
       properties);
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        NodeType nodeType =
                wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
                                             NodeType.class,
                                             NodeType.singleNode);
        boolean serverStart = nodeType != NodeType.appNode;
        if (serverStart) {
            // we default to localHost;  this is useful for starting
            // single node systems
            String localHost = InetAddress.getLocalHost().getHostName();
            serverHost = wrappedProps.getProperty(
                SERVER_HOST_PROPERTY,
                wrappedProps.getProperty(
                    StandardProperties.SERVER_HOST, localHost));
        } else {
            // a server host most be specified
            serverHost = wrappedProps.getProperty(
                SERVER_HOST_PROPERTY,
                wrappedProps.getProperty(
                    StandardProperties.SERVER_HOST));
            if (serverHost == null) {
                throw new IllegalArgumentException(
                                           "A server host must be specified");
            }
        }
  int specifiedServerPort = wrappedProps.getIntProperty(
      SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, serverStart ? 0 : 1,
      65535);
  maxTxnTimeout = wrappedProps.getLongProperty(
      MAX_TXN_TIMEOUT_PROPERTY, DEFAULT_MAX_TXN_TIMEOUT, 1,
      Long.MAX_VALUE);
  if (serverStart) {
      try {
    localServer = new DataStoreServerImpl(
View Full Code Here


    {
        super(properties, systemRegistry, txnProxy,
              new LoggerWrapper(Logger.getLogger(PKG_NAME)));
        logger.log(Level.CONFIG, "Creating NodeMappingServiceImpl");
       
        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
       
  try {
            watchdogService = txnProxy.getService(WatchdogService.class);
           
            contextFactory = new ContextFactory(txnProxy);
               
            /*
       * Check service version.
       */
      transactionScheduler.runTask(
    new AbstractKernelRunnable("CheckServiceVersion") {
        public void run() {
      checkServiceVersion(
          NodeMapUtil.VERSION_KEY,
                            NodeMapUtil.MAJOR_VERSION,
                            NodeMapUtil.MINOR_VERSION);
        } },  taskOwner);
                   
            // Find or create our server.  
            String localHost =
                    InetAddress.getLocalHost().getHostName();
            NodeType nodeType =
                wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
                                             NodeType.class,
                                             NodeType.singleNode);
            boolean instantiateServer = nodeType != NodeType.appNode;
           
            String host;
            int port;
           
            if (instantiateServer) {
                serverImpl =
                    new NodeMappingServerImpl(properties,
                                              systemRegistry, txnProxy);
                // Use the port actually used by our server instance
                host = localHost;
                port = serverImpl.getPort();
            } else {
                serverImpl = null;
                host =
                    wrappedProps.getProperty(
      SERVER_HOST_PROPERTY,
      wrappedProps.getProperty(
          StandardProperties.SERVER_HOST));
                if (host == null) {
                    throw new IllegalArgumentException(
                                           "A server host must be specified");
                }
                port = wrappedProps.getIntProperty(
                        NodeMappingServerImpl.SERVER_PORT_PROPERTY,
                        NodeMappingServerImpl.DEFAULT_SERVER_PORT, 0, 65535);  
            }         
         
            // TODO This code assumes that the server has already been started.
            // Perhaps it'd be better to block until the server is available?
            Registry registry = LocateRegistry.getRegistry(host, port);
            server = (NodeMappingServer) registry.lookup(
                         NodeMappingServerImpl.SERVER_EXPORT_NAME);     
           
            // Export our client object for server callbacks.
            int clientPort = wrappedProps.getIntProperty(
                                        CLIENT_PORT_PROPERTY,
                                        DEFAULT_CLIENT_PORT, 0, 65535);
            changeNotifierImpl = new MapChangeNotifier();
            exporter = new Exporter<NotifyClient>(NotifyClient.class);
            clientPort = exporter.export(changeNotifierImpl, clientPort);
View Full Code Here

        // filter the properties with appropriate defaults
        filterProperties(appProperties);
       
        // check the standard properties
        checkProperties(appProperties);
        this.wrappedProperties = new PropertiesWrapper(appProperties);

        shutdownTimeout = wrappedProperties.getIntProperty(SHUTDOWN_TIMEOUT_PEOPERTY,
                                                           DEFAULT_SHUTDOWN_TIMEOUT);
        try {
            // See if we're doing any profiling.
View Full Code Here

                // test to see if this name if the listener is already bound...
                dataService.getServiceBinding(StandardProperties.APP_LISTENER);
            } catch (NameNotBoundException nnbe) {
                // ...if it's not, create and then bind the listener
                AppListener listener =
                    (new PropertiesWrapper(properties)).
                    getClassInstanceProperty(StandardProperties.APP_LISTENER,
                                             AppListener.class, new Class[] {});
                if (listener instanceof ManagedObject) {
                    dataService.setServiceBinding(
                            StandardProperties.APP_LISTENER, listener);
View Full Code Here

  super(systemRegistry, txnProxy,
        new LoggerWrapper(Logger.getLogger(CLASSNAME)),
        new LoggerWrapper(Logger.getLogger(CLASSNAME + ".abort")));
        logger.log(Level.CONFIG, "Creating DataStoreImpl");

  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
  String specifiedDirectory =
      wrappedProps.getProperty(DIRECTORY_PROPERTY);
  if (specifiedDirectory == null) {
      String rootDir =
    properties.getProperty(StandardProperties.APP_ROOT);
      if (rootDir == null) {
    throw new IllegalArgumentException(
        "A value for the property " + StandardProperties.APP_ROOT +
        " must be specified");
      }
      specifiedDirectory = rootDir + File.separator + DEFAULT_DIRECTORY;
  }
  /*
   * Use an absolute path to avoid problems on Windows.
   * -tjb@sun.com (02/16/2007)
   */
  directory = new File(specifiedDirectory).getAbsolutePath();
  txnInfoTable = getTxnInfoTable(TxnInfo.class);
  DbTransaction dbTxn = null;
  boolean done = false;
  Throwable exception;
  try {
      File directoryFile = new File(specifiedDirectory).getAbsoluteFile();
            if (!directoryFile.exists()) {
                logger.log(Level.INFO, "Creating database directory : " +
                           directoryFile.getAbsolutePath());
                if (!directoryFile.mkdirs()) {
                    throw new DataStoreException("Unable to create database " +
                                                 "directory : " +
                                                 directoryFile.getName());
                }
      }
            env = wrappedProps.getClassInstanceProperty(
                    ENVIRONMENT_CLASS_PROPERTY,
                    DEFAULT_ENVIRONMENT_CLASS,
                    DbEnvironment.class,
                    new Class<?>[]{
                        String.class, Properties.class,
View Full Code Here

        nodeId = dataService.getLocalNodeId();
        localHandoffSpace = DS_HANDOFF_SPACE + nodeId;
        watchdogService.addRecoveryListener(this);

        // get the start delay and the length of time between hand-off checks
        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        handoffStart = wrappedProps.getLongProperty(HANDOFF_START_PROPERTY,
                                                    HANDOFF_START_DEFAULT);
        if (handoffStart < 0) {
            throw new IllegalStateException("Handoff Start property must " +
                                            "be non-negative");
        }
        handoffPeriod = wrappedProps.getLongProperty(HANDOFF_PERIOD_PROPERTY,
                                                     HANDOFF_PERIOD_DEFAULT);
        if (handoffPeriod < 0) {
            throw new IllegalStateException("Handoff Period property must " +
                                            "be non-negative");
        }

        // get the continue policy
        continuePolicy = wrappedProps.getClassInstanceProperty(
                CONTINUE_POLICY_PROPERTY,
                CONTINUE_POLICY_DEFAULT,
                ContinuePolicy.class, new Class[]{Properties.class,
                                                  ComponentRegistry.class,
                                                  TransactionProxy.class},
                properties, systemRegistry, txnProxy);

        // create our profiling info and register our MBean
        ProfileCollector collector =
            systemRegistry.getComponent(ProfileCollector.class);
        serviceStats = new TaskServiceStats(collector);
        try {
            collector.registerMBean(serviceStats, TaskServiceStats.MXBEAN_NAME);
        } catch (JMException e) {
            logger.logThrow(Level.CONFIG, e, "Could not register MBean");
        }

        // finally, create a timer for delaying the status votes and get
        // the delay used in submitting status votes
        statusUpdateTimer = new Timer("TaskServiceImpl Status Vote Timer");
        voteDelay = wrappedProps.getLongProperty(VOTE_DELAY_PROPERTY,
                                                 VOTE_DELAY_DEFAULT);
        if (voteDelay < 0) {
            throw new IllegalStateException("Vote Delay property must " +
                                            "be non-negative");
        }
View Full Code Here

  throws Exception
    {
  super(properties, systemRegistry, txnProxy, logger);
        logger.log(Level.CONFIG, "Creating SimpleSgsProtocolAcceptor");

  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
  try {
            readBufferSize = wrappedProps.getIntProperty(
                READ_BUFFER_SIZE_PROPERTY, DEFAULT_READ_BUFFER_SIZE,
                MIN_READ_BUFFER_SIZE, Integer.MAX_VALUE);
      disconnectDelay = wrappedProps.getLongProperty(
    DISCONNECT_DELAY_PROPERTY, DEFAULT_DISCONNECT_DELAY,
    MIN_DISCONNECT_DELAY, Long.MAX_VALUE);
      identityManager =
    systemRegistry.getComponent(IdentityCoordinator.class);
              
            transport =
                wrappedProps.getClassInstanceProperty(
        TRANSPORT_PROPERTY, DEFAULT_TRANSPORT, Transport.class,
        new Class[] {Properties.class}, properties);

      protocolVersion =
    wrappedProps.getIntProperty(
    PROTOCOL_VERSION_PROPERTY, DEFAULT_PROTOCOL_VERSION,
    PROTOCOL4, SimpleSgsProtocol.VERSION);

            if (!transport.getDelivery().equals(Delivery.RELIABLE)) {
                transport.shutdown();
View Full Code Here

    private PropertiesWrapper wrapper;

    @Before
    public void setUp() {
  props = new Properties();
  wrapper = new PropertiesWrapper(props);
    }
View Full Code Here

        }
  if (accessCoordinator == null) {
      throw new NullPointerException("AccessCoordinator cannot be null");
        }

        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);

        this.transactionCoordinator = transactionCoordinator;
        this.profileCollectorHandle = profileCollectorHandle;
        this.accessCoordinator = accessCoordinator;
       
        this.backingQueue = wrappedProps.getClassInstanceProperty(
                SCHEDULER_QUEUE_PROPERTY, DEFAULT_SCHEDULER_QUEUE,
                SchedulerQueue.class, new Class[]{Properties.class},
                properties);
        this.retryPolicy = wrappedProps.getClassInstanceProperty(
                SCHEDULER_RETRY_PROPERTY, DEFAULT_SCHEDULER_RETRY,
                SchedulerRetryPolicy.class, new Class[]{Properties.class},
                properties);

        // startup the requested number of consumer threads
View Full Code Here

        // filter the properties with appropriate defaults
        filterProperties(appProperties);
       
        // check the standard properties
        checkProperties(appProperties);
        this.wrappedProperties = new PropertiesWrapper(appProperties);

        try {
            // See if we're doing any profiling.
            String level = wrappedProperties.getProperty(PROFILE_LEVEL_PROPERTY,
                    ProfileLevel.MIN.name());
View Full Code Here

TOP

Related Classes of com.sun.sgs.impl.sharedutil.PropertiesWrapper

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.