Package java.util

Examples of java.util.Properties


      service.loadSettings(new Properties());
    }
  }

  private void storeServiceSettings(TvDataServiceProxy service) {
    final Properties prop = service.storeSettings();
    if (prop!=null) {
      String dir=Settings.getUserSettingsDirName();
      File f=new File(dir);
      if (!f.exists()) {
        f.mkdir();
      }
      f=new File(dir,service.getId()+".service");
      try {
        StreamUtilities.outputStream(f, new OutputStreamProcessor() {
          public void process(OutputStream outputStream) throws IOException {
            prop.store(outputStream, "settings");
          }
        });
      } catch (IOException exc) {
        String msg = mLocalizer.msg("error.4", "Saving settings for plugin {0} failed!\n({1})",
            service.getInfo().getName(), f.getAbsolutePath(), exc);
View Full Code Here


        ProtocolStack stack=ch.getProtocolStack();
        Protocol discovery=stack.removeProtocol("TCPPING");
        if(discovery != null){
            Protocol transport = stack.getTransport();
            MPING mping=new MPING();
            InetAddress bindAddress=Util.getBindAddress(new Properties());
            mping.setBindAddr(bindAddress);
            mping.setMulticastAddress("230.1.2.3");
            mping.setMcastPort(8888);           
            stack.insertProtocol(mping, ProtocolStack.ABOVE, transport.getName());
            mping.setProtocolStack(ch.getProtocolStack());
View Full Code Here

    }
  }

  private static Session initMailSession(){
        //Checks the pool and delivers a mail message
        Properties props = new Properties();
        //Not needed for production environment
        props.put("mail.debug", "false");
        //Prevents problems encountered with 250 OK Messages
        props.put("mail.smtp.ehlo", "false");
        //Sets timeout on going connections
        props.put("mail.smtp.timeout", smtpTimeout + "");

        props.put("mail.smtp.connectiontimeout", connectionTimeout + "");
        props.put("mail.smtp.sendpartial",String.valueOf(sendPartial));

        return Session.getInstance(props, null);
  }
View Full Code Here

        long period = getLong(FileMonitoringTimerTask.MONITORING_CONFIG_PERIOD_PROPERTY,
                              FileMonitoringTimerTask.DEFAULT_MONITORING_CONFIG_PERIOD).longValue();
        String results = getProperty(FileMonitoringTimerTask.MONITORING_RESULT_PATH_PROPERTY,
                                     FileMonitoringTimerTask.DEFAULT_MONITORING_RESULT_PATH);
       
        Properties monitoringProps = new Properties();
        monitoringProps.load(new FileInputStream(file));
       
        fileMonitoringTimerTask = new FileMonitoringTimerTask(getTimer(), period, monitoringProps, results);
        if (fileMonitoringTimerTask != null) {
          try {
            MXWrapper.registerMBean(fileMonitoringTimerTask,
                                    "AgentServer", "server=" + getName() + ",cons=FileMonitoring");
          } catch (Exception exc) {
            if (logmon == null)
              logmon = Debug.getLogger(AgentServer.class.getName());
            logmon.log(BasicLevel.ERROR, getName() + " jmx failed", exc);
          }
        }
      }
    } catch (Exception exc) {
      logmon.log(BasicLevel.WARN, getName() + "Cannot read monitoring configuration file: " + config, exc);
    }
   
    config = getProperty(LogMonitoringTimerTask.MONITORING_CONFIG_PATH_PROPERTY,
                         LogMonitoringTimerTask.DEFAULT_MONITORING_CONFIG_PATH);
    try {
      // if "logMonitoring.props" file exists configure a FileMonitoringTimerTask.
      File file = new File(config);
      if (file.exists()) {
        long period = getLong(LogMonitoringTimerTask.MONITORING_CONFIG_PERIOD_PROPERTY,
                              LogMonitoringTimerTask.DEFAULT_MONITORING_CONFIG_PERIOD).longValue();       
        String logname = getProperty(LogMonitoringTimerTask.MONITORING_RESULT_LOGGER_PROPERTY,
                                     LogMonitoringTimerTask.DEFAULT_MONITORING_RESULT_LOGGER);
        Logger logger = Debug.getLogger(logname);
        int loglevel = getInteger(LogMonitoringTimerTask.MONITORING_RESULT_LEVEL_PROPERTY,
                                  LogMonitoringTimerTask.DEFAULT_MONITORING_RESULT_LEVEL).intValue();
        String logmsg = getProperty(LogMonitoringTimerTask.MONITORING_RESULT_MESSAGE_PROPERTY,
                                    LogMonitoringTimerTask.DEFAULT_MONITORING_RESULT_MESSAGE);
       
        Properties monitoringProps = new Properties();
        monitoringProps.load(new FileInputStream(file));
       
        logMonitoringTimerTask = new LogMonitoringTimerTask(getTimer(), period, monitoringProps,
                                                            logger, logmsg, loglevel);

        if (logMonitoringTimerTask != null) {
View Full Code Here

     */
    private PersistenceManager createManagerFile(String filePath)
    {

            if(log.isInfoEnabled()) log.info("Creating file manager: " + filePath);
        Properties props;

        try
        {
            if (_manager == null)
            {
                props=readProps(filePath);
                String classname=props.getProperty(filePersistMgr);
                if(classname != null)
                {
                    Class cl=Util.loadClass(classname, this.getClass());
                    Constructor ctor=cl.getConstructor(new Class[]{String.class});
                    _manager=(PersistenceManager)ctor.newInstance(new Object[]{filePath});
View Full Code Here

     * @return boolean;
     * @exception Exception;
     */
    private boolean checkDB() throws Exception
    {
        Properties props=readProps(propPath);
        String persist = props.getProperty(persistProp);
        if ("DB".equals(persist))
            return true;
        return false;
    }
View Full Code Here

     * checks the provided properties for DB/File flag
     * @return boolean;
     */
    private boolean checkDB(String filePath) throws Exception
    {
        Properties props=readProps(filePath);
        String persist = props.getProperty(persistProp);
        if ("DB".equals(persist))
            return true;
        return false;
    }
View Full Code Here

    }


    Properties readProps(String fileName) throws IOException
    {
        Properties props;
        FileInputStream _stream = new FileInputStream(fileName);
        props=new Properties();
        props.load(_stream);
        return props;
    }
View Full Code Here

  private String connurl = "jdbc:derby:";

  protected void initDB() throws IOException {
    try {
      Class.forName(driver).newInstance();
      Properties props = new Properties();
      props.put("user", "user1");
      props.put("password", "user1");
      conn = DriverManager.getConnection(connurl + new File(dir, "JoramDB").getPath() + ";create=true", props);
    } catch (IllegalAccessException exc) {
      throw new IOException(exc.getMessage());
    } catch (ClassNotFoundException exc) {
      throw new IOException(exc.getMessage());
View Full Code Here

   * @param str The string that contains the list of key-value pairs
   * @param properties The properties where the key-value pairs should be added
   */
  public Properties toProperties( String str, Properties properties )
  {
    Properties props = ( properties == null ) ? new Properties() : properties ;
    return (Properties)this.toMap( str, null, null, props ) ;   
  } // toProperties()
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.