Package org.apache.avro

Examples of org.apache.avro.Schema


    fields.add(field);
  }

  final public Message MessageDeclaration(Protocol p) throws ParseException {
  String name;
  Schema request;
  Schema response;
  boolean oneWay = false;
  List<Schema> errorSchemata = new ArrayList<Schema>();
  errorSchemata.add(Protocol.SYSTEM_ERROR);
    response = ResultType();
    name = Identifier();
    request = FormalParameters();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case ONEWAY:
    case THROWS:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case ONEWAY:
        jj_consume_token(ONEWAY);
              oneWay = true;
        break;
      case THROWS:
        jj_consume_token(THROWS);
        ErrorList(errorSchemata);
        break;
      default:
        jj_la1[17] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[18] = jj_gen;
      ;
    }
    jj_consume_token(SEMICOLON);
    Schema errors = Schema.createUnion(errorSchemata);
    if (oneWay && response.getType() != Type.NULL)
      {if (true) throw error("One-way message'"+name+"' must return void", token);}
    {if (true) return oneWay
    ? p.createMessage(name, null, request)
    : p.createMessage(name, null, request, response, errors);}
View Full Code Here


    : p.createMessage(name, null, request, response, errors);}
    throw new Error("Missing return statement in function");
  }

  final public void ErrorList(List<Schema> errors) throws ParseException {
  Schema s;
    s = ReferenceType();
                        errors.add(s);
    label_10:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
View Full Code Here

    {if (true) return Schema.createRecord(fields);}
    throw new Error("Missing return statement in function");
  }

  final public void FormalParameter(List<Field> fields) throws ParseException {
  Schema type;
    type = Type();
    VariableDeclarator(type, fields);
  }
View Full Code Here

    type = Type();
    VariableDeclarator(type, fields);
  }

  final public Schema Type() throws ParseException {
  Schema s;
    if (jj_2_2(2)) {
      s = ReferenceType();
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case BOOLEAN:
View Full Code Here

    {if (true) return s;}
    throw new Error("Missing return statement in function");
  }

  final public Schema ArrayType() throws ParseException {
  Schema elemSchema;
    jj_consume_token(ARRAY);
    jj_consume_token(LT);
    elemSchema = Type();
    jj_consume_token(GT);
    {if (true) return Schema.createArray(elemSchema);}
View Full Code Here

    {if (true) return Schema.createArray(elemSchema);}
    throw new Error("Missing return statement in function");
  }

  final public Schema MapType() throws ParseException {
  Schema elemSchema;
    jj_consume_token(MAP);
    jj_consume_token(LT);
    elemSchema = Type();
    jj_consume_token(GT);
    {if (true) return Schema.createMap(elemSchema);}
View Full Code Here

                                 sb.append(".").append(tok.image);
    }
    String name = sb.toString();
    if ((name.indexOf('.') == -1) && namespace != null)
      name = namespace + "." + name;
    Schema type = names.get(name);
    if (type == null)
      {if (true) throw error("Undefined name '" + name + "'", token);}
    {if (true) return type;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

/**
* Result types are like other types, except we provide "void" as
* an alias of "null"
*/
  final public Schema ResultType() throws ParseException {
  Schema schema;
    if (jj_2_3(2)) {
      jj_consume_token(VOID);
                      {if (true) return Schema.create(Type.NULL);}
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
View Full Code Here

    List<RegisterResponseEntry> res =
        objMapper.readValue(in, new TypeReference<List<RegisterResponseEntry>>(){});
    assertNotNull("no result", res);
    assertEquals("expected one source", 1, res.size());
    assertEquals("expected correct source id", 3002, res.get(0).getId());
    Schema resSchema = Schema.parse(res.get(0).getSchema());
    assertEquals("expected correct source schema", "test3.source2_v1", resSchema.getFullName());
  }
View Full Code Here

    {
      LOG.debug("/register response:" + new String(respHandler.getReceivedBytes()));
    }
    assertEquals("expected two sources", 2, res.size());
    assertEquals("expected correct source id", 4001, res.get(0).getId());
    Schema resSchema = Schema.parse(res.get(0).getSchema());
    assertEquals("expected correct source schema", "test4.source1_v1", resSchema.getFullName());
    assertEquals("expected correct source id", 4002, res.get(1).getId());
    resSchema = Schema.parse(res.get(1).getSchema());
    assertEquals("expected correct source schema", "test4.source2_v1", resSchema.getFullName());
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.Schema

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.