Examples of PipelineFactory


Examples of com.fluxcapacitor.core.netty.NettyServer.PipelineFactory

 
    /**
     * Creates a connection to the given host and port
     */
    public Channel buildClient() {
      PipelineFactory pipelinefactory = new ClientPipelineFactory(
          handlers, encoder, decoder);
 
      ChannelFactory nioServer = new NioClientSocketChannelFactory(
          Executors.newCachedThreadPool(),
          Executors.newCachedThreadPool());
View Full Code Here

Examples of net.opentsdb.tsd.PipelineFactory

      tsdb.checkNecessaryTablesExist().joinUninterruptibly();

      registerShutdownHook(tsdb);
      final ServerBootstrap server = new ServerBootstrap(factory);

      server.setPipelineFactory(new PipelineFactory(tsdb));
      if (config.hasProperty("tsd.network.backlog")) {
        server.setOption("backlog", config.getInt("tsd.network.backlog"));
      }
      server.setOption("child.tcpNoDelay",
          config.getBoolean("tsd.network.tcp_no_delay"));
View Full Code Here

Examples of org.apache.xmlgraphics.image.loader.pipeline.PipelineFactory

     * @throws Exception if an error occurs
     */
    public void testPipelineFactoryPlain() throws Exception {
        MockImageContext imageContext = MockImageContext.newSafeInstance();
        ImageManager manager = imageContext.getImageManager();
        PipelineFactory pFactory = new PipelineFactory(manager);

        //Input is some TIFF file
        ImageInfo imageInfo = new ImageInfo("test:tiff", "image/tiff");

        //We want a G2D image
        ImageFlavor targetFlavor = ImageFlavor.GRAPHICS2D;

        ImageProviderPipeline pipeline = pFactory.newImageConverterPipeline(
                imageInfo, targetFlavor);
        assertNotNull(pipeline);
        assertEquals(pipeline.getTargetFlavor(), targetFlavor);

        //penalty for internal TIFF implementation (fallback role) is 1000 + 10 for the conversion
        assertEquals(1010, pipeline.getConversionPenalty());
        assertEquals(ImageFlavor.GRAPHICS2D, pipeline.getTargetFlavor());
        if (pipeline.toString().indexOf("LoaderInternalTIFF") < 0) {
            fail("Chose the wrong pipeline: " + pipeline.toString());
        }
        if (pipeline.toString().indexOf("ImageConverterBitmap2G2D") < 0) {
            fail("Chose the wrong pipeline: " + pipeline.toString());
        }

        ImageProviderPipeline[] candidates = pFactory.determineCandidatePipelines(
                imageInfo, new ImageFlavor[] {targetFlavor});
        assertEquals(1, candidates.length);

        //Now add another implementation that poses as TIFF loader
        imageContext.getImageManager().getRegistry().registerLoaderFactory(
                new MockImageLoaderFactoryTIFF());

        candidates = pFactory.determineCandidatePipelines(
                imageInfo, targetFlavor);
        assertEquals(3, candidates.length);
        //3 because the mock impl provides Buffered- and RenderedImage capabilities

        pipeline = pFactory.newImageConverterPipeline(imageInfo, targetFlavor);
        assertNotNull(pipeline);
        assertEquals(pipeline.getTargetFlavor(), targetFlavor);

        //Assuming mock impl without penalty + 10 for the conversion
        assertEquals(10, pipeline.getConversionPenalty());
View Full Code Here

Examples of org.apache.xmlgraphics.image.loader.pipeline.PipelineFactory

     * @throws Exception if an error occurs
     */
    public void testPipelineFactoryImageInfoDependency() throws Exception {
        MockImageContext imageContext = MockImageContext.newSafeInstance();
        ImageManager manager = imageContext.getImageManager();
        PipelineFactory pFactory = new PipelineFactory(manager);

        //Input is some TIFF file with CCITT Group 4 compression
        ImageInfo imageInfo = new ImageInfo("test:tiff", "image/tiff");
        imageInfo.getCustomObjects().put("TIFF_STRIP_COUNT", new Integer(1));
        imageInfo.getCustomObjects().put("TIFF_COMPRESSION", new Integer(TIFFImage.COMP_FAX_G4_2D));

        //We want either a G2D image or a raw CCITT image
        ImageFlavor[] targetFlavors = new ImageFlavor[] {
                ImageFlavor.GRAPHICS2D, ImageFlavor.RAW_CCITTFAX};

        ImageProviderPipeline[] candidates = pFactory.determineCandidatePipelines(
                imageInfo, targetFlavors);
        assertNotNull(candidates);
        assertEquals(2, candidates.length);

        ImageProviderPipeline pipeline = manager.choosePipeline(candidates);

        //0 penalty because the raw loader is the most efficient choice here
        assertEquals(0, pipeline.getConversionPenalty());
        assertEquals(ImageFlavor.RAW_CCITTFAX, pipeline.getTargetFlavor());
        if (pipeline.toString().indexOf("LoaderRawCCITTFax") < 0) {
            fail("Chose the wrong pipeline: " + pipeline.toString());
        }

        //Now, we set this to a multi-strip TIFF which should disable the raw loader
        imageInfo.getCustomObjects().put("TIFF_STRIP_COUNT", new Integer(7));

        candidates = pFactory.determineCandidatePipelines(
                imageInfo, targetFlavors);
        assertNotNull(candidates);
        assertEquals(1, candidates.length);

        pipeline = manager.choosePipeline(candidates);
View Full Code Here

Examples of org.apache.xmlgraphics.image.loader.pipeline.PipelineFactory

     * @throws Exception if an error occurs
     */
    public void testPipelineFactoryAdditionalPenalty() throws Exception {
        MockImageContext imageContext = MockImageContext.newSafeInstance();
        ImageManager manager = imageContext.getImageManager();
        PipelineFactory pFactory = new PipelineFactory(manager);

        //Adding additional penalty for CCITT loading
        ImageImplRegistry registry = imageContext.getImageManager().getRegistry();
        registry.setAdditionalPenalty(ImageLoaderRawCCITTFax.class.getName(),
                Penalty.toPenalty(10000));

        //Input is some TIFF file with CCITT Group 4 compression
        ImageInfo imageInfo = new ImageInfo("test:tiff", "image/tiff");
        imageInfo.getCustomObjects().put("TIFF_STRIP_COUNT", new Integer(1));
        imageInfo.getCustomObjects().put("TIFF_COMPRESSION", new Integer(TIFFImage.COMP_FAX_G4_2D));

        //We want either a G2D image or a raw CCITT image
        ImageFlavor[] targetFlavors = new ImageFlavor[] {
                ImageFlavor.GRAPHICS2D, ImageFlavor.RAW_CCITTFAX};

        ImageProviderPipeline[] candidates = pFactory.determineCandidatePipelines(
                imageInfo, targetFlavors);
        assertNotNull(candidates);
        assertEquals(2, candidates.length);

        ImageProviderPipeline pipeline = manager.choosePipeline(candidates);

        //penalty for internal TIFF implementation (fallback role) is 1000 + 10 for the conversion
        assertEquals(1010, pipeline.getConversionPenalty());
        assertEquals(ImageFlavor.GRAPHICS2D, pipeline.getTargetFlavor());
        if (pipeline.toString().indexOf("LoaderInternalTIFF") < 0) {
            fail("Chose the wrong pipeline: " + pipeline.toString());
        }
        if (pipeline.toString().indexOf("ImageConverterBitmap2G2D") < 0) {
            fail("Chose the wrong pipeline: " + pipeline.toString());
        }

        //Now set an infinite penalty making the solution ineligible
        registry.setAdditionalPenalty(ImageLoaderRawCCITTFax.class.getName(),
                Penalty.INFINITE_PENALTY);

        candidates = pFactory.determineCandidatePipelines(imageInfo, targetFlavors);
        assertNotNull(candidates);
        assertEquals(1, candidates.length);
        //While earlier 2 candidates were returned, here we only get 1 because of the infinite
        //penalty.
    }
View Full Code Here

Examples of org.crsh.lang.impl.script.PipeLineFactory

  public CommandInvoker<?, ?> resolve(String s) throws CommandException {
    CRaSHSession session = (CRaSHSession)getSession();
    Token token2 = Token.parse(s);
    try {
      PipeLineFactory factory = token2.createFactory();
      return factory.create(session);
    }
    catch (CommandNotFoundException e) {
      throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e);
    }
  }
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.