Package org.hivedb

Examples of org.hivedb.HiveRuntimeException


    case Types.TIMESTAMP:
      return new Date(resultSet.getTime(index).getTime());
    case Types.VARCHAR:
      return resultSet.getString(index);
    }
    throw new HiveRuntimeException("No known JDBC type: " + jdbcType, null);
  }
View Full Code Here


  public static void initializeDriver(String uri) {
    //Tickle driver
    try {
      load(uri);
    } catch (ClassNotFoundException e) {
      throw new HiveRuntimeException("Unable to load database driver: " + e.getMessage(), e);
    }
  }
View Full Code Here

  /**
   * @see HiveDataSourceProvider#close()
   */
  public void close() {
    HiveRuntimeException exceptionWhileClosing = null;
    for (HiveBasicDataSource dataSource : dataSourcesToClose) {
      try {
        dataSource.close();
      } catch (Exception e) {
        exceptionWhileClosing = new HiveRuntimeException("Error closing datasources. Possibly more than one cause.", e);
      }
    }
    if (exceptionWhileClosing != null) {
      throw exceptionWhileClosing;
    }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  public static<T extends IdAndNameIdentifiable> void nameIsUnique(Collection<T> collection, T item) {
    if(!IdentifiableUtils.isNameUnique((Collection<IdAndNameIdentifiable>) collection, item))
        throw new HiveRuntimeException(
            String.format("%s with name %s already exists", item.getClass().getSimpleName(), item.getName()));
  }
View Full Code Here

      throw new HiveKeyNotFoundException(message);
  }

  public static void isNotNull(Object... objects) {
    for(Object o : objects)
      if(o == null) {throw new HiveRuntimeException("Precondition violated an object was null.");}
  }
View Full Code Here

public class Templater {
  public static String render(String templateFile, Context context) {
    try {
      Velocity.init(getDefaultVelocityProperties());
    } catch (Exception e) {
      throw new HiveRuntimeException("Failed to initialize Velocity templatng engine.");
    }
   
    Template template = null;
    try {
      template = Velocity.getTemplate(templateFile);
    } catch (ResourceNotFoundException e) {
      throw new HiveRuntimeException("Unable to locate template: " + templateFile);
    } catch (ParseErrorException e) {
      throw new HiveRuntimeException("Error parsing template: " + templateFile);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
   
    StringWriter writer = new StringWriter();
    try {
      template.merge(context, writer);
    } catch (Exception e) {
      throw new HiveRuntimeException(e);
    }
   
    return writer.toString();
  }
View Full Code Here

      node.setUsername(user);
      node.setPassword(password);
      try {
        hive.addNode(node);
      } catch (HiveLockableException e1) {
        throw new HiveRuntimeException("Hive was locked read-only.", e1);
      }
    }
    return node;
  }
View Full Code Here

      node.setUsername(user);
      node.setPassword(password);
      hive.addNode(node);
      return true;
    } catch (HiveLockableException e) {
      throw new HiveRuntimeException("hive was locked read-only", e);
    }
  }
View Full Code Here

public class NonNegativeValidator implements Validator {

  public boolean isValid(Object instance, String propertyName) {
    Object obj = ReflectionTools.invokeGetter(instance, propertyName);
    if (!(obj instanceof Number))
      throw new HiveRuntimeException("Expected an instance of type Number, but got " + obj.getClass().getSimpleName());
    Number num = (Number)obj;
    return obj.getClass().equals(long.class) || num.getClass().equals(Long.class) ? num.longValue() >= 0l : num.doubleValue() >= 0.0;
  }
View Full Code Here

    Number num = (Number)obj;
    return obj.getClass().equals(long.class) || num.getClass().equals(Long.class) ? num.longValue() >= 0l : num.doubleValue() >= 0.0;
  }
 
  public void throwInvalid(Object instance, String propertyName) {
    throw new HiveRuntimeException(String.format("Property %s of class %s is negative for instance %s", propertyName, instance.getClass().getSimpleName(), instance.toString()));
  }
View Full Code Here

TOP

Related Classes of org.hivedb.HiveRuntimeException

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.