Package org.apache.aries.blueprint.di

Examples of org.apache.aries.blueprint.di.Recipe


        if (stack.contains(recipe)) {
            ArrayList<Recipe> circularity = new ArrayList<Recipe>(stack.subList(stack.indexOf(recipe), stack.size()));

            // remove anonymous nodes from circularity list
            for (Iterator<Recipe> iterator = circularity.iterator(); iterator.hasNext();) {
                Recipe item = iterator.next();
                if (item != recipe && item.getName() == null) {
                    iterator.remove();
                }
            }

            // add ending node to list so a full circuit is shown
View Full Code Here


            }
           
            for (String name : tmpRepo.getNames()) {
                if (repository.getInstance(name) == null) {
                    LOGGER.debug("Adding new recipe {}", new Object[] { name });
                    Recipe r = tmpRepo.getRecipe(name);
                    if (r != null) {
                        repository.putRecipe(name, r);
                    }
                } else {
                    LOGGER.debug("Recipe {} is already instantiated and cannot be updated", new Object[] { name });
View Full Code Here

    private void untrackServiceReference(SatisfiableRecipe recipe, Set<String> stopped, Map<String, List<SatisfiableRecipe>> dependencies) {
        if (stopped.add(recipe.getName())) {
            for (Map.Entry<String, List<SatisfiableRecipe>> entry : dependencies.entrySet()) {
                if (entry.getValue().contains(recipe)) {
                    Recipe r = getRepository().getRecipe(entry.getKey());
                    if (r instanceof SatisfiableRecipe) {
                        untrackServiceReference((SatisfiableRecipe) r, stopped, dependencies);
                    }
                }
            }
View Full Code Here

            Object object = repository.getObject(name);
            if (object == null) {
                throw new NoSuchComponentException(name);
            }
            if (object instanceof Recipe) {
                Recipe recipe = (Recipe) object;
                if (!recipe.getName().equals(name)) {
                    throw new RuntimeException("Recipe '" + name + "' returned from the repository has name '" + name + "'");
                }
                createNode(name, recipe,  nodes);
            }
        }
View Full Code Here

        if (stack.contains(node.recipe)) {
            ArrayList<Recipe> circularity = new ArrayList<Recipe>(stack.subList(stack.indexOf(node.recipe), stack.size()));

            // remove anonymous nodes from circularity list
            for (Iterator<Recipe> iterator = circularity.iterator(); iterator.hasNext();) {
                Recipe recipe = iterator.next();
                if (recipe != node.recipe && recipe.getName() == null) {
                    iterator.remove();
                }
            }

            // add ending node to list so a full circuit is shown
View Full Code Here

        nodes.put(name, node);

        // link in the references
        LinkedList<Recipe> constructorRecipes = new LinkedList<Recipe>(recipe.getConstructorDependencies());
        while (!constructorRecipes.isEmpty()) {
            Recipe nestedRecipe = constructorRecipes.removeFirst();           
            if (nestedRecipe instanceof RefRecipe) {
                nestedRecipe =  nestedRecipe.getDependencies().get(0);
                String nestedName = nestedRecipe.getName();
                Node nestedNode = createNode(nestedName, nestedRecipe, nodes);
                node.referenceCount++;
                nestedNode.references.add(node);               
            } else {
                constructorRecipes.addAll(nestedRecipe.getDependencies());
            }
        }
       
        return node;
    }
View Full Code Here

        Set<String> names = new LinkedHashSet<String>();
        ExecutionContext origContext
            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
        try {
            for (String s : container.getComponentIds()) {
                Recipe r = container.getRepository().getRecipe(s);
                if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
                    && type.isAssignableFrom(((BeanRecipe)r).getType())) {
                    names.add(s);
                }
            }
View Full Code Here

       
        ExecutionContext origContext
            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
        try {
            for (String s : container.getComponentIds()) {
                Recipe r = container.getRepository().getRecipe(s);
                if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
                    && type.isAssignableFrom(((BeanRecipe)r).getType())) {
                   
                    list.add(type.cast(container.getComponentInstance(s)));
                }
View Full Code Here

        boolean loaded = false;
        ExecutionContext origContext
            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
        try {
            for (String s : container.getComponentIds()) {
                Recipe r = container.getRepository().getRecipe(s);
                if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
                    && type.isAssignableFrom(((BeanRecipe)r).getType())) {
                    names.add(s);
                }
            }
            Collections.reverse(names);
            for (String s : names) {
                BeanRecipe r = (BeanRecipe)container.getRepository().getRecipe(s);
                Class<?> beanType = r.getType();
                Class<? extends T> t = beanType.asSubclass(type);
                if (listener.loadBean(s, t)) {
                    Object o = container.getComponentInstance(s);
                    if (listener.beanLoaded(s, type.cast(o))) {
                        return true;
View Full Code Here

    public boolean hasConfiguredPropertyValue(String beanName, String propertyName, String value) {
        ExecutionContext origContext
            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
        try {
            Recipe r = container.getRepository().getRecipe(beanName);
            if (r instanceof BeanRecipe) {
                BeanRecipe br = (BeanRecipe)r;
                Object o = br.getProperty(propertyName);
                if (o == null) {
                    return false;
View Full Code Here

TOP

Related Classes of org.apache.aries.blueprint.di.Recipe

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.