Examples of UpdateException


Examples of primarydatamanager.mirrorupdater.UpdateException

    try {
      stream = new FileInputStream(propertiesFileName);
      prop.load(stream);
    }
    catch (IOException exc) {
      throw new UpdateException("Loading properties file failed: "
        + propertiesFileName, exc);
    }
    finally {
      if (stream != null) {
        try { stream.close(); } catch (IOException exc) {}
      }
    }
   
    // Init the data source
    try {
      String type = getProperty(prop, "dataSource.type", "http");
      if (type.equals("http")) {
        String url = getProperty(prop, "dataSource.url", getPrimaryServerUrl());
        mDataSource = new HttpDataSource(url);
      } else if (type.equals("file")) {
        String dir = getProperty(prop, "dataSource.dir");
        mDataSource = new FileDataSource(new File(dir));
      } else {
        throw new UpdateException("dataSource.type must be either 'http' or 'file'");
      }
    }
    catch (Exception exc) {
      throw new UpdateException("Error initializing data source from "
        + "properties file: " + propertiesFileName, exc);
    }
   
    // Init the data target
    try {
      String type = getProperty(prop, "dataTarget.type", "ftp");
      if (type.equals("ftp")) {
        String url = getProperty(prop, "dataTarget.url");
        String path = getProperty(prop, "dataTarget.path", "tvdata");
        int port = getIntProperty(prop, "dataTarget.port", 21);
        String user = getProperty(prop, "dataTarget.user");
        String password = getProperty(prop, "dataTarget.password");
        mDataTarget = new FtpDataTarget(url, path, port, user, password);
      } else if (type.equals("file")) {
        String dir = getProperty(prop, "dataTarget.dir");
        mDataTarget = new FileDataTarget(new File(dir));
      } else {
        throw new UpdateException("dataTarget.type must be either 'ftp' or 'file'");
      }
    }
    catch (Exception exc) {
      throw new UpdateException("Error initializing data target from "
        + "properties file: " + propertiesFileName, exc);
    }
   
     // Get the channel groups
    
View Full Code Here

Examples of primarydatamanager.mirrorupdater.UpdateException

  private String getProperty(Properties prop, String key)
    throws UpdateException
  {
    String value = prop.getProperty(key);
    if (value == null) {
      throw new UpdateException("Property '" + key + "' not set");
    } else {
      return value;
    }
  }
View Full Code Here

Examples of primarydatamanager.mirrorupdater.UpdateException

      value = value.trim();
      try {
        return Integer.parseInt(value);
      }
      catch (Exception exc) {
        throw new UpdateException("Property '" + key + "' must be a number: '"
          + value + "'", exc);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.