Package org.hivedb

Examples of org.hivedb.HiveRuntimeException


public class NonEmptyStringValidator implements Validator  {
  public boolean isValid(Object instance, String propertyName) {
    Object obj = ReflectionTools.invokeGetter(instance, propertyName);
    if (!(obj instanceof String))
      throw new HiveRuntimeException("Expected an instance of type String, but got " + obj.getClass().getSimpleName());
    String s = (String)obj;
    return s != null && s.length() > 0;
  }
View Full Code Here


      throw new HiveRuntimeException("Expected an instance of type String, but got " + obj.getClass().getSimpleName());
    String s = (String)obj;
    return s != null && s.length() > 0;
  }
  public void throwInvalid(Object instance, String propertyName) {
    throw new HiveRuntimeException(String.format("Property %s of class %s is an empty string for instance %s", propertyName, instance.getClass().getSimpleName(), instance.toString()));
  }
View Full Code Here

  public EntityConfig getEntityConfig(String className) {
    Class clazz = null;
    try {
      clazz = Class.forName(className);
    } catch (ClassNotFoundException e) {
      throw new HiveRuntimeException(e.getMessage(),e);
    }
    return getEntityConfig(clazz);
  }
View Full Code Here

*/
public class NoValidator implements Validator {
  public boolean isValid(Object instance, String propertyName) {return true;}
 
  public void throwInvalid(Object instance, String propertyName) {
    throw new HiveRuntimeException("TrueValidator should never throw");
  }
View Full Code Here

    Object obj = ReflectionTools.invokeGetter(instance, propertyName);
    return obj != null;
  }

  public void throwInvalid(Object instance, String propertyName) {
    throw new HiveRuntimeException(String.format("Property %s of class %s is null for instance %s", propertyName, instance.getClass().getSimpleName(), instance.toString()));
  }
View Full Code Here

    if (obj.getClass().equals(Short.class) || obj.getClass().equals(short.class))
      return ((Number)obj).shortValue() > 0;
    throw new RuntimeException(String.format("Cannot validate Number of class %s", obj.getClass().getSimpleName()));
  }
  public void throwInvalid(Object instance, String propertyName) {
    throw new HiveRuntimeException(String.format("Property %s of class %s is zero for instance %s", propertyName, instance.getClass().getSimpleName(), instance.toString()));
  }
View Full Code Here

  public SecondaryIndex getSecondaryIndex(String secondaryIndexName) {
    for (SecondaryIndex secondaryIndex : getSecondaryIndexes())
      if (secondaryIndex.getName().equalsIgnoreCase(secondaryIndexName))
        return secondaryIndex;
    throw new HiveRuntimeException(String.format("Secondary index %s of resource %s of partitition dimension %s not found.",
        secondaryIndexName,
        getName(),
        getPartitionDimension().getName()));
  }
View Full Code Here

    Validate annotation = (Validate) ReflectionTools.getGetterOfProperty(entityInterface, propertyName).getAnnotation(Validate.class);
    if (annotation != null)
      try {
        return (Validator) Class.forName(annotation.value()).newInstance();
      } catch (Exception e) {
        throw new HiveRuntimeException(e);
      }
    return nonNullValidator;
  }
View Full Code Here

        else if (indexConfig.getIndexType().equals(IndexType.Hive)) {
          hive.addSecondaryIndex(resource, createSecondaryIndex(indexConfig));
        }

    } catch (HiveLockableException e) {
      throw new HiveRuntimeException(e.getMessage(), e);
    }
  }
View Full Code Here

  private Object nextKey() {
    if (Integer.class.equals(returnType))
      return new Integer(incrementer.nextIntValue());
    if (Long.class.equals(returnType))
      return new Long(incrementer.nextLongValue());
    throw new HiveRuntimeException("Unable to generate key for type "
        + returnType.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.