Package java.util

Examples of java.util.Properties$ReaderParser


      url = new URL(propertiesName);
    }

    log.trace("Properties file=" + url); //$NON-NLS-1$

    Properties bundle = new Properties();
    InputStream is = null;
    try {
      is = ResourceActions.openStream(url);
    } catch (PrivilegedActionException e) {
      throw new IOException(e.getLocalizedMessage());
    }
    if (is != null) {
      bundle.load(is);
      is.close();
    } else {
      throw new IOException("Properties file " + propertiesName + " not available");//$NON-NLS-1$ //$NON-NLS-2$
    }
    log.debug("Loaded properties, users=" + bundle.keySet());//$NON-NLS-1$
    return bundle;
  }
View Full Code Here


        DataSourceInfo dataSourceInfo = null;

        if (canMap(resource)) {
            OracleDataSource source = (OracleDataSource) resource;
            OracleConnectionCacheManager occm = OracleConnectionCacheManager.getConnectionCacheManagerInstance();
            Properties cacheProperties = source.getConnectionCacheProperties();
            String cacheName = source.getConnectionCacheName();
            cacheName = cacheName != null && occm.existsCache(cacheName) ? cacheName : null;

            if (cacheProperties != null) {

                dataSourceInfo = new DataSourceInfo();
                if (cacheName != null) {
                    dataSourceInfo.setBusyConnections(occm.getNumberOfActiveConnections(cacheName));
                    dataSourceInfo.setEstablishedConnections(occm.getNumberOfAvailableConnections(cacheName) + dataSourceInfo.getBusyConnections());
                } else {
                    dataSourceInfo.setBusyConnections(0);
                    dataSourceInfo.setEstablishedConnections(0);
                }

                dataSourceInfo.setMaxConnections(Utils.toInt(cacheProperties.getProperty("MaxLimit"), -1));
                dataSourceInfo.setJdbcURL(source.getURL());
                dataSourceInfo.setUsername(source.getUser());
                dataSourceInfo.setResettable(true);
            }
        }
View Full Code Here

  }

  private void loadSettings() {

    try {
      Properties prop = mConfigurationHandler.loadSettings();
      loadSettings(prop);
    } catch (IOException e) {
      ErrorHandler.handle("Could not load reminder data.", e);
    }
View Full Code Here

    }
  }

  private void loadSettings(Properties settings) {
    if (settings == null) {
      settings = new Properties();
    }
    if (settings.getProperty("usemsgbox") == null) {
      settings.setProperty("usemsgbox", "true");
    }
    mSettings = settings;
View Full Code Here

     * @param props The properties to search.
     * @return the enumeration of all of the property names of the primary source;
     * the enumeration may be empty if there is an error connecting to the property sources.
     */
    public static Properties getProperties(String filterPattern, Properties props)  {
        Properties results = new Properties();

        boolean addAll = false;
        String searchStr = null;
        int globIndex = filterPattern.indexOf('*');
        if ( globIndex == -1 ) {
            searchStr = filterPattern;
        } else if ( globIndex == 0 ) {
            addAll = true;
        } else {
            searchStr = filterPattern.substring(0, globIndex);
        }

        Enumeration propNameEnum = props.propertyNames();
        while ( propNameEnum.hasMoreElements() ) {
            String name = (String) propNameEnum.nextElement();
            if ( name.startsWith(searchStr)) {
              Object value = props.get(name);
              if (value != null) {
                results.put(name.substring(searchStr.length()), value);
              }
            }
            else if (addAll) {
              results.put(name, props.get(name));
            }
        }

        return results;
    }
View Full Code Here

     * <code>UnmodifiableProperties</code>, this method returns an
     * <code>UnmodifiableProperties</code> instance around a new (flattened)
     * copy of the underlying Properties object.
     */
    public static Properties clone( Properties props, Properties defaults, boolean deepClone ) {
        Properties result = null;
        if ( defaults != null ) {
            if ( deepClone ) {
                defaults = clone(defaults);
            }
            result = new Properties(defaults);
        } else {
            result = new Properties();
        }
       
        putAll(result, props);
       
        return result;
View Full Code Here

    }
   
    public static Properties load(String fileName) throws IOException {
        InputStream is = null;
        try {
            Properties props = new Properties();
            is = new FileInputStream(fileName);
            props.load(is);
            return props;
        } finally {
            if (is != null) {
                is.close();
            }
View Full Code Here

            }
        }
    }
   
    public static Properties loadFromURL(URL url) throws MalformedURLException, IOException {
        Properties result = new Properties();
        InputStream is = null;
        try {
          is = url.openStream();
          result.load(is);
        } finally {
          if (is != null) {
            is.close();
          }
        }
View Full Code Here

        return result;
    }

    public static Properties loadAsResource(Class clazz, String resourceName) throws IOException {
        InputStream is = null;
        Properties configProps = new Properties();
        try {
            is = clazz.getResourceAsStream(resourceName);
            ArgCheck.isNotNull(is);
            if (is != null) {
                   configProps.load(is);
            }
        } finally {
            if (is != null) {
                try {
                    is.close();
View Full Code Here

            String name = (String) enumeration.nextElement();
            names.add(name);
        }
        Collections.sort(names);

        Properties newProps = new Properties();
        Iterator iter = names.iterator();
        while ( iter.hasNext() ) {
            String name = (String) iter.next();
            String propValue = props.getProperty(name);
            if ( propValue != null ) {
                newProps.setProperty(name, propValue);
            }
        }
        return newProps;
    }
View Full Code Here

TOP

Related Classes of java.util.Properties$ReaderParser

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.