Examples of RecordType


Examples of com.google.appengine.api.files.RecordConstants.RecordType

   */
  @Override
  public ByteBuffer readRecord() throws IOException {
    synchronized (lock) {
      finalRecord.clear();
      RecordType lastRead = RecordType.NONE;
      while (true) {
        try {
          Record record = readPhysicalRecord();
          if (record == null) {
            return null;
View Full Code Here

Examples of com.google.appengine.api.files.RecordConstants.RecordType

      return null;
    }
    blockBuffer.flip();
    int checksum = blockBuffer.getInt();
    short length = blockBuffer.getShort();
    RecordType type = RecordType.get(blockBuffer.get());
    if (length > bytesToBlockEnd || length < 0) {
      throw new RecordReadException("Length is too large:" + length);
    }

    blockBuffer.clear();
    blockBuffer.limit(length);
    bytesRead = input.read(blockBuffer);
    if (bytesRead != length) {
      return null;
    }
    if (!isValidCrc(checksum, blockBuffer, type.value())) {
      throw new RecordReadException("Checksum doesn't validate.");
    }

    blockBuffer.flip();
    return new Record(type, blockBuffer);
View Full Code Here

Examples of com.google.appengine.tools.mapreduce.impl.util.LevelDbConstants.RecordType

    int checksum = tmpBuffer.getInt();
    int length = tmpBuffer.getShort();
    if (length > bytesToBlockEnd || length < 0) {
      throw new CorruptDataException("Length is too large:" + length);
    }
    RecordType type = RecordType.get(tmpBuffer.get());
    if (type == RecordType.NONE && length == 0) {
      length = bytesToBlockEnd - HEADER_LENGTH;
    }
    readToTmp(length, false);

    if (!isValidCrc(checksum, tmpBuffer, type.value())) {
      throw new CorruptDataException("Checksum doesn't validate.");
    }
    return createRecordFromTmp(type);
  }
View Full Code Here

Examples of com.google.appengine.tools.mapreduce.impl.util.LevelDbConstants.RecordType

   * @param lastRecord a {@link Record} representing the last physical record written.
   * @return the {@link Record} with new write data.
   **/
  private static Record createRecord(ByteBuffer data, int bytesToBlockEnd, Record lastRecord) {
    int bytesToDataEnd = data.remaining();
    RecordType type = RecordType.UNKNOWN;
    int bytes = -1;
    if ((lastRecord.getType() == RecordType.NONE)
        && ((bytesToDataEnd + LevelDbConstants.HEADER_LENGTH) <= bytesToBlockEnd)) {
      // Can write entire record in current block
      type = RecordType.FULL;
View Full Code Here

Examples of com.google.javascript.rhino.jstype.RecordType

    // The parameter of record can be a type transformation expression
    return evalInternal(ttlAst, nameResolver);
  }

  private JSType buildRecordTypeFromObject(ObjectType objType) {
    RecordType recType = objType.toMaybeRecordType();
    // If it can be casted to a record type then return
    if (recType != null) {
      return recType;
    }
    // TODO(lpino): Handle inherited properties
View Full Code Here

Examples of com.google.javascript.rhino.jstype.RecordType

      return getUnknownType();
    }

    // Obtain the elements in the record type. Note that the block
    // above guarantees the casting to be safe
    RecordType recType = ((RecordType) type);
    Set<String> ownPropsNames = recType.getOwnPropertyNames();

    // Fetch the information of the map function
    Node mapFunction = params.get(1);
    String paramKey = getFunctionParameter(mapFunction, 0);
    String paramValue = getFunctionParameter(mapFunction, 1);

    // The maprecord variables must not be defined in the environment
    if (nameResolver.nameVars.containsKey(paramKey)) {
      reportWarning(ttlAst, DUPLICATE_VARIABLE, paramKey);
      return getUnknownType();
    }
    if (nameResolver.typeVars.containsKey(paramValue)) {
      reportWarning(ttlAst, DUPLICATE_VARIABLE, paramValue);
      return getUnknownType();
    }

    // Compute the new properties using the map function
    Node mapFnBody = getFunctionBody(mapFunction);
    Map<String, JSType> newProps = new HashMap<String, JSType>();
    for (String propName : ownPropsNames) {
      // The value of the current property
      JSType propValue = recType.getSlot(propName).getType();

      // Evaluate the map function body with paramValue and paramKey replaced
      // by the values of the current property
      NameResolver newNameResolver = new NameResolver(
          addNewEntry(nameResolver.typeVars, paramValue, propValue),
          addNewEntry(nameResolver.nameVars, paramKey, propName));
      JSType body = evalInternal(mapFnBody, newNameResolver);

      // If the body returns unknown then the whole expression returns unknown
      if (body.isUnknownType()) {
        return getUnknownType();
      }

      // Skip the property when the body evaluates to NO_TYPE
      // or the empty record (Object)
      if (body.isNoType() || body.isEquivalentTo(getObjectType())) {
        continue;
      }

      // Otherwise the body must evaluate to a record type
      if (!body.isRecordType()) {
        reportWarning(ttlAst, MAPRECORD_BODY_INVALID, body.toString());
        return getUnknownType();
      }

      // Add the properties of the resulting record type to the original one
      RecordType bodyAsRecType = ((RecordType) body);
      for (String newPropName : bodyAsRecType.getOwnPropertyNames()) {
        JSType newPropValue = bodyAsRecType.getSlot(newPropName).getType();
        // If the key already exists then we have to mix it with the current
        // property value
        putNewPropInPropertyMap(newProps, newPropName, newPropValue);
      }
    }
View Full Code Here

Examples of de.fu_berlin.inf.dpp.whiteboard.sxe.constants.RecordType

   */
  protected List<RecordDataObject> getRecords(XmlPullParser xpp)
      throws XmlPullParserException, IOException {

    List<RecordDataObject> rdos = new LinkedList<RecordDataObject>();
    RecordType t = RecordType.fromString(xpp.getName());
    RecordDataObject rdo;

    while (t != null) {
      rdo = getRdo(t);
      fillPairsfromAttributes(rdo, xpp);
View Full Code Here

Examples of gov.loc.www.zing.srw.RecordType

//                            System.out.println();
//                        }
//                    }

                    RecordsType records = searchResponse.getRecords();
                    RecordType record[];
                    if(records == null || (record = records.getRecord()) == null) {
                        System.out.println("0 records returned");
                    }
                    else {
                        System.out.println(record.length + " records returned");
View Full Code Here

Examples of gov.loc.www.zing.srw.RecordType

        ExplainResponseType response=new ExplainResponseType();
        String dbname=(String)msgContext.getProperty("dbname");
        SRWDatabase db=(SRWDatabase)msgContext.getProperty("db");
        log.info("db="+db);
        response.setVersion("1.1");
        RecordType record=new RecordType();
        record.setRecordSchema("http://explain.z3950.org/dtd/2.0/");
        StringOrXmlFragment frag=new StringOrXmlFragment();
        String recordPacking=request.getRecordPacking();
        if(recordPacking==null) {
            if(msgContext.getProperty("sru")!=null)
                recordPacking="xml"; // default for sru
            else
                recordPacking="string"; // default for srw
        }
        if(!recordPacking.equals("xml") &&
          !recordPacking.equals("string")) {
            return db.diagnostic(71, recordPacking, response);
        }
        try {
            if(recordPacking.equals("xml")) {
                record.setRecordPacking("xml");
                Document domDoc=XMLUtils.newDocument(
                    new InputSource(
                    new StringReader(db.getExplainRecord(null))));
                MessageElement elems[]=new MessageElement[1];
                elems[0]=new MessageElement(
                    domDoc.getDocumentElement());
                frag.set_any(elems);
            }
            else { // srw
                record.setRecordPacking("string");
                MessageElement elems[]=new MessageElement[1];
                elems[0]=new MessageElement();
                elems[0].addTextNode(db.getExplainRecord(null));
                frag.set_any(elems);
            }
            record.setRecordData(frag);
            response.setRecord(record);
        }
        catch(Exception e) {
            log.info(e, e);
            return null;
View Full Code Here

Examples of gov.loc.www.zing.srw.RecordType

                    records.setRecord(new RecordType[numRecs]);
                    int                    i;
                    MessageElement         elems[];
                    Record                 rec;
                    RecordType             rt;
                    String                 recStr = "";
                    StringOrXmlFragment    frag;

                    /**
                     * One at a time, retrieve and display the requested documents.
                     */
                    log.debug("trying to get "+numRecs+
                        " records starting with record "+startPoint+
                        " from a set of "+postingsCount+" records");
                    for (i=0; list!=null && i<numRecs && list.hasNext(); i++) {
                        rt = new RecordType();
                        rt.setRecordPacking(recordPacking);
                        frag = new StringOrXmlFragment();
                        elems = new MessageElement[1];
                        frag.set_any(elems);
                        try {
                            rec=list.nextRecord();
                            log.debug("rec="+rec);
                            recStr=transform(rec, schemaID).getRecord();
                            if (log.isDebugEnabled())
                                try {
                                    log.debug("Transformed XML:\n" + Utilities.byteArrayToString(
                                        recStr.getBytes("UTF8")));
                                } catch (UnsupportedEncodingException e) {} // can't happen
                            makeElem(recStr, rt, schemaID, schemaName, recordPacking, docb, elems);
                            if(rec.hasExtraRecordInfo())
                                setExtraRecordData(rt, rec.getExtraRecordInfo());
                        } catch (IOException e) {
                            log.error("error getting document "+(i+1)+", postings="+postingsCount);
                            log.error(e, e);
                            try {
                                makeElem(SRWDiagnostic.newSurrogateDiagnostic(
                                    "info:srw/diagnostic/1/",
                                    SRWDiagnostic.RecordTemporarilyUnavailable,
                                    null), rt, null,
                                    "info:srw/schema/1/diagnostics-v1.1",
                                    recordPacking, docb, elems);
                            } catch (IOException e2) {
                                log.error(e, e);
                                break;
                            } catch (SAXException e2) {
                                log.error(e, e);
                                break;
                            }
                        } catch (NoSuchElementException e) {
                            log.error("error getting document "+(i+1)+", postings="+postingsCount);
                            log.error(e, e);
                            try {
                                makeElem(SRWDiagnostic.newSurrogateDiagnostic(
                                    "info:srw/diagnostic/1/",
                                    SRWDiagnostic.RecordTemporarilyUnavailable,
                                    null), rt, null,
                                    "info:srw/schema/1/diagnostics-v1.1",
                                    recordPacking, docb, elems);
                            } catch (IOException e2) {
                                log.error(e, e);
                                break;
                            } catch (SAXException e2) {
                                log.error(e, e);
                                break;
                            }
                        } catch (SAXException e) {
                            try {
                                log.error(e, e);
                                makeElem(SRWDiagnostic.newSurrogateDiagnostic(
                                    "info:srw/diagnostic/1/",
                                    SRWDiagnostic.RecordTemporarilyUnavailable,
                                    null), rt, null,
                                    "info:srw/schema/1/diagnostics-v1.1",
                                    recordPacking, docb, elems);
                            } catch (IOException e2) {
                                log.error(e, e);
                                break;
                            } catch (SAXException e2) {
                                log.error(e, e);
                                break;
                            }
                            log.error("error getting document "+(i+1)+", postings="+postingsCount);
                            log.error(e, e);
                            try {
                                log.error("Bad record:\n" + Utilities.byteArrayToString(
                                        recStr.getBytes("UTF8")));
                            } catch (UnsupportedEncodingException e2) {} // can't happen
                        } catch (SRWDiagnostic e) {
                            try {
                                makeElem(SRWDiagnostic.newSurrogateDiagnostic(
                                    "info:srw/diagnostic/1/", e.getCode(),
                                    e.getAddInfo()), rt, null,
                                    "info:srw/schema/1/diagnostics-v1.1",
                                    recordPacking, docb, elems);
                            } catch (IOException e2) {
                                log.error(e, e);
                                break;
                            } catch (SAXException e2) {
                                log.error(e, e);
                                break;
                            }
                            log.error("error getting document "+(i+1)+", postings="+postingsCount);
                            log.error(e, e);
                            try {
                                log.error("Bad record:\n" + Utilities.byteArrayToString(
                                        recStr.getBytes("UTF8")));
                            } catch (UnsupportedEncodingException e2) {} // can't happen
                        }

                        rt.setRecordData(frag);

                        rt.setRecordPosition(new PositiveInteger(Long.toString(startPoint+i)));

                        records.setRecord(i, rt);
                    }
                    response.setRecords(records);
                    if (startPoint+i<=postingsCount)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.