Examples of BoostFunction


Examples of project.gluebooster.math.functions.BoostFunction

  
   
   
    //("XML->String");
   
    BoostFunction root = FunctionFactory.identity();
    BoostFunction xmlToSource = new XMLFunctions(XMLFunctions.Operation.toSource)
   
    graph.addEdges(root, xmlToSource);

    BoostFunction outputStream = new FunctionByTransformer( new TransformerWithInstanceCreation<Object, ByteArrayOutputStream>(ByteArrayOutputStream.class));
    graph.addEdges(root, outputStream);
   
    BoostFunction encoding = new FunctionByTransformer( TransformerBoostUtils.createConstantTransformer("encoding",xmlResultEncoding));
    graph.addEdges(root, encoding);

    BoostFunction omitProcessingInstruction = new FunctionByTransformer( TransformerBoostUtils.createConstantTransformer("omit processing instruction", ! displayXMLDeclaration));
    graph.addEdges(root, omitProcessingInstruction);
   
    BoostFunction writer = new FunctionByTransformer( new SourceToOutputStreamWriter());
    graph.addEdges( xmlToSource, writer);
    graph.addEdges( outputStream, writer);
    graph.addEdges( encoding, writer);
    graph.addEdges( omitProcessingInstruction, writer);

    BoostFunction toByteArray = new CollectionFunctions(CollectionFunctions.Operation.toByteArray);
    graph.addEdges( writer, toByteArray);
   
   
    BoostFunction toString = new StringFunctions(StringFunctions.Operation.byteArrayToString);
    graph.addEdges( toByteArray, toString);//TODO not correct use a combining node
    graph.addEdges( encoding, toString);
   
    FunctionByEventsourceGraph<Tag, String> result = new FunctionByEventsourceGraph(graph, root, toString);
    return result;
View Full Code Here

Examples of project.gluebooster.math.functions.BoostFunction

    result.setName(DISPLAY_COMPONENT);
   
    DefaultGraphForFunctionByEventsourceGraph graph = new DefaultGraphForFunctionByEventsourceGraph();

   
    BoostFunction getTagBeansXML1 = ReflectionFunctions.createInvokeMethod("text");
    BoostFunction getTagBeansXML =  FunctionFactory.concatenation( getTagBeansXML1,
                                                                   new StringFunctions(StringFunctions.Operation.replace, "</beans>" , "<bean id=\"appletArchiveDir\" class=\"project.gluebooster.text.StringBean\"><property name=\"append\" value=\""+ getFilename(APPLET_ARCHIVE_DIR)+"\"/></bean> <bean id=\"appletCodebaseDir\" class=\"project.gluebooster.text.StringBean\"><property name=\"append\" value=\""+ getFilename(APPLET_CODEBASE_DIR)+"\"/></bean> </beans>")
                                    );
   

   
    BoostFunction toBeanFactory = new SpringContextFunctions(SpringContextFunctions.Operation.toBeanFactory );
    graph.addEdges(getTagBeansXML, toBeanFactory);
    //1: get the archive text
   
    BoostFunction archiveText = new SpringContextFunctions(SpringContextFunctions.Operation.getBean, "archive");
    BoostFunction nullToEmptyString = new StringFunctions(StringFunctions.Operation.nullToEmptyString);
    BoostFunction prependGlueboosterArchives = new StringFunctions(StringFunctions.Operation.prepend, ",project/gluebooster/java/javaBooster/0.4/javaBooster-0.4.jar,jung/jung-api/2.0/jung-api-2.0.jar,jung/jung-graph-impl/2.0/jung-graph-impl-2.0.jar,commons-collections/collections-generic/4.01/collections-generic-4.01.jar,org/springframework/spring/2.5.5/spring-2.5.5.jar,jung/jung-algorithms/2.0/jung-algorithms-2.0.jar,jung/jung-visualization/2.0/jung-visualization-2.0.jar,commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar,commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar,commons-lang/commons-lang/2.3/commons-lang-2.3.jar,org/codehaus/groovy/groovy-all/1.5.7/groovy-all-1.5.7.jar,com/sun/tools/1.6.0/tools-1.6.0.jar,");
    BoostFunction addArchiveDir =  new StringFunctions(StringFunctions.Operation.replace, "," , ",\"+ parent.appletArchiveDir + \"/");
    BoostFunction asIndex0 = ToPairFunction.createWithFirstConstant(Integer.valueOf(0));
    graph.addEdges(toBeanFactory, archiveText, nullToEmptyString, prependGlueboosterArchives,addArchiveDir, asIndex0);
   
    //2 encode the bean xml
    BoostFunction escapeHtml = new StringFunctions( StringFunctions.Operation.escapeHtml);
    BoostFunction asIndex1 = ToPairFunction.createWithFirstConstant(Integer.valueOf(3));
    graph.addEdges(getTagBeansXML, escapeHtml, asIndex1, new StandardFunctions(StandardFunctions.Operation.constant,""));

    //3: get width
    BoostFunction width = new SpringContextFunctions(SpringContextFunctions.Operation.getBean, "width");
    BoostFunction nullToEmptyString2 = new StringFunctions(StringFunctions.Operation.nullToEmptyString);
    BoostFunction asIndex2 = ToPairFunction.createWithFirstConstant(Integer.valueOf(1));
    graph.addEdges(toBeanFactory, width, nullToEmptyString2, asIndex2);
   
    //4: get height
    BoostFunction height = new SpringContextFunctions(SpringContextFunctions.Operation.getBean, "height");
    BoostFunction nullToEmptyString3 = new StringFunctions(StringFunctions.Operation.nullToEmptyString);
    BoostFunction asIndex3 = ToPairFunction.createWithFirstConstant(Integer.valueOf(2));
    graph.addEdges(toBeanFactory, height, nullToEmptyString3, asIndex3);
   
    //combine
    ListAssemblingFunctionWithIndices toList = new ListAssemblingFunctionWithIndices(4, "as list");
    graph.addEdge(asIndex0, toList);
    graph.addEdge(asIndex1, toList);
    graph.addEdge(asIndex2, toList);
    graph.addEdge(asIndex3, toList);
    BoostFunction concatenation = new StringFunctions( StringFunctions.Operation.concatenate, getArchiveDirJavascript() + APPLET_JAVASCRIPT_1    
         ,null, APPLET_JAVASCRIPT_2 , "' width='", null, "' height='", null, "'><param NAME='beans' value=\"", null, "\"/></applet>");   
    graph.addEdge(toList, concatenation);
   
    FunctionByEventsourceGraph<Tag, String> function = new FunctionByEventsourceGraph(graph, getTagBeansXML, concatenation);
  
View Full Code Here

Examples of project.gluebooster.math.functions.BoostFunction

   
    DefaultGraphForFunctionByEventsourceGraph graph = new DefaultGraphForFunctionByEventsourceGraph();
   
    BoostFunction<Tag, Tag, Object> startNode = new StandardFunctions(StandardFunctions.Operation.identity);//("start with Tag");
   
    BoostFunction getTagBeansXML = ReflectionFunctions.createInvokeMethod("text");
    BoostFunction toBeanFactory = new SpringContextFunctions(SpringContextFunctions.Operation.toBeanFactory );
    graph.addEdges(startNode, getTagBeansXML, toBeanFactory);
   
    // get resource content
    BoostFunction resource = new SpringContextFunctions(SpringContextFunctions.Operation.getBean, "resource");
    BoostFunction asIndex0 = ToPairFunction.createWithFirstConstant(Integer.valueOf(0));
    graph.addEdges(toBeanFactory, resource, asIndex0);
   
    // get resource name
    BoostFunction name = new SpringContextFunctions(SpringContextFunctions.Operation.getBean, "name");
    BoostFunction asPathIndex1 = ToPairFunction.createWithFirstConstant(Integer.valueOf(1));
    graph.addEdges(toBeanFactory, name, asPathIndex1);

    //get resource path
    BoostFunction<Tag, Doc, Object> getHolder = ReflectionFunctions.createInvokeMethod("holder");
    BoostFunction<Doc, PackageDoc, Object> getHolderPackage = ReflectionFunctions.createInvokeMethod("containingPackage");
    BoostFunction<PackageDoc, String, Object> getHolderPackageName = ReflectionFunctions.createInvokeMethod("name");
    BoostFunction replaceSeparators = new StringFunctions(StringFunctions.Operation.replace, ".", "/");
    BoostFunction concatenatePath = new StringFunctions( StringFunctions.Operation.prepend, JavadocContext.getSingleton().getConfiguration().docFileDestDirName );   
    BoostFunction asPathIndex0 = ToPairFunction.createWithFirstConstant(Integer.valueOf(0));
   
    graph.addEdges(startNode, getHolder, getHolderPackage, getHolderPackageName, replaceSeparators, concatenatePath, asPathIndex0);

    //combine path
    ListAssemblingFunctionWithIndices toPathList = new ListAssemblingFunctionWithIndices(2);
    graph.addEdge(asPathIndex0, toPathList);
    graph.addEdge(asPathIndex1, toPathList);

    BoostFunction pathConcatenation = new StringFunctions( StringFunctions.Operation.concatenate, null, "/doc-files/", null);   
    graph.addEdge(toPathList, pathConcatenation);
   
    BoostFunction asIndex1 = ToPairFunction.createWithFirstConstant(Integer.valueOf(1));
    graph.addEdge(pathConcatenation, asIndex1);

   
    //combine
    ListAssemblingFunctionWithIndices toList = new ListAssemblingFunctionWithIndices(2);
    graph.addEdge(asIndex0, toList);
    graph.addEdge(asIndex1, toList);

    //Map writer = new StringFunctions( StringFunctions.Operation.concatenate, "content ", null, " filename ", null);   
    BoostFunction writer = new IOFunctions( IOFunctions.Operation.write);
    graph.addEdge(toList, writer);
   
    //write inputStream to doc-files/name
    FunctionByEventsourceGraph<Tag, String> function = new FunctionByEventsourceGraph(graph, startNode, writer);
  
View Full Code Here

Examples of project.gluebooster.math.functions.BoostFunction

{

  public void testCreateChildrenFilteringTreeNode() throws Exception
  {
    TreeNode rootNode = SampleTreeFactory.createSampleTree1();
    BoostFunction/*<String, Boolean>*/ leafFilter = new ReflectionFunctions(ReflectionFunctions.Operation.invokeMethod, "equals", "a");
   
    
   
    TreeNode newRootNode = TreeNodeFactory.createChildrenFilteringTreeNode(rootNode, FunctionFactory.concatenation(/*<TreeNode, Boolea*/ new ReflectionFunctions(ReflectionFunctions.Operation.invokeMethod/*<ComputedTreeNode<File>, File>(*/,"getUserObject"), leafFilter), new InvocationContext());
    //only the a leaf is resulting, no other leafs or folder should be present
View Full Code Here

Examples of project.gluebooster.math.functions.BoostFunction

public class TestGlueboosterTaglets extends TestCase
{
   public void testCreateDisplayComponentTaglet() throws Exception
   {
     TagletByFunction taglet = (TagletByFunction) GlueboosterTaglets.createDisplayComponentTaglet();
     BoostFunction function = taglet.getFunction();
    
     MockObject tag = new MockObject();
     tag.setText("    <beans xmlns=\"http://www.springframework.org/schema/beans\"\n"+
"       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"+
"       xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd\"\n"+
"    >\n"+
"    <!-- Konfigurationsabschnitte bitte den entsprechenden Abschnitt auskommentieren -->\n"+
"        <bean id=\"archive\" class=\"java.lang.String\">\n"+
"           <constructor-arg value=\"xyz.jar\" />\n"+
"        </bean>\n"+
"        <bean id=\"display\" class=\"java.lang.String\">\n"+
"           <constructor-arg value=\"xyz.jar\" />\n"+
"        </bean>\n"+
"        <bean id=\"width\" class=\"java.lang.String\">\n"+
"           <constructor-arg value=\"800\" />\n"+
"        </bean>\n"+
"        <bean id=\"height\" class=\"java.lang.String\">\n"+
"           <constructor-arg value=\"600\" />\n"+
"        </bean>\n"+
"    </beans>\n"+
"");
     String result = function.valueOf(tag, null).toString();
     System.out.println("result: " + result);
     assertTrue(result.contains("xyz.jar"));
   }
View Full Code Here

Examples of project.gluebooster.math.functions.BoostFunction

  
   public static void main(String[] ignored) throws Exception
   {
      NameFileFilter navigationConfigFilter = new NameFileFilter("navigation-config.xml");
      OrFileFilter fileFilter = new OrFileFilter(DirectoryFileFilter.INSTANCE, navigationConfigFilter);
      BoostFunction navigationFilter = new ReflectionFunctions(ReflectionFunctions.Operation.invokeMethodOfOtherObject, fileFilter, "accept");
      //displayDirectory("C:/christian/projekte/opensource/gluebooster/glueBoosterApplications/assetManagement/target/assetManagement/WEB-INF/useCases", navigationFilter);
      displayDirectory("C:/christian/projekte/opensource/gluebooster/glueBoosterApplications/assetManagement/target/assetManagement/WEB-INF/useCases", navigationFilter);
     
      //TODO here is still an error, all children are displayed.
   }
View Full Code Here

Examples of project.gluebooster.math.functions.BoostFunction

      {
        ModifyingFunction function = new ModifyingFunction(ModifyingFunction.Operation.concatenatedFunctions);
        functionChains.put(methodname, function);
        if (hasDelegate)
        {
          BoostFunction delegateMethod = new ReflectionFunctions(ReflectionFunctions.Operation.invokeMethodOfOtherObject,null,methodname);//the delegate is not yet known
          function.addElementFunction(delegateMethod);
          delegateMethods.add(delegateMethod);
        }
      }
           
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.