Examples of Datastream


Examples of one.nio.serial.DataStream

        CalcSizeStream css = new CalcSizeStream();
        css.writeObject(request);
        int requestSize = css.count();

        byte[] buffer = new byte[requestSize + 4];
        DataStream ds = css.hasCycles() ? new SerializeStream(buffer) : new DataStream(buffer);
        ds.writeInt(requestSize);
        ds.writeObject(request);
        return buffer;
    }
View Full Code Here

Examples of one.nio.serial.DataStream

        CalcSizeStream css = new CalcSizeStream();
        css.writeObject(response);
        int responseSize = css.count();
        byte[] buffer = new byte[responseSize + 4];

        DataStream ds = css.hasCycles() ? new SerializeStream(buffer) : new DataStream(buffer);
        ds.writeInt(responseSize);
        ds.writeObject(response);

        super.write(buffer, 0, buffer.length);
    }
View Full Code Here

Examples of opennlp.maxent.DataStream

      predictor.eval("Rainy");
      predictor.eval("Blarmey");
  }
  else {
      try {
    DataStream ds =
        new PlainTextByLineDataStream(
      new FileReader(new File(dataFileName)));

    while (ds.hasNext()) {
        String s = (String)ds.nextToken();
        predictor.eval(s.substring(0, s.lastIndexOf(' ')),real);
    }
    return;
      }
      catch (Exception e) {
View Full Code Here

Examples of opennlp.maxent.DataStream

      throws FileNotFoundException, IOException {
    System.err.println("Building dictionary");

    NGramModel ngramModel = new NGramModel();

    DataStream data = new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile));
    while(data.hasNext()) {
      String tagStr = (String) data.nextToken();
      String[] tt = tagStr.split(" ");
      String[] words = new String[tt.length];
      for (int wi=0;wi<words.length;wi++) {
        words[wi] =
            tt[wi].substring(0,tt[wi].lastIndexOf('_'));
View Full Code Here

Examples of opennlp.maxent.DataStream

   * other than the default ones.  They are "\\.|!|\\?|\\\"|\\)".
   *
   */
  public static GISModel train(File inFile, int iterations, int cut, EndOfSentenceScanner scanner) throws IOException {
    EventStream es;
    DataStream ds;
    Reader reader;

    reader = new BufferedReader(new FileReader(inFile));
    ds = new PlainTextByLineDataStream(reader);
    es = new SDEventStream(ds, scanner);
View Full Code Here

Examples of opennlp.maxent.DataStream

      }
      GISModel mod;
      if (dict != null) {
        System.err.println("Building dictionary");
        MutableDictionary mdict = new MutableDictionary(cutoff);
        DataStream data = new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile));
        while(data.hasNext()) {
          String tagStr = (String) data.nextToken();
          String[] tt = tagStr.split(" ");
          String[] words = new String[tt.length];
          for (int wi=0;wi<words.length;wi++) {
            words[wi] = tt[wi].substring(0,tt[wi].lastIndexOf('_'));
          }
View Full Code Here

Examples of opennlp.maxent.DataStream

    if (fun) {
      Parse.useFunctionTags(true);
    }
    if (dict || all) {
      System.err.println("Building dictionary");
      DataStream data = new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile));
      MutableDictionary mdict = buildDictionary(data, rules, cutoff);
      System.out.println("Saving the dictionary");
      mdict.persist(dictFile);
    }
    if (tag || all) {
View Full Code Here

Examples of opennlp.maxent.DataStream

      throws FileNotFoundException, IOException {
    System.err.println("Building dictionary");

    NGramModel ngramModel = new NGramModel();

    DataStream data = new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile));
    while(data.hasNext()) {
      String tagStr = (String) data.nextToken();
      String[] tt = tagStr.split(" ");
      String[] words = new String[tt.length];
      for (int wi=0;wi<words.length;wi++) {
        words[wi] =
            tt[wi].substring(0,tt[wi].lastIndexOf('_'));
View Full Code Here

Examples of org.fcrepo.client.batch.types.Datastream

            }
        } else if (namespaceURI.equalsIgnoreCase(BATCH_MODIFY.uri)
                && localName.equalsIgnoreCase("addDatastream")) {
            try {
                addDatastream = false;
                m_ds = new Datastream();

                // Get required attributes
                m_ds.objectPID = attrs.getValue("pid");
                m_ds.dsControlGrp = attrs.getValue("dsControlGroupType");
                m_ds.dsLabel = attrs.getValue("dsLabel");
                m_ds.dsState = attrs.getValue("dsState");
                m_ds.dsMIME = attrs.getValue("dsMIME");
                m_ds.logMessage = attrs.getValue("logMessage");

                // Check for optional attributes
                if (attrs.getValue("dsID") != null
                        && !attrs.getValue("dsID").equals("")) {
                    m_ds.dsID = attrs.getValue("dsID");
                } else {
                    m_ds.dsID = null;
                }
                if (attrs.getValue("dsLocation") != null
                        && !attrs.getValue("dsLocation").equals("")) {
                    m_ds.dsLocation = attrs.getValue("dsLocation");
                }
                if (attrs.getValue("formatURI") != null
                        && !attrs.getValue("formatURI").equals("")) {
                    m_ds.formatURI = attrs.getValue("formatURI");
                }
                if (attrs.getValue("versionable") != null
                        && !attrs.getValue("versionable").equals("")) {
                    m_ds.versionable =
                            new Boolean(attrs.getValue("versionable"))
                                    .booleanValue();
                }
                if (attrs.getValue("altIDs") != null
                        && !attrs.getValue("altIDs").equals("")) {
                    m_ds.altIDs = attrs.getValue("altIDs").split(" ");
                }
                if (attrs.getValue("checksumType") != null
                        && !attrs.getValue("checksumType").equals("")) {
                    m_ds.checksumType = attrs.getValue("checksumType");
                }
                if (attrs.getValue("checksum") != null
                        && !attrs.getValue("checksum").equals("")) {
                    m_ds.checksum = attrs.getValue("checksum");
                }

                addDatastream = true;

            } catch (Exception e) {
                e.printStackTrace();
                failedCount++;
                logFailedDirective(m_ds.objectPID, localName, e, "");
                return;
            }
        } else if (namespaceURI.equalsIgnoreCase(BATCH_MODIFY.uri)
                && localName.equalsIgnoreCase("purgeDatastream")) {

            try {
                purgeDatastream = false;
                m_ds = new Datastream();

                // Get required attributes
                m_ds.objectPID = attrs.getValue("pid");
                m_ds.dsID = attrs.getValue("dsID");
                m_ds.logMessage = attrs.getValue("logMessage");

                // Get optional attributes. If asOfDate attribute is missing
                // or empty its value is null and indicates that all versions
                // of the datastream are to be purged.
                if (attrs.getValue("asOfDate") != null
                        && !attrs.getValue("asOfDate").equals("")) {
                    m_ds.asOfDate = attrs.getValue("asOfDate");
                }
                if (attrs.getValue("endDate") != null
                        && !attrs.getValue("endDate").equals("")) {
                    m_ds.endDate = attrs.getValue("endDate");
                }
                if (attrs.getValue("force") != null
                        && !attrs.getValue("force").equals("")) {
                    m_ds.force =
                            new Boolean(attrs.getValue("force")).booleanValue();
                }

                purgeDatastream = true;

            } catch (Exception e) {
                failedCount++;
                logFailedDirective(m_ds.objectPID, localName, e, "");
            }
        } else if (namespaceURI.equalsIgnoreCase(BATCH_MODIFY.uri)
                && localName.equalsIgnoreCase("modifyDatastream")) {

            try {
                org.fcrepo.server.types.gen.Datastream dsOrig = null;
                modifyDatastream = false;

                // Get required attributes
                m_ds = new Datastream();
                m_ds.objectPID = attrs.getValue("pid");
                m_ds.dsID = attrs.getValue("dsID");
                m_ds.dsControlGrp = attrs.getValue("dsControlGroupType");
                m_ds.logMessage = attrs.getValue("logMessage");

                try {
                    dsOrig =
                            APIM.getDatastream(m_ds.objectPID, m_ds.dsID, null);
                } catch (Exception e) {
                    failedCount++;
                    logFailedDirective(m_ds.objectPID,
                                       localName,
                                       null,
                                       "Datastream ID: " + m_ds.dsID
                                               + " does not exist"
                                               + " in the object: "
                                               + m_ds.objectPID
                                               + " .\n    Unable to modify"
                                               + "datastream.");
                    return;
                }

                // Check that datastream control group type matches that of the
                // original datastream being modified. This would get caught
                // later by the server, but may as well detect this now and
                // flag as an error in directives file.
                if (dsOrig.getControlGroup().value()
                        .equalsIgnoreCase(m_ds.dsControlGrp)) {

                    // Check for optional atributes. Missing attributes (null) indicate
                    // that no change is to occur to that attribute and that the original
                    // value of that datastream attribute is to be retained. Attributes that
                    // contain the empty string indicate that the datastream attribute value
                    // is to be set to the empty string.
                    if (attrs.getValue("dsLabel") != null) {
                        m_ds.dsLabel = attrs.getValue("dsLabel");
                    } else {
                        m_ds.dsLabel = dsOrig.getLabel();
                    }
                    if (attrs.getValue("dsLocation") != null) {
                        m_ds.dsLocation = attrs.getValue("dsLocation");
                    } else {
                        m_ds.dsLocation = dsOrig.getLocation();
                    }
                    if (attrs.getValue("dsMIME") != null) {
                        m_ds.dsMIME = attrs.getValue("dsMIME");
                    } else {
                        m_ds.dsMIME = dsOrig.getMIMEType();
                    }
                    if (attrs.getValue("force") != null) {
                        m_ds.force =
                                new Boolean(attrs.getValue("force"))
                                        .booleanValue();
                    } else {
                        m_ds.force = false;
                    }
                    if (attrs.getValue("altIDs") != null) {
                        m_ds.altIDs = attrs.getValue("altIDs").split(" ");
                    } else {
                        m_ds.altIDs =
                                dsOrig.getAltIDs().getItem()
                                        .toArray(new String[] {});
                    }
                    if (attrs.getValue("formatURI") != null) {
                        m_ds.formatURI = attrs.getValue("formatURI");
                    } else {
                        m_ds.formatURI = dsOrig.getFormatURI();
                    }
                    if (attrs.getValue("checksumType") != null) {
                        m_ds.checksumType = attrs.getValue("checksumType");
                    }
                    if (attrs.getValue("checksum") != null) {
                        m_ds.checksum = attrs.getValue("checksum");
                    }

                    modifyDatastream = true;

                } else {
                    failedCount++;
                    logFailedDirective(m_ds.objectPID,
                                       localName,
                                       null,
                                       " Datastream Control Group Type of: "
                                               + m_ds.dsControlGrp
                                               + " in directives file does not match control group"
                                               + " type in original datastream: "
                                               + dsOrig.getControlGroup()
                                                       .value());
                }
            } catch (Exception e) {
                failedCount++;
                logFailedDirective(m_ds.objectPID, localName, e, "");
            }
        } else if (namespaceURI.equalsIgnoreCase(BATCH_MODIFY.uri)
                && localName.equalsIgnoreCase("setDatastreamState")) {

            try {
                m_ds = new Datastream();
                setDatastreamState = false;

                // Get require attributes
                m_ds.objectPID = attrs.getValue("pid");
                m_ds.dsID = attrs.getValue("dsID");
                m_ds.dsState = attrs.getValue("dsState");
                m_ds.logMessage = attrs.getValue("logMessage");
                setDatastreamState = true;

            } catch (Exception e) {
                failedCount++;
                logFailedDirective(m_ds.objectPID, localName, e, "");
            }
        } else if (namespaceURI.equalsIgnoreCase(BATCH_MODIFY.uri)
                && localName.equalsIgnoreCase("setDatastreamVersionable")) {

            try {
                m_ds = new Datastream();
                setDatastreamVersionable = false;

                // Get require attributes
                m_ds.objectPID = attrs.getValue("pid");
                m_ds.dsID = attrs.getValue("dsID");
                m_ds.versionable =
                        new Boolean(attrs.getValue("versionable"))
                                .booleanValue();
                m_ds.logMessage = attrs.getValue("logMessage");
                setDatastreamVersionable = true;

            } catch (Exception e) {
                failedCount++;
                logFailedDirective(m_ds.objectPID, localName, e, "");
            }
        } else if (namespaceURI.equalsIgnoreCase(BATCH_MODIFY.uri)
                && localName.equalsIgnoreCase("compareDatastreamChecksum")) {

            try {
                m_ds = new Datastream();
                compareDatastreamChecksum = false;

                // Get require attributes
                m_ds.objectPID = attrs.getValue("pid");
                m_ds.dsID = attrs.getValue("dsID");
View Full Code Here

Examples of org.fcrepo.server.storage.types.Datastream

        //For each content model, parse the DS-COMPOSITE-MODEL
        for (String contentmodel : contentmodels) {
            contentmodel = contentmodel.substring("info:fedora/".length());

            DOReader contentmodelReader = doMgr.getReader(false, context, contentmodel);
            Datastream dscompmodelDS = contentmodelReader.GetDatastream("DS-COMPOSITE-MODEL", asOfDateTime);

            if (dscompmodelDS == null) {//NO ds composite model, thats okay, continue to next content model
                continue;
            }
            DsCompositeModel dscompobject = JAXB.unmarshal(dscompmodelDS.getContentStream(), DsCompositeModel.class);
            for (DsTypeModel typeModel : dscompobject.getDsTypeModel()) {
                String DSID = typeModel.getID();
                Datastream objectDatastream = currentObjectReader.GetDatastream(DSID, asOfDateTime);

                if (objectDatastream == null) {
                    Boolean optional = typeModel.isOptional();
                    if (optional != null && optional) {
                        //optional datastream can be missing, not a problem
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.