Examples of ParseContext


Examples of com.alibaba.fastjson.parser.ParseContext

            return null;
        }

        Map<Object, Object> map = createMap(type);

        ParseContext context = parser.getContext();

        try {
            parser.setContext(context, map, fieldName);

            if (lexer.token() == JSONToken.RBRACE) {
View Full Code Here

Examples of com.alibaba.wasp.plan.parser.ParseContext

      "CREATE index PhotosByTag on Photo(tag);" };

  public static void loadTable(Configuration conf) throws MetaException, ZooKeeperConnectionException {
    MemFMetaStore fmetaServices = new MemFMetaStore();
    TableSchemaCacheReader reader = TableSchemaCacheReader.getInstance(conf, fmetaServices);
    ParseContext context = new ParseContext();
    context.setTsr(reader);
    DruidDQLParser dqlParser = new DruidDQLParser(conf, null);
    DruidDDLParser ddlParser = new DruidDDLParser(conf);
    DruidDMLParser dmlParser = new DruidDMLParser(conf, null);
    WaspParser druidParser = new WaspParser(ddlParser, dqlParser, dmlParser);
View Full Code Here

Examples of fbench.translate.ParseContext

        stString = FBench.removeHTML(stString);
       
      ParseResult result = null;
        Translator translator = TranslatorSource.getInstance().getTranslator("ST", targetLanguage);
      if(translator != null){
        ParseContext context = new ParseContext(new StringReader(stString), ParseTarget.guardCondition, document);
        result = translator.parse(context);
      }
      else{
        return;
      }
View Full Code Here

Examples of juzu.impl.template.spi.ParseContext

          throw TemplateMetaModel.TEMPLATE_NOT_RESOLVED.failure(path);
        } else {
          TemplateProvider<M> provider = (TemplateProvider<M>)owner.resolveTemplateProvider(path.getExt());
          M templateAST;
          try {
            templateAST = provider.parse(new ParseContext(), resource.getObject().getCharSequence());
          }
          catch (TemplateException e1) {
            throw TemplateMetaModel.TEMPLATE_SYNTAX_ERROR.failure(path).initCause(e1);
          }
          TemplateModel<M> templateModel =  new TemplateModel<M>(
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.ParseContext

      HashMap<String, Task<? extends Serializable>> aliasToTask = new HashMap<String, Task<? extends Serializable>>();
      HashMap<String, String> aliasToPath = new HashMap<String, String>();
      HashMap<String, ArrayList<String>> pathToAliases = currTask.getWork().getPathToAliases();

      // get parseCtx for this Join Operator
      ParseContext parseCtx = physicalContext.getParseContext();
      QBJoinTree joinTree = parseCtx.getJoinContext().get(joinOp);

      // start to generate multiple map join tasks
      JoinDesc joinDesc = joinOp.getConf();
      Byte[] order = joinDesc.getTagOrder();
      int numAliases = order.length;
      try {
        HashSet<Integer> smallTableOnlySet = MapJoinProcessor.getSmallTableOnlySet(joinDesc
            .getConds());
        // no table could be the big table; there is no need to convert
        if (smallTableOnlySet == null) {
          return null;
        }
        currWork.setOpParseCtxMap(parseCtx.getOpParseCtx());
        currWork.setJoinTree(joinTree);

        String xml = currWork.toXML();
        String bigTableAlias = null;

        if(smallTableOnlySet.size() == numAliases) {
          return null;
        }

        for (int i = 0; i < numAliases; i++) {
          // this table cannot be big table
          if (smallTableOnlySet.contains(i)) {
            continue;
          }
          // create map join task and set big table as i
          // deep copy a new mapred work from xml
          InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
          MapredWork newWork = Utilities.deserializeMapRedWork(in, physicalContext.getConf());
          // create a mapred task for this work
          MapRedTask newTask = (MapRedTask) TaskFactory.get(newWork, physicalContext
              .getParseContext().getConf());
          JoinOperator newJoinOp = getJoinOp(newTask);

          // optimize this newWork and assume big table position is i
          bigTableAlias = MapJoinProcessor.genMapJoinOpAndLocalWork(newWork, newJoinOp, i);

          // add into conditional task
          listWorks.add(newWork);
          listTasks.add(newTask);
          newTask.setTaskTag(Task.CONVERTED_MAPJOIN);

          //set up backup task
          newTask.setBackupTask(currTask);
          newTask.setBackupChildrenTasks(currTask.getChildTasks());

          // put the mapping alias to task
          aliasToTask.put(bigTableAlias, newTask);

          // set alias to path
          for (Map.Entry<String, ArrayList<String>> entry : pathToAliases.entrySet()) {
            String path = entry.getKey();
            ArrayList<String> aliasList = entry.getValue();
            if (aliasList.contains(bigTableAlias)) {
              aliasToPath.put(bigTableAlias, path);
            }
          }
        }
      } catch (Exception e) {
        e.printStackTrace();
        throw new SemanticException("Generate Map Join Task Error: " + e.getMessage());
      }

      // insert current common join task to conditional task
      listWorks.add(currTask.getWork());
      listTasks.add(currTask);
      // clear JoinTree and OP Parse Context
      currWork.setOpParseCtxMap(null);
      currWork.setJoinTree(null);

      // create conditional task and insert conditional task into task tree
      ConditionalWork cndWork = new ConditionalWork(listWorks);
      ConditionalTask cndTsk = (ConditionalTask) TaskFactory.get(cndWork, parseCtx.getConf());
      cndTsk.setListTasks(listTasks);

      // set resolver and resolver context
      cndTsk.setResolver(new ConditionalResolverCommonJoin());
      ConditionalResolverCommonJoinCtx resolverCtx = new ConditionalResolverCommonJoinCtx();
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.share.xml.ParseContext

    //{
     //return (List<List<SkinStyleSheetNode>>)cached;
    //}
   
    // Step 5. Set up the new context; first, clone the original
    ParseContext newContext = (ParseContext)context.clone();
   
    // Add the current identifier to the stack (used for detecting circular includes)
    // placed on the ParseContext
    // cloning ParseContext does a shallow copy. It doesn't copy this list.
    if (list == null)
      list = new ArrayList<Object>();
    else
      list = new ArrayList<Object>(list);
    list.add(identifier);
    newContext.setProperty(_SHARE_NAMESPACE, _INCLUDE_STACK, list);
   
    InputStream stream = importProvider.openInputStream();
    try
    {
View Full Code Here

Examples of org.apache.tika.parser.ParseContext

    private String extractTextWithTika(byte[] textBytes, Metadata metadata) throws TikaException, SAXException, IOException {
        AutoDetectParser parser = new AutoDetectParser(new MimeTypes());
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OutputStreamWriter writer = new OutputStreamWriter(baos, "UTF-8");
        ContentHandler handler = new BodyContentHandler(writer);
        ParseContext context = new ParseContext();
        context.set(PDFParserConfig.class, new LumifyParserConfig());
        parser.parse(new ByteArrayInputStream(textBytes), handler, metadata, context);
        return IOUtils.toString(baos.toByteArray(), "UTF-8");
    }
View Full Code Here

Examples of org.apache.tika.parser.ParseContext

          Metadata metadata = new Metadata();
          InputStream is = new ByteArrayInputStream(fetchedDatum.getContentBytes());
         
          try {
            _parser.parse(is, _handler, metadata, new ParseContext());

            // _ids now has a list of the mailbox IDs that we use to create URLs.
            for (String id : _ids) {
              String url = String.format("%s/%s.mbox", fetchedDatum.getUrl(), id);
              UrlDatum datum = new UrlDatum(url);
View Full Code Here

Examples of org.apache.tika.parser.ParseContext

       
        // Now, if the FetchedDatum mime-type is application/mbox, we want to parse it and
        // output the results
        if (fetchedDatum.getContentType().equals("application/mbox")) {
          Metadata metadata = new Metadata();
          ParseContext context = new ParseContext();
          InputStream is = new ByteArrayInputStream(fetchedDatum.getContentBytes());
         
          try {
            _parser.parse(is, _handler, metadata, context);
View Full Code Here

Examples of org.apache.tika.parser.ParseContext

            fetcherPolicy.setFetcherMode(FetcherMode.EFFICIENT);
           
            // We only care about mime types that the Tika HTML parser can handle,
            // so restrict it to the same.
            Set<String> validMimeTypes = new HashSet<String>();
            Set<MediaType> supportedTypes = new HtmlParser().getSupportedTypes(new ParseContext());
            for (MediaType supportedType : supportedTypes) {
                validMimeTypes.add(String.format("%s/%s", supportedType.getType(), supportedType.getSubtype()));
            }
            fetcherPolicy.setValidMimeTypes(validMimeTypes);
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.