Package com.linkedin.databus2.core

Examples of com.linkedin.databus2.core.DatabusException


  public static String uriToXmlPrefix(String uri)
      throws DatabusException
  {
    if (uri == null)
    {
      throw new DatabusException("uri passed is null and not valid");
    }

    Pattern pattern = Pattern.compile("gg://(.*):(.*)");
    Matcher matcher = pattern.matcher(uri);
    if (!matcher.matches() || matcher.groupCount() != 2)
    {
      throw new DatabusException("Expected uri format for gg path not found");
    }

    return matcher.group(2);
  }
View Full Code Here


        return convertToSimpleType(fieldValue, avroField);
      case RECORD:
      case ARRAY:
        // TODO Add support for these datatypes (warning: when do so, watch out for fieldType
        // vs. avroField.schema() mismatches for arrays within unions:  see DDSDBUS-3093/3136)
        throw new DatabusException("Handling of Avro '" + fieldType + "' field type not yet implemented!");
      case ENUM:
      case FIXED:
      case MAP:
      case UNION:
      default:
        throw new DatabusException("unknown field type: " + recordFieldName + ":" + fieldType);
    }
  }
View Full Code Here

      {
        return fieldValue.getBytes(Charset.defaultCharset());
      }
      if (fieldValue.length() <= 2)
      {
        throw new DatabusException("Unable to decode the string because length is less than 2");
      }
      if (!isStringHex(fieldValue))
      {
        throw new DatabusException("Unable to decode the string because it is not hex-encoded");
      }
      try
      {
        return stringToHex(fieldValue.substring(2, fieldValue.length()-1));
      }
      catch (DecoderException e)
      {
        throw new DatabusException("Unable to decode a " + databaseFieldType + " field: " + recordFieldName);
      }
    }
    //return array
    else if (databaseFieldType.equalsIgnoreCase("ARRAY"))
    {
      throw new DatabusException("ARRAY type still not implemented!");           //TODO add support for array
    }
    //return record
    else if (databaseFieldType.equalsIgnoreCase("TABLE"))
    {
      throw new DatabusException("TABLE type still not implemented!");           //TODO add support for table
    }
    else
    {
      throw new DatabusException("unknown field type: " + recordFieldName + ":" + databaseFieldType);
    }
  }
View Full Code Here

  {
    Pattern _pattern = Pattern.compile("(\\d{4})-(\\d{2})-(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{0,9})");
    Matcher matcher = _pattern.matcher(value);
    if (!matcher.matches() || matcher.groupCount() != 7)
    {
      throw new DatabusException("The timestamp format is not as expected, cannot proceed!");
    }

    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));

    //Explicitly set ms to zero; without initialization it has random ms values :(
View Full Code Here

  {
    Pattern _pattern = Pattern.compile("(\\d{4}-\\d{2}-\\d{2}).*");
    Matcher matcher = _pattern.matcher(value);
    if (!matcher.matches() || matcher.groupCount() != 1)
    {
      throw new DatabusException("The date format is not as expected, cannot proceed!");
    }
    String dateFormatString = matcher.group(1);
    long dateLong = Date.valueOf(dateFormatString).getTime();
    return dateLong;
  }
View Full Code Here

  }

  @Override
  public void dropDatabase(String dbName) throws DatabusException
  {
    throw new DatabusException("Unsupported method dropDatabase");
  }
View Full Code Here

            HashMap<Long, List<RegisterResponseEntry>> schemaMap =
                    new HashMap<Long, List<RegisterResponseEntry>>();

            short srcId=1;
            List<RegisterResponseEntry> l1 = new ArrayList<RegisterResponseEntry>();
            l1.add(new RegisterResponseEntry(1L, srcId,SOURCE1_SCHEMA_STR));

            schemaMap.put(1L, l1);

            Map<Long, IdNamePair> sourcesMap = new HashMap<Long, IdNamePair>();
            List<String> sources = new ArrayList<String>();
View Full Code Here

        HashMap<Long, List<RegisterResponseEntry>> schemaMap =
                new HashMap<Long, List<RegisterResponseEntry>>();

        short srcId=1;
        List<RegisterResponseEntry> l1 = new ArrayList<RegisterResponseEntry>();
        l1.add(new RegisterResponseEntry(1L, srcId,SOURCE1_SCHEMA_STR));

        schemaMap.put(1L, l1);

        Map<Long, IdNamePair> sourcesMap = new HashMap<Long, IdNamePair>();
        List<String> sources = new ArrayList<String>();
View Full Code Here

        List<RegisterResponseEntry> l1 = new ArrayList<RegisterResponseEntry>();
        List<RegisterResponseEntry> l2 = new ArrayList<RegisterResponseEntry>();
        List<RegisterResponseEntry> l3 = new ArrayList<RegisterResponseEntry>();

        l1.add(new RegisterResponseEntry(1L, (short)1,SOURCE1_SCHEMA_STR));
        l2.add(new RegisterResponseEntry(2L, (short)1,SOURCE2_SCHEMA_STR));
        l3.add(new RegisterResponseEntry(3L, (short)1,SOURCE3_SCHEMA_STR));

        schemaMap.put(1L, l1);
        schemaMap.put(2L, l2);
        schemaMap.put(3L, l3);
View Full Code Here

        HashMap<Long, List<RegisterResponseEntry>> schemaMap =
                new HashMap<Long, List<RegisterResponseEntry>>();

        short srcId=1;
        List<RegisterResponseEntry> l1 = new ArrayList<RegisterResponseEntry>();
        l1.add(new RegisterResponseEntry(1L, srcId,SOURCE1_SCHEMA_STR));

        schemaMap.put(1L, l1);

        Map<Long, IdNamePair> sourcesMap = new HashMap<Long, IdNamePair>();
        List<String> sources = new ArrayList<String>();
View Full Code Here

TOP

Related Classes of com.linkedin.databus2.core.DatabusException

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.