Examples of Generator


Examples of org.apache.flex.forks.velocity.texen.Generator

            }
           
            ve.init();

            // Create the text generator.
            Generator generator = Generator.getInstance();
            generator.setVelocityEngine(ve);
            generator.setOutputPath(outputDirectory);
            generator.setInputEncoding(inputEncoding);
            generator.setOutputEncoding(outputEncoding);

            if (templatePath != null)
            {
                generator.setTemplatePath(templatePath);
            }
           
            // Make sure the output directory exists, if it doesn't
            // then create it.
            File file = new File(outputDirectory);
            if (! file.exists())
            {
                file.mkdirs();
            }
           
            String path = outputDirectory + File.separator + outputFile;
            log("Generating to file " + path, project.MSG_INFO);
            Writer writer = generator.getWriter(path, outputEncoding);
           
            // The generator and the output path should
            // be placed in the init context here and
            // not in the generator class itself.
            Context c = initControlContext();
           
            // Everything in the generator class should be
            // pulled out and placed in here. What the generator
            // class does can probably be added to the Velocity
            // class and the generator class can probably
            // be removed all together.
            populateInitialContext(c);
           
            // Feed all the options into the initial
            // control context so they are available
            // in the control/worker templates.
            if (contextProperties != null)
            {
                Iterator i = contextProperties.getKeys();
       
                while (i.hasNext())
                {
                    String property = (String) i.next();
                    String value = contextProperties.getString(property);
                   
                    // Now lets quickly check to see if what
                    // we have is numeric and try to put it
                    // into the context as an Integer.
                    try
                    {
                        c.put(property, new Integer(value));
                    }
                    catch (NumberFormatException nfe)
                    {
                        // Now we will try to place the value into
                        // the context as a boolean value if it
                        // maps to a valid boolean value.
                        String booleanString =
                            contextProperties.testBoolean(value);
                       
                        if (booleanString != null)
                        {   
                            c.put(property, new Boolean(booleanString));
                        }
                        else
                        {
                            // We are going to do something special
                            // for properties that have a "file.contents"
                            // suffix: for these properties will pull
                            // in the contents of the file and make
                            // them available in the context. So for
                            // a line like the following in a properties file:
                            //
                            // license.file.contents = license.txt
                            //
                            // We will pull in the contents of license.txt
                            // and make it available in the context as
                            // $license. This should make texen a little
                            // more flexible.
                            if (property.endsWith("file.contents"))
                            {
                                // We need to turn the license file from relative to
                                // absolute, and let Ant help :)
                                value = StringUtils.fileContentsToString(  
                                    project.resolveFile(value).getCanonicalPath());
                           
                                property = property.substring(
                                    0, property.indexOf("file.contents") - 1);
                            }
                       
                            c.put(property, value);
                        }
                    }
                }
            }
           
            writer.write(generator.parse(controlTemplate, c));
            writer.flush();
            writer.close();
            generator.shutdown();
            cleanup();
        }
        catch( BuildException e)
        {
            throw e;
View Full Code Here

Examples of org.apache.flink.runtime.operators.testutils.TestData.Generator

 
  @Test
  public void testMerge() {
    try {
     
      final TestData.Generator generator1 = new Generator(SEED1, 500, 4096, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);
      final TestData.Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);

      final TestData.GeneratorIterator input1 = new TestData.GeneratorIterator(generator1, INPUT_1_SIZE);
      final TestData.GeneratorIterator input2 = new TestData.GeneratorIterator(generator2, INPUT_2_SIZE);
     
      // collect expected data
      final Map<TestData.Key, Collection<Match>> expectedMatchesMap = matchValues(
        collectData(input1),
        collectData(input2));
     
      final JoinFunction matcher = new MatchRemovingMatcher(expectedMatchesMap);
     
      final Collector<Record> collector = new DiscardingOutputCollector<Record>();
 
      // reset the generators
      generator1.reset();
      generator2.reset();
      input1.reset();
      input2.reset();
 
      // compare with iterator values
      MergeMatchIterator<Record, Record, Record> iterator =
View Full Code Here

Examples of org.apache.hadoop.hive.ql.optimizer.lineage.Generator

   * @param hiveConf
   */
  public void initialize(HiveConf hiveConf) {
    transformations = new ArrayList<Transform>();
    // Add the transformation that computes the lineage information.
    transformations.add(new Generator());
    if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEOPTCP)) {
      transformations.add(new ColumnPruner());
    }
    if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEOPTPPD)) {
      transformations.add(new PredicateTransitivePropagate());
View Full Code Here

Examples of org.apache.log4j.chainsaw.Generator

      setText(o.toString());
      setIcon(null);
     }else if(o instanceof Plugin){
       setText(((Plugin)o).getName());
     }else if(o instanceof Generator){
      Generator generator = (Generator) o;
      setText(generator.getName());
      setIcon(ChainsawIcons.ICON_HELP);
    }
    else {
      setText("(Unknown Type) :: " + o);
    }
View Full Code Here

Examples of org.apache.maven.tools.plugin.generator.Generator

            PluginUtils.sortMojoParameters( mojoDescriptor.getParameters() );

            request.getPluginDescriptor().addMojo( mojoDescriptor );
        }

        Generator descriptorGenerator = new PluginDescriptorGenerator();

        descriptorGenerator.execute( new File( root, directory ), request );

        return request.getPluginDescriptor();
    }
View Full Code Here

Examples of org.apache.nutch.crawl.Generator

    //inject
    Injector injector=new Injector(conf);
    injector.inject(crawldbPath, urlPath);

    //generate
    Generator g=new Generator(conf);
    Path[] generatedSegment = g.generate(crawldbPath, segmentsPath, 1,
        Long.MAX_VALUE, Long.MAX_VALUE, false, false);

    long time=System.currentTimeMillis();
    //fetch
    Fetcher fetcher=new Fetcher(conf);
View Full Code Here

Examples of org.apache.openjpa.persistence.Generator

    }

    public void testSequence() {
        OpenJPAEntityManager pm = getPM();
        startTx(pm);
        Generator seq = pm.getIdGenerator(AImplB.class);
        assertNotNull(seq);
        Number val = (Number) seq.next();
        assertNotNull(val);
        AImplB aib = new AImplB("x", val.intValue(), "y");
        pm.persist(aib);

        for (int i = 0; i < 100; i++)
View Full Code Here

Examples of org.apache.texen.Generator

            }

            ve.init();

            // Create the text generator.
            Generator generator = Generator.getInstance();
            generator.setVelocityEngine(ve);
            generator.setOutputPath(outputDirectory);
            generator.setInputEncoding(inputEncoding);
            generator.setOutputEncoding(outputEncoding);

            if (templatePath != null)
            {
                generator.setTemplatePath(templatePath);
            }

            // Make sure the output directory exists, if it doesn't
            // then create it.
            File file = new File(outputDirectory);
            if (! file.exists())
            {
                file.mkdirs();
            }

            String path = outputDirectory + File.separator + outputFile;
            log("Generating to file " + path, Project.MSG_INFO);
            Writer writer = generator.getWriter(path, outputEncoding);

            // The generator and the output path should
            // be placed in the init context here and
            // not in the generator class itself.
            Context c = initControlContext();

            // Everything in the generator class should be
            // pulled out and placed in here. What the generator
            // class does can probably be added to the Velocity
            // class and the generator class can probably
            // be removed all together.
            populateInitialContext(c);

            // Feed all the options into the initial
            // control context so they are available
            // in the control/worker templates.
            if (contextProperties != null)
            {
                Iterator i = contextProperties.getKeys();

                while (i.hasNext())
                {
                    String property = (String) i.next();
                    String value = StringUtils.nullTrim(contextProperties.getString(property));

                    // Now lets quickly check to see if what
                    // we have is numeric and try to put it
                    // into the context as an Integer.
                    try
                    {
                        c.put(property, new Integer(value));
                    }
                    catch (NumberFormatException nfe)
                    {
                        // Now we will try to place the value into
                        // the context as a boolean value if it
                        // maps to a valid boolean value.
                        String booleanString =
                            contextProperties.testBoolean(value);

                        if (booleanString != null)
                        {
                            c.put(property, Boolean.valueOf(booleanString));
                        }
                        else
                        {
                            // We are going to do something special
                            // for properties that have a "file.contents"
                            // suffix: for these properties will pull
                            // in the contents of the file and make
                            // them available in the context. So for
                            // a line like the following in a properties file:
                            //
                            // license.file.contents = license.txt
                            //
                            // We will pull in the contents of license.txt
                            // and make it available in the context as
                            // $license. This should make texen a little
                            // more flexible.
                            if (property.endsWith("file.contents"))
                            {
                                // We need to turn the license file from relative to
                                // absolute, and let Ant help :)
                                value = StringUtils.fileContentsToString(
                                    project.resolveFile(value).getCanonicalPath());

                                property = property.substring(
                                    0, property.indexOf("file.contents") - 1);
                            }

                            c.put(property, value);
                        }
                    }
                }
            }

            writer.write(generator.parse(controlTemplate, c));
            writer.flush();
            writer.close();
            generator.shutdown();
            cleanup();
        }
        catch( BuildException e)
        {
            throw e;
View Full Code Here

Examples of org.apache.velocity.texen.Generator

                File groupDir = new File(groupDirName);
                if (!groupDir.exists()) groupDir.mkdirs();
            }
           
            // Generate files: execute control template
            Generator generator = Generator.getInstance();
            generator.setVelocityEngine(engine);
            generator.setOutputEncoding("UTF-8");
            generator.setInputEncoding("UTF-8");
            generator.setOutputPath(outputDir);
            generator.setTemplatePath(templateDir);
            generator.parse(mainPage, context);
            generator.shutdown();
           
        } catch (Exception e) {
            log.error("ERROR generating planet", e);
        }
    }
View Full Code Here

Examples of org.apache.ws.jaxme.generator.Generator

    isource.setSystemId(pSystemId);
    return r.parse(isource);
  }

  protected JAXBSchemaReader getSchemaReader() {
      Generator generator = new GeneratorImpl();
      JAXBSchemaReader r = new JAXBSchemaReader();
      generator.setSchemaReader(r);
      r.setGenerator(generator);
      return r;
  }
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.