Package org.jostraca.util

Examples of org.jostraca.util.PropertySet




  public void testPerform() throws Exception {
    TemplateActionHandlerStub tahs  = new TemplateActionHandlerStub();
    PropertySet               ps    = new PropertySet();
    ps.load( Tools.findRelativeSystemPath( "conf/system.conf" ) );
    TextualTransformManagerTable   ttmt = new TextualTransformManagerTable( ps );

    BasicUnitList bul = new BasicUnitList();

    SectionDirective sd = new SectionDirective();
View Full Code Here


  /** Load lang PropertySet based on lang code.
   *  Return an empty property set if not found.
   *  @param pLangCode Used to find file in lang config folder: lang.conf
   */
  private PropertySet loadLangPropertySet( String pLangCode, PropertySet pPropertySet ) {
    PropertySet langPS           = new PropertySet();

    // FIX: need a decoupled way to access config as may not have file system!

    String configFolder     = pPropertySet.get( Property.jostraca_ConfigFolder );
    File   langPropFilePath = new File( configFolder, buildLangConfigFileName( pLangCode ) );
View Full Code Here


  protected void compileAsFirst( List pTemplateList ) {
    List        tmlist  = pTemplateList;
    Template    firsttm = (Template) pTemplateList.get(0);
    PropertySet tmps    = firsttm.getMergedPropertySet();

    StringBuffer sourceFilesB = new StringBuffer( tmlist.size() * 33 );
    boolean      compile      = makeCompileList( tmlist, sourceFilesB );
    String       sourceFiles  = sourceFilesB.toString();

    // space out dots to avoid accidental replace on System DOT out search
    PrintStream sysOut = System . out;
    PrintStream sysErr = System . err;

    if( compile ) {
      try {
        String compilerOpts = tmps.get( Property.main_ExternalCompilerOptions );

        if( !JavaUtil.hasClassPathArg(compilerOpts) ) {
          compilerOpts
            = JavaUtil.ARG_classpath + Standard.SPACE
            + JavaUtil.makeClassPath( tmps )
View Full Code Here

  }


  public void process( Template pTemplate ) {
    Template    template   = pTemplate;
    PropertySet tmps       = template.getMergedPropertySet();

    // FIX: need to elaborate on this!
    boolean     execute    = !tmps.isNo( Property.main_ExecuteCodeWriter );

    if( execute ) {
      super.process( pTemplate );

      PropertySet ps = pTemplate.getPropertySet( Constants.CONF_override );
      List sf = pTemplate.getSavedFiles();
      ps.set( Property.jostraca_GeneratedFiles, TextUtil.array2text( sf.toArray(new String[sf.size()]), Standard.COMMA ) );

      recordBuildResources( pTemplate );
      MetaUtil.saveMetaData( pTemplate );
    }
  }
View Full Code Here

  }


  protected void processImpl( Template pTemplate ) {
    Template    template   = pTemplate;
    PropertySet tmps       = template.getMergedPropertySet();

    File   codeWriterPath   = template.getCodeWriterPath();
    String codeWriterSource = template.getCodeWriterSource();

    try {
      String externalController        = makeExternalController( tmps );
      String externalControllerOptions = tmps.get( Property.main_ExternalControllerOptions );
      String absoluteCodeWriterPath    = TextUtil.quote(getCodeWriterPath( tmps ));

      String codeWriterOptions = makeCodeWriterOptions( tmps, template );

      // FIX: why use absolute controller path since compile does not?

      String cmd = Standard.EMPTY;
      boolean cwic = tmps.isYes( Property.main_CodeWriterIsController );

      cmd += ( externalController + Standard.SPACE + externalControllerOptions + Standard.SPACE );
    
      if( !cwic ) {
        cmd += absoluteCodeWriterPath;
View Full Code Here

  private void recordBuildResources( Template pTemplate ) {
    try {
      RootBuildResource rbr = (RootBuildResource) pTemplate.getBuildResource();
      //t.track( "recordBuildResources.PrefixOperatorFiles", pPropertySet.get( Property.jostraca_PrefixOperatorFiles ) );
      PropertySet ps = pTemplate.getMergedPropertySet();

      // handle PrefixOperatorPSM files
      String[] psmfiles = ps.getList( Property.jostraca_PrefixOperatorFiles, Standard.COMMA );
      int      numPF    = psmfiles.length;
      String[] genfiles = ps.getList( Property.jostraca_GeneratedFiles,      Standard.COMMA );
      int      numGF    = genfiles.length;
      for( int pfI = 0; pfI < numPF; pfI++ ) {
        for( int gfI = 0; gfI < numGF; gfI++ ) {
          FileBuildResource fbr = new FileBuildResource( new File( psmfiles[pfI] ), new File( genfiles[gfI] ) );
          rbr.add( fbr );
View Full Code Here

        BuildResource br = (BuildResource) brL.get( brI );
        if( br instanceof RootBuildResource ) {
          recordBuildResources( pTemplate, (RootBuildResource)br, pPreviouslySeen );
        }
        else if( br instanceof FileBuildResource ) {
          PropertySet       ps           = pTemplate.getMergedPropertySet();
          FileBuildResource fbr          = (FileBuildResource) br;
          String            existing_fbr = ps.get( Property.jostraca_FileBuildResources );
          String            file         = fbr.getEarlier().getAbsolutePath();
          if( !pPreviouslySeen.containsKey( file ) ) {
            PropertySet ops = pTemplate.getPropertySet( Constants.CONF_override );
            ops.set( Property.jostraca_FileBuildResources,
                     existing_fbr + (Standard.EMPTY.equals(existing_fbr) ? Standard.EMPTY : Standard.COMMA) + file );
            pPreviouslySeen.put( file, file );
          }
        }
      }
View Full Code Here

  }



  public void testCreate() throws Exception {
    PropertySet                 ps   = new PropertySet();
    ps.load( new File( "../../../../conf/system.conf" ) );
    TemplateActionHandler          tah  = new TemplateActionHandlerStub();
    BasicDirectiveElementProcessor bdep = create( ps, tah );
  }
View Full Code Here

  }


  public void testProcessDirective() throws Exception {
    TemplateActionHandlerStub tahs  = new TemplateActionHandlerStub();
    PropertySet               ps    = new PropertySet();
    ps.load( new File( "../../../../conf/system.conf" ) );
    BasicDirectiveElementProcessor bdep = create( ps, tahs );

    tahs.clear();
    String s01 = "foo = bar;";
    Block  b01 = new Block( Block.TYPE_script, s01 );
View Full Code Here

  }


  protected void processImpl( Template pTemplate ) {
    Template    template   = pTemplate;
    PropertySet tmps       = template.getMergedPropertySet();

    boolean     successful = false;
    PrintStream sysOut     = null;
    PrintStream sysErr     = null;
    RecordingUserMessageHandler rumh = new RecordingUserMessageHandler();

    try {
      String   cw   = tmps.get( Property.main_CodeWriter );
      String   cwo  = makeCodeWriterOptions( tmps, template );
      String[] args = ArgUtil.splitQuoted( cwo );
      String   cwp  = getCodeWriterPath( tmps );

      Properties jythonProps = new Properties();
      jythonProps.put( "python.home", tmps.get("jython.home") );
      PythonInterpreter.initialize( System.getProperties(), jythonProps, args );

      PyStringMap       dict  = new PyStringMap();
      PySystemState     pysys = new PySystemState();
      PythonInterpreter pi    = new PythonInterpreter( dict, pysys );
View Full Code Here

TOP

Related Classes of org.jostraca.util.PropertySet

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.