Package java.util

Examples of java.util.Properties


  public DefaultSettings(Properties prop) {
    mProperties = prop;
  }
 
  public DefaultSettings() {
    mProperties = new Properties();
    File settingsFile = new File(FILENAME);
    if (settingsFile.canRead() && !TVBrowser.isTransportable()) {
      StreamUtilities.inputStreamIgnoringExceptions(settingsFile,
          new InputStreamProcessor() {
View Full Code Here


    this.dir = dir;

    try {
      Class.forName(driver).newInstance();
//       conn = DriverManager.getConnection(connurl + new File(dir, "JoramDB").getPath() + ";shutdown=true;server.no_system_exit=true", "sa", "");
      Properties props = new Properties();
      /*
      props.put("user", "user1");
      props.put("password", "user1");
      */
      props.put("user", user);
      props.put("password", pass);

      /*
      conn = DriverManager.getConnection(connurl + new File(dir, "JoramDB").getPath() + ";create=true", props);
      */
      // conn = DriverManager.getConnection(connurl, props); // MySQL (the database must exist and start seperately)
View Full Code Here

  static void loadConnectionProperties() {
    if (p != null) {
      return;
    }
      Properties props = new Properties();
      FileInputStream fis = null;
      try {
        fis = new FileInputStream("connection.properties"); //$NON-NLS-1$
        props.load(fis);
      } catch (IOException e) {
        log.log(Level.WARNING, "Could not load default connection properties.", e); //$NON-NLS-1$
      } finally {
        if (fis != null) {
          try {
View Full Code Here

    this.metadataRepository = metadataRepository;
  }

  private MetadataStore getODBCMetadataStore() {
    try {
      PgCatalogMetadataStore pg = new PgCatalogMetadataStore(CoreConstants.ODBC_MODEL, getBuiltinDatatypes(), new Properties());
      return  pg.getMetadataStore();
    } catch (TranslatorException e) {
      LogManager.logError(LogConstants.CTX_DQP, RuntimePlugin.Util.getString("failed_to_load_odbc_metadata")); //$NON-NLS-1$
    }
    return null;
View Full Code Here

   
    public void testNillableNode() {
        MappingDocument doc = FakeXMLMetadata.docWithExcluded();
        MappingElement root = (MappingElement)doc.getRootNode();
       
        Properties names = root.getNamespacesAsProperties();
        assertFalse(names.containsKey("xsi"));//$NON-NLS-1$
       
        HandleNillableVisitor.execute(doc);
       
        names = root.getNamespacesAsProperties();
        assertTrue(names.containsKey("xsi"));//$NON-NLS-1$
    }
View Full Code Here

     */
    void loadNode( MappingNode node ) throws XMLStreamException {
      writer.writeStartElement(ELEM_NODE);

        //namespace declarations have to be handled specially
        Properties namespaces = (Properties)node.getProperty(MappingNodeConstants.Properties.NAMESPACE_DECLARATIONS);
        if (namespaces != null){
            addNamespaceDeclarations(namespaces);
        }

        // Only get the property values actually stored in the MappingNode, not
View Full Code Here

    buildTranslatorProperties(attachmentClass, props);
    return props;
  }

  public static Properties getTranslatorPropertiesAsProperties(Class<?> attachmentClass) {
    Properties props = new Properties();
    try {
      Object instance = attachmentClass.newInstance();
      Map<Method, TranslatorProperty> tps = TranslatorUtil.getTranslatorProperties(attachmentClass);
      for (Method m:tps.keySet()) {
        Object defaultValue = ManagedPropertyUtil.getDefaultValue(instance, m, tps.get(m));
        if (defaultValue != null) {
          props.setProperty(getPropertyName(m), defaultValue.toString());
        }
      }
    } catch (InstantiationException e) {
      // ignore
    } catch (IllegalAccessException e) {
View Full Code Here

        if (translatorName == null) {
          throw new DeploymentException(RuntimePlugin.Util.getString("name_not_found", unit.getName())); //$NON-NLS-1$
        }
       
        // fill with default properties for the tooling to see the properties
        Properties props = TranslatorUtil.getTranslatorPropertiesAsProperties(data.getExecutionFactoryClass());
        data.setProperties(props);
        data.addProperty(TranslatorMetaData.EXECUTION_FACTORY_CLASS, data.getExecutionFactoryClass().getName());
       
              this.translatorRepository.addTranslatorMetadata(translatorName, data);
              LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("translator_added", translatorName)); //$NON-NLS-1$
View Full Code Here

    this.odbcProxy.terminate();
    return message;
  }

  private Object buildInitialize(NullTerminatedStringDataInputStream data) throws IOException{
        Properties props = new Properties();
      
        int version = data.readInt();
        props.setProperty("version", Integer.toString(version));
       
        // SSL Request
        if (version == 80877103) {
          this.initialized = false;
          this.odbcProxy.sslRequest();
          return message;
        }
       
        trace("StartupMessage version", version, "(", (version >> 16), ".", (version & 0xff), ")");
       
        while (true) {
            String param =  data.readString();
            if (param.length() == 0) {
                break;
            }
            String value =  data.readString();
            props.setProperty(param, value);
        }       
        this.user = props.getProperty("user");
        this.databaseName = props.getProperty("database");
        String clientEncoding = props.getProperty("client_encoding", "UTF-8");
        props.setProperty("client_encoding", clientEncoding);
        props.setProperty("default_transaction_isolation", "read committed");
        props.setProperty("DateStyle", "ISO");
        props.setProperty("TimeZone", Calendar.getInstance().getTimeZone().getDisplayName());
        Charset cs = PGCharsetConverter.getCharset(clientEncoding);
        if (cs != null) {
          this.encoding = cs;
        }
        this.odbcProxy.initialize(props);
View Full Code Here

  @Help.Doc(text = "Get a Teiid connection")
  public static TeiidSql connect(
      @Help.Doc(text = "url") String url,
      @Help.Doc(text = "user") String user,
      @Help.Doc(text = "password") String password) throws SQLException {
    Properties info = new Properties();
    if (user != null) {
      info.setProperty(TeiidURL.CONNECTION.USER_NAME, user);
    }
    if (password != null) {
      info.setProperty(TeiidURL.CONNECTION.PASSWORD, password);
    }
    Connection c = TeiidDriver.getInstance().connect(url, info);
    if (c == null) {
      throw new SQLException("Invalid url " + url);
    }
View Full Code Here

TOP

Related Classes of java.util.Properties

Copyright © 2015 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.