Package primarydatamanager.mirrorupdater

Examples of primarydatamanager.mirrorupdater.UpdateException


        }
        nested = nested.getCause();
      }

      // There is no FileNotFoundException -> This is a real error
      throw new UpdateException("Checking file existence failed: "
        + mBaseUrl + fileName, exc);
    }
    finally {
      if (in != null) {
        try { in.close(); } catch (IOException exc) {}
View Full Code Here


      byte[] data = IOUtilities.loadFileFromHttpServer(new URL(mBaseUrl + fileName), 60000);
      mBytesRead += data.length;
      return data;
    }
    catch (IOException exc) {
      throw new UpdateException("Loading file failed: " + mBaseUrl + fileName, exc);
    }
  }
View Full Code Here

    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

  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

      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

Related Classes of primarydatamanager.mirrorupdater.UpdateException

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.