Examples of Gem


Examples of de.saumya.mojo.gems.gem.Gem

        if (target == null || (target.exists() && !target.isDirectory())) {
            throw new IOException("Must specify target directory, where to generate Gem!");
        }

        final Gem gem = new Gem(gemspec);

        if (artifact.getArtifactFile() != null) {
            gem.addFile(artifact.getArtifactFile(), createLibFileName(artifact,
                                                                      ".jar"));
        }

        // create "meta" ruby file
        final String rubyStubMetaPath = createLibFileName(artifact,
                                                          "-maven.rb");
        final File rubyStubMetaFile = generateRubyMetaStub(gemspec, artifact);
        gem.addFile(rubyStubMetaFile, rubyStubMetaPath);

        // create runtime ruby file
        final String rubyStubPath = createLibFileName(artifact, ".rb");

        // System.err.println( rubyStubPath );
        final File rubyStubFile = generateRubyStub(gemspec,
                                                   artifact,
                                                   RubyDependencyType.RUNTIME);
        gem.addFile(rubyStubFile, rubyStubPath);

        // create development ruby file
        final String rubyDevelopmentStubPath = createLibFileName(artifact,
                                                                 "-dev.rb");
        final File rubyDevelopmentStubFile = generateRubyStub(gemspec,
                                                              artifact,
                                                              RubyDependencyType.DEVELOPMENT);
        gem.addFile(rubyDevelopmentStubFile, rubyDevelopmentStubPath);

        final File rubyMainStubFile = generateMainStub(artifact);
        gem.addFile(rubyMainStubFile, LIB_PATH + gemspec.getName() + ".rb" );

        // write file
        final File gemfile = this.gemPackager.createGem(gem, target);

        return new GemArtifact(gemspec, gemfile);
View Full Code Here

Examples of org.openquark.gems.client.Gem

            addCollectorsForMessageProperties ();
            addCollectorsForMetrics();
           
            logger.report("Time to add collectors: ", true);
           
            Gem triggerResultGem = addTriggerGems ();          
            logger.report("Time to add triggers: ", true);
           
            Gem actionResultGem = addActionGems ();           
            logger.report("Time to add actions: ", true);
           
            finishGemGraph (triggerResultGem, actionResultGem);
           
            logger.report("Time to finish graph: ", true);
View Full Code Here

Examples of org.openquark.gems.client.Gem

            // Create a code gem to extract the ith property from the message list input
            // e.g. the code gem for the 5th message property would be:
            // List.map (\msg -> msg.#5) msg
            // which takes the input list of message tuples as input, and outputs a new list
            // containing the 5th element of every message.
            Gem propertyExtractorGem = new CodeGem(codeAnalyser, CAL_List.Functions.map.getQualifiedName() + " (\\msg -> msg.#" + ++i +") msg", Collections.<String>emptySet());
            gemGraph.addGem(propertyExtractorGem);
                    
            // create the collector gem for this message property
            CollectorGem propertyGem = new CollectorGem ();
            propertyGem.setName (makeCollectorName (propertyInfo.name));  
            gemGraph.addGem(propertyGem);
           
            gemGraph.connectGems(messageReflector.getOutputPart(), propertyExtractorGem.getInputPart(0));   
            gemGraph.connectGems(propertyExtractorGem.getOutputPart(), propertyGem.getInputPart(0));   

            bindingContext.addCollector(propertyInfo, propertyGem);
           
            assert graphIsValid() : gemGraph.toString();
        }
View Full Code Here

Examples of org.openquark.gems.client.Gem

    private Gem addGems (List<? extends BoundGemDescription> boundGemList) {
        if (boundGemList == null || boundGemList.size() == 0) {
            throw new IllegalArgumentException ("The list of bound gems must not be empty");
        }
       
        Gem result = null;
       
        for (int gemN = 0; gemN < boundGemList.size(); ++gemN) {
            BoundGemDescription gemDescription = boundGemList.get(gemN);
                      
            FunctionalAgentGem zipGem = new FunctionalAgentGem(calServices.getGemEntity(zippingGems[gemDescription.getVariableBindingCount()]));
            FunctionalAgentGem zippingFunctionGem = new FunctionalAgentGem(calServices.getGemEntity(gemDescription.getQualifiedName()));
                 
            gemGraph.addGem(zipGem);
            gemGraph.addGem(zippingFunctionGem);

            connectInputs (zipGem, zippingFunctionGem, gemDescription, gemGraph);
           
            if (result == null) {
                result = zipGem;
            } else {
                FunctionalAgentGem zipGem2 = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.zipWith));
                gemGraph.addGem (zipGem2);
               
                FunctionalAgentGem andGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_Prelude.Functions.and));
                gemGraph.addGem (andGem);
                andGem.getInputPart(0).setBurnt(true);
                andGem.getInputPart(1).setBurnt(true);
               
                gemGraph.connectGems(andGem.getOutputPart(), zipGem2.getInputPart(0));
                gemGraph.connectGems(zipGem.getOutputPart(), zipGem2.getInputPart(1));
                gemGraph.connectGems(result.getOutputPart(), zipGem2.getInputPart(2));
               
                result = zipGem2;
               
        
           
View Full Code Here

Examples of org.openquark.gems.client.Gem

        gemGraph.connectGems(zippingFunctionGem.getOutputPart(),zipGem.getInputPart(zipInput++));
       
        //connect the parameters
        for (int inputN = 0; inputN < boundGemDescription.getBindingCount(); ++inputN) {
            InputBinding binding = boundGemDescription.getNthBinding(inputN);
            Gem outputGem = binding.getOutputGem(calServices, gemGraph, bindingContext);

            if (binding.isConstant()) {
                gemGraph.connectGems(outputGem.getOutputPart(), zippingFunctionGem.getInputPart(inputN));
            } else {
                zippingFunctionGem.getInputPart(inputN).setBurnt(true);
                gemGraph.connectGems(outputGem.getOutputPart(), zipGem.getInputPart(zipInput++));
            }
        }
       
        assert graphIsValid() : gemGraph.toString();
    }
View Full Code Here

Examples of org.openquark.gems.client.Gem

       
        gemGraph.connectGems(andGem.getOutputPart(), zipGem.getInputPart(0));
        gemGraph.connectGems(triggerResultGem.getOutputPart(), zipGem.getInputPart(1));
        gemGraph.connectGems(actionResultGem.getOutputPart(), zipGem.getInputPart(2));
       
        Gem toIteratorGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.toJIterator));
        gemGraph.addGem(toIteratorGem);
       
        gemGraph.connectGems(zipGem.getOutputPart(), toIteratorGem.getInputPart(0));          
        gemGraph.connectGems( toIteratorGem.getOutputPart(), gemGraph.getTargetCollector().getInputPart(0));
    }
View Full Code Here

Examples of org.openquark.gems.client.Gem

     */
    @Override
    public Gem getOutputGem (BasicCALServices calServices, GemGraph gemGraph, BindingContext bindingContext) {
        List<InputBinding> allBindings = parseAndSubstitute (template, argumentBindings);
       
        Gem resultGem = null;
       
        if (allBindings.isEmpty()) {
            resultGem = new GemFactory(calServices).makeValueGem("");
           
            gemGraph.addGem(resultGem);
        } else {
            // build the string up from right to left
            for (int bindingN = allBindings.size() - 1; bindingN >= 0; --bindingN) {
                InputBinding binding = allBindings.get (bindingN);
               
                Gem gem = binding.getOutputGem(calServices, gemGraph, bindingContext);
               
                if (resultGem == null) {
                    resultGem = gem;
                } else {
                    resultGem = appendGems(calServices, gemGraph, gem, resultGem);
View Full Code Here

Examples of org.openquark.gems.client.Gem

        return resultGem;
    }

    private Gem appendGems(BasicCALServices calServices, GemGraph gemGraph, Gem gem1, Gem gem2) {
       
        Gem appendGem = new FunctionalAgentGem(calServices.getGemEntity(QualifiedName.makeFromCompoundName("Cal.Samples.BusinessActivityMonitor.BAM.appendStrings")));
        gemGraph.addGem(appendGem);
               
        if  ( !(gem1 instanceof ValueGem)) {
            appendGem.getInputPart(0).setBurnt(true);
        }
        if ( !(gem2 instanceof ValueGem)) {
            appendGem.getInputPart(1).setBurnt(true);
        }
       
        switch (appendGem.getTargetInputs().size()) {
        case 2:
            gemGraph.connectGems(gem1.getOutputPart(), appendGem.getInputPart(0));
            gemGraph.connectGems(gem2.getOutputPart(), appendGem.getInputPart(1));
            return appendGem;
        case 1:
            Gem mapGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.map));
            gemGraph.addGem(mapGem);
            gemGraph.connectGems(appendGem.getOutputPart(), mapGem.getInputPart(0));
           
            if (!(gem1 instanceof ValueGem)) {
                gemGraph.connectGems(gem1.getOutputPart(), mapGem.getInputPart(1));
                gemGraph.connectGems(gem2.getOutputPart(), appendGem.getInputPart(1));
            } else {
                gemGraph.connectGems(gem2.getOutputPart(), mapGem.getInputPart(1));
                gemGraph.connectGems(gem1.getOutputPart(), appendGem.getInputPart(0));
            }
            return mapGem;
           
        default:
            Gem zipGem = new FunctionalAgentGem(calServices.getGemEntity(CAL_List.Functions.zipWith));
            gemGraph.addGem(zipGem);
            gemGraph.connectGems(appendGem.getOutputPart(), zipGem.getInputPart(0));
            gemGraph.connectGems(gem1.getOutputPart(), zipGem.getInputPart(1));
            gemGraph.connectGems(gem2.getOutputPart(), zipGem.getInputPart(2));
            return zipGem;         
        }

    }
View Full Code Here

Examples of org.openquark.gems.client.Gem

            ExplorerCellRenderer renderer = (ExplorerCellRenderer)getCellRenderer();
            if (!renderer.isPointOverIcon(relativePoint)) {
                Object node = path.getLastPathComponent();
                if (node instanceof ExplorerGemNode) {
                    // Check if the gem is focusable which means it will be rendered as a hyperlink
                    Gem gem = ((ExplorerGemNode)node).getGem();
                    if (navigationHelper.isFocusable(gem)) {
                        return true;
                    }
                }
            }
View Full Code Here

Examples of org.openquark.gems.client.Gem

            if (isFocusablePoint(location)) {
                TreePath path = getPathForLocation(location.x, location.y);
                Object node = path.getLastPathComponent();
                if (node instanceof ExplorerGemNode) {
                    // Indicate that the navigation helper should change to focus on the gem
                    Gem gem = ((ExplorerGemNode)node).getGem();
                    navigationHelper.focusOn(gem);
                }
            }
        }
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.