Package org.apache.shindig.gadgets.spec

Examples of org.apache.shindig.gadgets.spec.PipelinedData$Batch


    control.verify();
  }

  @Test
  public void executePreloadException() throws Exception {
    PipelinedData pipeline = getPipelinedData(CONTENT);
    final PreloadedData willThrow = control.createMock(PreloadedData.class);

    Callable<PreloadedData> callable = new Callable<PreloadedData>() {
      public PreloadedData call() throws Exception {
        return willThrow;
View Full Code Here


    setupGadget(getGadgetXml(contentWithDataRequest));
    Map<PipelinedData, ? extends Object> pipelines =
        rewriter.parsePipelinedData(gadget, content.getDocument());
    assertEquals(1, pipelines.size());
    PipelinedData pipeline = pipelines.keySet().iterator().next();
    PipelinedData.Batch batch = pipeline.getBatch(Expressions.forTesting(), new RootELResolver());
    Map<String, PipelinedData.BatchItem> preloads = batch.getPreloads();
    assertTrue(preloads.containsKey("me"));
    assertEquals(PipelinedData.BatchType.SOCIAL, preloads.get("me").getType());

    JsonAssert.assertObjectEquals(
View Full Code Here

  Map<PipelinedData, Node> parsePipelinedData(Gadget gadget, Document doc) {
    List<Element> dataTags = SocialDataTags.getTags(doc, SocialDataTags.OSML_DATA_TAG);
    Map<PipelinedData, Node> pipelineNodes = Maps.newHashMap();
    for (Element n : dataTags) {
      try {
        PipelinedData pipelineData = new PipelinedData(n, gadget.getSpec().getUrl());
        pipelineNodes.put(pipelineData, n);
      } catch (SpecParserException e) {
        // Leave the element to the client
        if (LOG.isLoggable(Level.INFO)) {
          LOG.logp(Level.INFO, classname, "parsePipelinedData", MessageKeys.FAILED_TO_PARSE_PRELOAD, new Object[] {gadget.getSpec().getUrl()});
View Full Code Here

   */
  protected HttpRequest createPipelinedProxyRequest(Gadget gadget, HttpRequest original) {
    HttpRequest request = new HttpRequest(original);
    request.setIgnoreCache(true);

    PipelinedData data = gadget.getCurrentView().getPipelinedData();
    if (data != null) {
      PipelineExecutor.Results results =
        pipelineExecutor.execute(gadget.getContext(), ImmutableList.of(data));

      if (results != null && !results.results.isEmpty()) {
View Full Code Here

  Map<PipelinedData, Node> parsePipelinedData(Gadget gadget, Document doc) {
    List<Element> dataTags = SocialDataTags.getTags(doc, SocialDataTags.OSML_DATA_TAG);
    Map<PipelinedData, Node> pipelineNodes = Maps.newHashMap();
    for (Element n : dataTags) {
      try {
        PipelinedData pipelineData = new PipelinedData(n, gadget.getSpec().getUrl());
        pipelineNodes.put(pipelineData, n);
      } catch (SpecParserException e) {
        // Leave the element to the client
        LOG.log(Level.INFO, "Failed to parse preload in " + gadget.getSpec().getUrl(), e);
      }
View Full Code Here

   */
  private HttpRequest createPipelinedProxyRequest(Gadget gadget, HttpRequest original) {
    HttpRequest request = new HttpRequest(original);
    request.setIgnoreCache(true);

    PipelinedData data = gadget.getCurrentView().getPipelinedData();
    if (data != null) {
      PipelineExecutor.Results results =
        pipelineExecutor.execute(gadget.getContext(), ImmutableList.of(data));

      if (results != null && !results.results.isEmpty()) {
View Full Code Here

            @Override
            public Void withHandle(Handle handle) throws Exception
            {
              if (!tableExists(handle, tableName)) {
                log.info("Creating table[%s]", tableName);
                final Batch batch = handle.createBatch();
                for(String s : sql) {
                  batch.add(s);
                }
                batch.execute();
              } else {
                log.info("Table[%s] already exists", tableName);
              }
              return null;
            }
View Full Code Here

          new HandleCallback<Void>()
          {
            @Override
            public Void withHandle(Handle handle) throws Exception
            {
              Batch batch = handle.createBatch();

              for (DataSegment segment : segments) {
                batch.add(
                    String.format(
                        "UPDATE %s SET used=true WHERE id = '%s'",
                        getSegmentsTable(),
                        segment.getIdentifier()
                    )
                );
              }
              batch.execute();

              return null;
            }
          }
      );
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.spec.PipelinedData$Batch

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.