Package org.impalaframework.graph

Examples of org.impalaframework.graph.Vertex


   
    private void verifyGraphOrders( List<Vertex> vertices )
    {
        for ( Iterator<Vertex> iter = vertices.iterator(); iter.hasNext(); )
        {
            Vertex v = iter.next();
           
            // Make sure that the orders of all dependencies are less than
            //  the order of v.
            for ( Iterator<Vertex> iter2 = v.getDependencies().iterator(); iter2.hasNext(); )
            {
                Vertex dv = (Vertex)iter2.next();
                assertTrue( "The order of " + dv.getName() + " (" + dv.getOrder() + ") should be "
                    + "less than the order of " + v.getName() + " (" + v.getOrder() + ")",
                    dv.getOrder() < v.getOrder() );
            }
        }
    }
View Full Code Here


        Assert.notNull(parent, "parent cannot be null");
        Assert.notNull(moduleDefinition, "moduleDefinition cannot be null");
       
        logger.info("With parent '" + parent + "', adding module: " + moduleDefinition);
       
        final Vertex parentVertex = getRequiredVertex(parent);
       
        ModuleDefinition parentDefinition = parentVertex.getModuleDefinition();
        parentDefinition.addChildModuleDefinition(moduleDefinition);
        moduleDefinition.setParentDefinition(parentDefinition);
       
        //now recursively add definitions
        List<Vertex> addedVertices = new ArrayList<Vertex>();
View Full Code Here

            dump();
        }
    }

    private Vertex getRequiredVertex(String moduleName) {
        final Vertex parentVertex = vertexMap.get(moduleName);
        if (parentVertex == null) {
           
            if (logger.isDebugEnabled()) {
                logger.debug("Module '" + moduleName + "' not found.");
                dump();
View Full Code Here

     */
    private List<Vertex> getVertexAndOrderedDependants(String name) {
       
        Assert.notNull(name, "name cannot be null");
       
        final Vertex current = getRequiredVertex(name);
       
        //get all dependents
        final List<Vertex> dependents = getVertexDependants(name);
        List<Vertex> ordered = getOrderedDependants(current, dependents);
        return ordered;
View Full Code Here

     */
    private List<Vertex> getVertexDependencyList(String name) {
       
        Assert.notNull(name, "name cannot be null");
       
        Vertex vertex = getRequiredVertex(name);
       
        //list the vertices in the correct order
        final List<Vertex> vertextList = GraphHelper.list(vertex);
        return vertextList;
    }
View Full Code Here

        Assert.notNull(definitions, "definitions cannot be null");
       
        List<Vertex> vertices = new ArrayList<Vertex>();
        for (ModuleDefinition moduleDefinition : definitions) {
            final Vertex vertex = getRequiredVertex(moduleDefinition.getName());
           
            vertices.add(vertex);
        }
        return vertices;
    }
View Full Code Here

    private Vertex populateVertex(ModuleDefinition moduleDefinition) {
       
        Assert.notNull(moduleDefinition, "moduleDefinition cannot be null");
       
        String name = moduleDefinition.getName();
        final Vertex vertex = new Vertex(moduleDefinition);
        vertexMap.put(name, vertex);
        return vertex;
    }
View Full Code Here

    private void populateDependencies(Vertex vertex, ModuleDefinition moduleDefinition, boolean optional) {
       
        final List<String> dependentModuleNames = moduleDefinition.getDependentModuleNames(optional);
        for (String dependent : dependentModuleNames) {
           
            final Vertex dependentVertex = vertexMap.get(dependent);
           
            if (dependentVertex == null) {
                if (!optional) {
                    throw new InvalidStateException("Unable to dependency named named '" + dependent
                            + "' for module definition '" + moduleDefinition.getName() + "'");
View Full Code Here

        Assert.notNull(parent, "parent cannot be null");
        Assert.notNull(moduleDefinition, "moduleDefinition cannot be null");
       
        logger.info("With parent '" + parent + "', adding module: " + moduleDefinition);
       
        final Vertex parentVertex = getRequiredVertex(parent);
       
        ModuleDefinition parentDefinition = parentVertex.getModuleDefinition();
        parentDefinition.addChildModuleDefinition(moduleDefinition);
        moduleDefinition.setParentDefinition(parentDefinition);
       
        //now recursively add definitions
        List<Vertex> addedVertices = new ArrayList<Vertex>();
View Full Code Here

            dump();
        }
    }

    private Vertex getRequiredVertex(String moduleName) {
        final Vertex parentVertex = vertexMap.get(moduleName);
        if (parentVertex == null) {
           
            if (logger.isDebugEnabled()) {
                logger.debug("Module '" + moduleName + "' not found.");
                dump();
View Full Code Here

TOP

Related Classes of org.impalaframework.graph.Vertex

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.