Package org.kitesdk.data

Examples of org.kitesdk.data.DatasetException


        KeyEntitySchemaParser<?, ?> schemaParser = schemaParserClass
            .getConstructor().newInstance();
        schemaParsers.putIfAbsent(schemaParserClassName, schemaParser);
        return schemaParser;
      } catch (Exception e) {
        throw new DatasetException(
            "Could not instantiate schema parser class: "
                + schemaParserClassName, e);
      }
    }
  }
View Full Code Here


            entitySchema);
      } catch (ClassNotFoundException e) {
        String msg = "StorageKey or entity class not found. Make sure the specific "
            + "record instances are on the classpath.";
        LOG.error(msg, e);
        throw new DatasetException(msg, e);
      } catch (SecurityException e) {
        String msg = "Cannot access key or entity class.";
        LOG.error(msg, e);
        throw new DatasetException(msg, e);
      } catch (NoSuchFieldException e) {
        String msg = "SCHEMA$ field not found in the entity class";
        LOG.error(msg, e);
        throw new DatasetException(msg, e);
      } catch (IllegalAccessException e) {
        String msg = "Not allowed to access SCHEMA$ field in the entity class";
        LOG.error(msg, e);
        throw new DatasetException(msg, e);
      }
    }

    // Initialize the entity mappers this object wraps. There will be one entity
    // mapper per version of the schema. When deserializing a row, we'll use the
View Full Code Here

          schemaDirectory.substring(CLASSPATH_PREFIX.length()));
      if (dirURL != null && dirURL.getProtocol().equals("file")) {
        try {
          schemaStrings = getSchemaStringsFromDir(new File(dirURL.toURI()));
        } catch (URISyntaxException e) {
          throw new DatasetException(e);
        }
      } else if (dirURL != null && dirURL.getProtocol().equals("jar")) {
        String jarPath = dirURL.getPath().substring(5,
            dirURL.getPath().indexOf("!"));
        schemaStrings = getSchemaStringsFromJar(jarPath,
            schemaDirectory.substring(CLASSPATH_PREFIX.length()));
      } else {
        String msg = "Could not find classpath resource: " + schemaDirectory;
        LOG.error(msg);
        throw new DatasetException(msg);
      }
    } else {
      schemaStrings = getSchemaStringsFromDir(new File(schemaDirectory));
    }
View Full Code Here

              hbaseAdmin.enableTable(tableName);
            }
          }
        }
      } catch (IOException e) {
        throw new DatasetException(e);
      }
    }
  }
View Full Code Here

      return (Schema) entityClass.getDeclaredField("SCHEMA$").get(null);
    } catch (Throwable e) {
      LOG.error(
          "Error getting schema from entity of type: " + entityClass.getName(),
          e);
      throw new DatasetException(e);
    }
  }
View Full Code Here

    FileInputStream fis = null;
    try {
      fis = new FileInputStream(schemaFile);
      schemaString = AvroUtils.inputStreamToString(fis);
    } catch (IOException e) {
      throw new DatasetException(e);
    } finally {
      if (fis != null) {
        try {
          fis.close();
        } catch (IOException e) {
View Full Code Here

        + jarPath);
    JarFile jar;
    try {
      jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
      throw new DatasetException(e);
    } catch (IOException e) {
      throw new DatasetException(e);
    }
    Enumeration<JarEntry> entries = jar.entries();
    List<String> schemaStrings = new ArrayList<String>();
    while (entries.hasMoreElements()) {
      JarEntry jarEntry = entries.nextElement();
      if (jarEntry.getName().startsWith(directoryPath)
          && jarEntry.getName().endsWith(".avsc")) {
        LOG.info("Found schema: " + jarEntry.getName());
        InputStream inputStream;
        try {
          inputStream = jar.getInputStream(jarEntry);
        } catch (IOException e) {
          throw new DatasetException(e);
        }
        String schemaString = AvroUtils.inputStreamToString(inputStream);
        schemaStrings.add(schemaString);
      }
    }
View Full Code Here

            null);
      } catch (Throwable e) {
        LOG.error(
            "Error getting constructor or schema field for entity of type: "
                + entityClass.getName(), e);
        throw new DatasetException(e);
      }
    }
View Full Code Here

        entity = entityConstructor.newInstance();
      } catch (Throwable e) {
        LOG.error(
            "Error trying to construct entity of type: "
                + entityClass.getName(), e);
        throw new DatasetException(e);
      }

      int cnt = 0;
      for (S subEntity : subEntities) {
        if (subEntity != null) {
View Full Code Here

      // No good way to handle these types of exceptions, so
      // throw an DatasetException up to the user.
      String msg = "Could not get a default constructor for class: "
          + recordClass.toString();
      LOG.error(msg, e);
      throw new DatasetException(msg, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.kitesdk.data.DatasetException

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.