Package org.exoplatform.container.xml

Examples of org.exoplatform.container.xml.PropertiesParam


      if (params == null)
      {
         throw new ConfigurationException("Initializations parameters expected");
      }

      PropertiesParam prop = params.getPropertiesParam(DB_CONNECTION);

      if (prop != null)
      {
         if (prop.getProperty(DB_DRIVER) == null)
         {
            throw new ConfigurationException("driverClassName expected in db-connection properties section");
         }

         serverUrl = prop.getProperty(DB_URL);
         if (serverUrl == null)
         {
            throw new ConfigurationException("url expected in db-connection properties section");
         }

         if (prop.getProperty(DB_USERNAME) == null)
         {
            throw new ConfigurationException("username expected in db-connection properties section");
         }

         if (prop.getProperty(DB_PASSWORD) == null)
         {
            throw new ConfigurationException("password expected in db-connection properties section");
         }

         // Store all connection properties into single map         
         Iterator<Property> pit = prop.getPropertyIterator();
         connectionProperties = new HashMap<String, String>();
         while (pit.hasNext())
         {
            Property p = pit.next();
            if (!p.getName().equalsIgnoreCase(DB_URL))
            {
               connectionProperties.put(p.getName(), p.getValue());
            }
         }
      }
      else
      {
         throw new ConfigurationException("db-connection properties expected in initializations parameters");
      }

      prop = params.getPropertiesParam(DB_CREATION);
      if (prop != null)
      {
         String scriptPath = prop.getProperty(DB_SCRIPT_PATH);
         if (scriptPath != null)
         {
            try
            {
               dbScript = readScriptResource(scriptPath);
            }
            catch (IOException e)
            {
               throw new ConfigurationException("Can't read script resource " + scriptPath, e);
            }
         }
         else
         {
            throw new ConfigurationException("scriptPath expected in db-creation properties section");
         }

         this.dbUserName = prop.getProperty(DB_USERNAME);
         if (dbUserName == null)
         {
            throw new ConfigurationException("username expected in db-creation properties section");
         }

         this.dbPassword = prop.getProperty(DB_PASSWORD);
         if (dbPassword == null)
         {
            throw new ConfigurationException("password expected in db-creation properties section");
         }
      }
View Full Code Here


    *
    * @throws RepositoryConfigurationException
    */
   private void readParamsFromFile()
   {
      PropertiesParam pps = initParams.getPropertiesParam(BACKUP_PROPERTIES);

      backupDir = pps.getProperty(BACKUP_DIR);
      defIncrPeriod = pps.getProperty(DEFAULT_INCREMENTAL_JOB_PERIOD);
      fullBackupType = pps.getProperty(FULL_BACKUP_TYPE);
      incrementalBackupType = pps.getProperty(INCREMENTAL_BACKUP_TYPE);

      log.info("Backup dir from configuration file: " + backupDir);
      log.info("Default incremental job period from configuration file: " + defIncrPeriod);
      log.info("Full backup type from configuration file: " + fullBackupType);
      log.info("Incremental backup type from configuration file: " + incrementalBackupType);
View Full Code Here

    *
    * @throws RepositoryConfigurationException
    */
   private void readParamsFromFile()
   {
      PropertiesParam pps = initParams.getPropertiesParam("replication-properties");

      // initialize replication params;
      testMode = pps.getProperty("test-mode");
      enabled = pps.getProperty("enabled");
      mode = pps.getProperty("mode");
      bindIPAddress = pps.getProperty("bind-ip-address");
      channelConfig = pps.getProperty("channel-config");
      channelName = pps.getProperty("channel-name");
      recDir = pps.getProperty("recovery-dir");
      ownName = pps.getProperty("node-name");
      participantsCluster = pps.getProperty("other-participants");
      sWaitConfirmation = pps.getProperty("wait-confirmation");

      // initialize repositories
      ValuesParam vp = initParams.getValuesParam("repositories");
      repoNamesList = vp.getValues();
      if (vp == null || vp.getValues().size() == 0)
         throw new RuntimeException("repositories not specified");

      // initialize snapshot params;
      PropertiesParam backuParams = initParams.getPropertiesParam("replication-snapshot-properties");

      if (backuParams != null)
      {
         sBackupEnabled = backuParams.getProperty("snapshot-enabled");
         sBackupDir = backuParams.getProperty("snapshot-dir");
         sDelayTime = backuParams.getProperty("delay-time");
      }
      else
      {
         backupEnabled = false;
      }

      // initialize priority params;
      PropertiesParam priorityParams = initParams.getPropertiesParam("replication-priority-properties");

      if (priorityParams != null)
      {
         priprityType = priorityParams.getProperty("priority-type");
         ownValue = priorityParams.getProperty("node-priority");
      }

      log.info("Params is read from configuration file");

      checkParams();
View Full Code Here

   public RegistryInitializationEntryPlugin(InitParams initParams)
   {

      if (initParams != null)
      {
         PropertiesParam properties = initParams.getPropertiesParam("locations");
         if (properties != null)
            location = properties.getProperty("group-path");
      }
      if (initParams != null)
      {
         Iterator<ValueParam> iterator = initParams.getValueParamIterator();
         while (iterator.hasNext())
View Full Code Here

    *
    * @throws RepositoryConfigurationException
    */
   private void readParamsFromFile()
   {
      PropertiesParam pps = initParams.getPropertiesParam(BACKUP_PROPERTIES);

      backupDir = pps.getProperty(BACKUP_DIR);
      defIncrPeriod = pps.getProperty(DEFAULT_INCREMENTAL_JOB_PERIOD);
      fullBackupType = pps.getProperty(FULL_BACKUP_TYPE);
      incrementalBackupType = pps.getProperty(INCREMENTAL_BACKUP_TYPE);

      log.info("Backup dir from configuration file: " + backupDir);
      log.info("Default incremental job period from configuration file: " + defIncrPeriod);
      log.info("Full backup type from configuration file: " + fullBackupType);
      log.info("Incremental backup type from configuration file: " + incrementalBackupType);
View Full Code Here

    *
    * @throws RepositoryConfigurationException
    */
   private void readParamsFromFile()
   {
      PropertiesParam pps = initParams.getPropertiesParam("replication-properties");

      // initialize replication params;
      testMode = pps.getProperty("test-mode");
      enabled = pps.getProperty("enabled");
      mode = pps.getProperty("mode");
      bindIPAddress = pps.getProperty("bind-ip-address");
      channelConfig = pps.getProperty("channel-config");
      channelName = pps.getProperty("channel-name");
      recDir = pps.getProperty("recovery-dir");
      ownName = pps.getProperty("node-name");
      participantsCluster = pps.getProperty("other-participants");
      sWaitConfirmation = pps.getProperty("wait-confirmation");

      // initialize repositories
      ValuesParam vp = initParams.getValuesParam("repositories");
      repoNamesList = vp.getValues();
      if (vp == null || vp.getValues().size() == 0)
         throw new RuntimeException("repositories not specified");

      // initialize snapshot params;
      PropertiesParam backuParams = initParams.getPropertiesParam("replication-snapshot-properties");

      if (backuParams != null)
      {
         sBackupEnabled = backuParams.getProperty("snapshot-enabled");
         sBackupDir = backuParams.getProperty("snapshot-dir");
         sDelayTime = backuParams.getProperty("delay-time");
      }
      else
      {
         backupEnabled = false;
      }

      // initialize priority params;
      PropertiesParam priorityParams = initParams.getPropertiesParam("replication-priority-properties");

      if (priorityParams != null)
      {
         priprityType = priorityParams.getProperty("priority-type");
         ownValue = priorityParams.getProperty("node-priority");
      }

      log.info("Params is read from configuration file");

      checkParams();
View Full Code Here

      if (params == null)
      {
         throw new ConfigurationException("Initializations parameters expected");
      }

      PropertiesParam prop = params.getPropertiesParam(DB_CONNECTION);

      if (prop != null)
      {
         if (prop.getProperty(DB_DRIVER) == null)
         {
            throw new ConfigurationException("driverClassName expected in db-connection properties section");
         }

         serverUrl = prop.getProperty(DB_URL);
         if (serverUrl == null)
         {
            throw new ConfigurationException("url expected in db-connection properties section");
         }

         if (prop.getProperty(DB_USERNAME) == null)
         {
            throw new ConfigurationException("username expected in db-connection properties section");
         }

         if (prop.getProperty(DB_PASSWORD) == null)
         {
            throw new ConfigurationException("password expected in db-connection properties section");
         }

         // Store all connection properties into single map         
         Iterator<Property> pit = prop.getPropertyIterator();
         connectionProperties = new HashMap<String, String>();
         while (pit.hasNext())
         {
            Property p = pit.next();
            if (!p.getName().equalsIgnoreCase(DB_URL))
            {
               connectionProperties.put(p.getName(), p.getValue());
            }
         }
      }
      else
      {
         throw new ConfigurationException("db-connection properties expected in initializations parameters");
      }

      prop = params.getPropertiesParam(DB_CREATION);
      if (prop != null)
      {
         String scriptPath = prop.getProperty(DB_SCRIPT_PATH);
         if (scriptPath != null)
         {
            String dbScript;
            try
            {
               dbScript = readScriptResource(configurationManager.getInputStream(scriptPath));
            }
            catch (Exception e)
            {
               try
               {
                  dbScript = readScriptResource(PrivilegedFileHelper.fileInputStream(scriptPath));
               }
               catch (IOException ioe)
               {
                  throw new ConfigurationException("Can't read script resource " + scriptPath, e);
               }
            }
            this.dbScript = dbScript;
         }
         else
         {
            throw new ConfigurationException("scriptPath expected in db-creation properties section");
         }

         this.dbUserName = prop.getProperty(DB_USERNAME);
         if (dbUserName == null)
         {
            throw new ConfigurationException("username expected in db-creation properties section");
         }

         this.dbPassword = prop.getProperty(DB_PASSWORD);
         if (dbPassword == null)
         {
            throw new ConfigurationException("password expected in db-creation properties section");
         }
      }
View Full Code Here

    */
   public InitialContextInitializer(InitParams params) throws NamingException, ConfigurationException
   {
      for (Iterator propsParams = params.getPropertiesParamIterator(); propsParams.hasNext();)
      {
         PropertiesParam propParam = (PropertiesParam)propsParams.next();
         boolean isDefault = propParam.getName().equals(PROPERTIES_DEFAULT);
         boolean isMandatory = propParam.getName().equals(PROPERTIES_MANDATORY);
         for (Iterator props = propParam.getPropertyIterator(); props.hasNext();)
         {
            Property prop = (Property)props.next();
            String propName = prop.getName();
            String propValue = prop.getValue();
            String existedProp = System.getProperty(propName);
            if (isMandatory)
            {
               setSystemProperty(propName, propValue, propParam.getName());
            }
            else if (isDefault)
            {
               if (existedProp == null)
               {
                  setSystemProperty(propName, propValue, propParam.getName());
               }
               else
               {
                  log.info("Using default system property: " + propName + " = " + existedProp);
               }
View Full Code Here

      Set<URL> repos = new HashSet<URL>();
      Iterator<PropertiesParam> iterator = params.getPropertiesParamIterator();
      while (iterator.hasNext())
      {
         PropertiesParam p = iterator.next();
         String repository = p.getProperty("repository");
         String workspace = p.getProperty("workspace");
         String path = p.getProperty("path");
         try
         {
            repos.add(new UnifiedNodeReference(repository, workspace, path).getURL());
         }
         catch (MalformedURLException e)
View Full Code Here

    *
    * @throws RepositoryConfigurationException
    */
   private void readParamsFromFile()
   {
      PropertiesParam pps = initParams.getPropertiesParam(BACKUP_PROPERTIES);

      backupDir = pps.getProperty(BACKUP_DIR);
      defIncrPeriod = pps.getProperty(DEFAULT_INCREMENTAL_JOB_PERIOD);
      fullBackupType = pps.getProperty(FULL_BACKUP_TYPE);
      incrementalBackupType = pps.getProperty(INCREMENTAL_BACKUP_TYPE);

      log.info("Backup dir from configuration file: " + backupDir);
      log.info("Default incremental job period from configuration file: " + defIncrPeriod);
      log.info("Full backup type from configuration file: " + fullBackupType);
      log.info("Incremental backup type from configuration file: " + incrementalBackupType);
View Full Code Here

TOP

Related Classes of org.exoplatform.container.xml.PropertiesParam

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.