Package java.util

Examples of java.util.Properties


    }

    public static void setBeanProperties(Object bean, Properties props, String prefix) {
    // Move all prop names to lower case so we can use reflection to get
      // method names and look them up in the connection props.
      final Properties connProps = lowerCaseAllPropNames(props);
      final Method[] methods = bean.getClass().getMethods();
      for (int i = 0; i < methods.length; i++) {
          final Method method = methods[i];
          final String methodName = method.getName();
          // If setter ...
          if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
              // Get the property name
              final String propertyName = methodName.substring(3);    // remove the "set"
              String shortName = propertyName.toLowerCase();
              String propertyValue = null;
              if (prefix != null) {
                propertyValue = connProps.getProperty(prefix + "." + shortName); //$NON-NLS-1$
              } else {
                propertyValue = connProps.getProperty(shortName);
              }
              if (propertyValue == null) {
                continue;
              }
                final Class<?> argType = method.getParameterTypes()[0];
View Full Code Here


          }
      }
  }   

  private static Properties lowerCaseAllPropNames(final Properties connectionProps) {
      final Properties lcProps = new Properties();
      final Enumeration<?> itr = connectionProps.propertyNames();
      while ( itr.hasMoreElements() ) {
          final String name = (String) itr.nextElement();
          String propValue = connectionProps.getProperty(name);
          if (propValue != null) {
            lcProps.setProperty(name.toLowerCase(), propValue);
          }
      }
      return lcProps;
  }
View Full Code Here

     */
    StatementImpl(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
        this.driverConnection = driverConnection;
        this.resultSetType = resultSetType;
        this.resultSetConcurrency = resultSetConcurrency;
        this.execProps = new Properties(this.driverConnection.getExecutionProperties());
       
        // Set initial fetch size
        String fetchSizeStr = this.execProps.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
        if(fetchSizeStr != null) {
            try {
View Full Code Here

      if (conn == null) {
        return null;
      }
        if(info == null) {
          // create a properties obj if it is null
            info = new Properties();
        } else {
          //don't modify the original
            info = PropertiesUtils.clone(info);
        }
        parseURL(url, info);
View Full Code Here

        return DRIVER_NAME;
    }
   
    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
        if(info == null) {
            info = new Properties();
        } else {
          info = PropertiesUtils.clone(info);
        }

        // construct list of driverPropertyInfo objects
View Full Code Here

            JDBCURL jdbcURL = new JDBCURL(url);
            info.setProperty(BaseDataSource.VDB_NAME, jdbcURL.getVDBName());
            if (jdbcURL.getConnectionURL() != null) {
              info.setProperty(TeiidURL.CONNECTION.SERVER_URL, jdbcURL.getConnectionURL());
            }
            Properties optionalParams = jdbcURL.getProperties();
            JDBCURL.normalizeProperties(info);
            Enumeration keys = optionalParams.keys();
            while (keys.hasMoreElements()) {
                String propName = (String)keys.nextElement();
                // Don't let the URL properties override the passed-in Properties object.
                if (!info.containsKey(propName)) {
                    info.setProperty(propName, optionalParams.getProperty(propName));
                }
            }
            // add the property only if it is new because they could have
            // already been specified either through url or otherwise.
            if(!info.containsKey(BaseDataSource.VDB_VERSION) && jdbcURL.getVDBVersion() != null) {
View Full Code Here

 
  Connection conn;
 
  @Before public void setUp() throws Exception {
    Driver d = new Driver();
    Properties p = new Properties();
    p.setProperty("user", "testuser");
    p.setProperty("password", "testpassword");
    conn = d.connect("jdbc:postgresql://"+addr.getHostName()+":" +odbcTransport.getPort()+"/parts", p);
  }
View Full Code Here

    boolean isInLocalTxn() {
    return inLocalTxn;
  }
   
  private void setExecutionProperties(Properties info) {
    this.propInfo = new Properties();
       
        String overrideProp = info.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
        if ( overrideProp == null || overrideProp.trim().length() == 0 ) {
          propInfo.put(ExecutionProperties.PROP_TXN_AUTO_WRAP, ExecutionProperties.TXN_WRAP_DETECT);
        }
View Full Code Here

        assertThrows(ErrorCode.IO_EXCEPTION_2, this).
                getConnection("jdbc:h2:mem:;init=runscript from 'wrong.file'");
    }

    private void testConnectionInfo() throws Exception {
        Properties info = new Properties();
        ConnectionInfo connectionInfo = new ConnectionInfo(
                "jdbc:h2:mem:test" +
                        ";LOG=2" +
                        ";ACCESS_MODE_DATA=rws" +
                        ";INIT=CREATE this...\\;INSERT that..." +
View Full Code Here

  }
 
  Connection conn;
 
  @Before public void setUp() throws Exception {
    Properties p = new Properties();
    p.setProperty("user", "testuser");
    p.setProperty("password", "testpassword");
    conn = TeiidDriver.getInstance().connect("jdbc:teiid:parts@mm://"+addr.getHostName()+":" +jdbcTransport.getPort(), p);
  }
View Full Code Here

TOP

Related Classes of java.util.Properties

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.