Package org.apache.aries.blueprint.di

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


        assertEquals(integerValue, ((Multiple)obj).getInteger());       
    }

    public void testGenerics() throws Exception {
        ComponentDefinitionRegistryImpl registry = parse("/test-generics.xml");
        Repository repository = new TestBlueprintContainer(registry).getRepository();

        List<Integer> expectedList = new ArrayList<Integer>();
        expectedList.add(new Integer(10));
        expectedList.add(new Integer(20));
        expectedList.add(new Integer(50));
       
        Set<Long> expectedSet = new HashSet<Long>();
        expectedSet.add(new Long(1000));
        expectedSet.add(new Long(2000));
        expectedSet.add(new Long(5000));
       
        Map<Short, Boolean> expectedMap = new HashMap<Short, Boolean>();
        expectedMap.put(new Short((short)1), Boolean.TRUE);
        expectedMap.put(new Short((short)2), Boolean.FALSE);
        expectedMap.put(new Short((short)5), Boolean.TRUE);
       
        Object obj;
        PojoGenerics pojo;
       
        obj = repository.create("method");
        assertTrue(obj instanceof PojoGenerics);
        pojo = (PojoGenerics) obj;
       
        assertEquals(expectedList, pojo.getList());
        assertEquals(expectedSet, pojo.getSet());
        assertEquals(expectedMap, pojo.getMap());
       
        obj = repository.create("constructorList");
        assertTrue(obj instanceof PojoGenerics);
        pojo = (PojoGenerics) obj;
       
        assertEquals(expectedList, pojo.getList());
       
        obj = repository.create("constructorSet");
        assertTrue(obj instanceof PojoGenerics);
        pojo = (PojoGenerics) obj;
       
        assertEquals(expectedSet, pojo.getSet());
       
        obj = repository.create("constructorMap");
        assertTrue(obj instanceof PojoGenerics);
        pojo = (PojoGenerics) obj;
       
        assertEquals(expectedMap, pojo.getMap());
       
        obj = repository.create("genericPojo");
        assertTrue(obj instanceof Primavera);
        assertEquals("string", ((Primavera) obj).prop);
       
        obj = repository.create("doubleGenericPojo");
        assertTrue(obj instanceof Primavera);
        assertEquals("stringToo", ((Primavera) obj).prop);
    }
View Full Code Here


            } else {
                continue;
            }
            // Update repository with recipes processed by the processors
            untrackServiceReferences();
            Repository tmpRepo = new RecipeBuilder(this, tempRecipeIdSpace).createRepository();
           
            LOGGER.debug("Updating blueprint repository");
           
            for (String name : repository.getNames()) {
                if (repository.getInstance(name) == null) {
                    LOGGER.debug("Removing uninstantiated recipe {}", new Object[] { name });
                    repository.removeRecipe(name);
                } else {
                    LOGGER.debug("Recipe {} is already instantiated", new Object[] { name });
                }
            }
           
            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 Object createRecipe(Recipe recipe) {
        String name = recipe.getName();
        Repository repo = blueprintContainer.getRepository();
        if (repo.getRecipe(name) != recipe) {
            repo.putRecipe(name, recipe);
        }
        return repo.create(name);
    }
View Full Code Here

        }
    }
   
    private Object createRecipe(Recipe recipe) {
        String name = recipe.getName();
        Repository repo = blueprintContainer.getRepository();
        if (repo.getRecipe(name) != recipe) {
            repo.putRecipe(name, recipe);
        }
        return repo.create(name);
    }
View Full Code Here

            } else {
                continue;
            }
            // Update repository with recipes processed by the processors
            untrackServiceReferences();
            Repository tmpRepo = new RecipeBuilder(this, tempRecipeIdSpace).createRepository();
           
            LOGGER.debug("Updating blueprint repository");
           
            for (String name : repository.getNames()) {
                if (repository.getInstance(name) == null) {
                    LOGGER.debug("Removing uninstantiated recipe {}", new Object[] { name });
                    repository.removeRecipe(name);
                } else {
                    LOGGER.debug("Recipe {} is already instantiated", new Object[] { name });
                }
            }
           
            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 Object createRecipe(Recipe recipe) {
        String name = recipe.getName();
        Repository repo = blueprintContainer.getRepository();
        if (repo.getRecipe(name) != recipe) {
            repo.putRecipe(name, recipe);
        }
        return repo.create(name);
    }
View Full Code Here

            } else {
                continue;
            }
            // Update repository with recipes processed by the processors
            untrackServiceReferences();
            Repository tmpRepo = new RecipeBuilder(this, tempRecipeIdSpace).createRepository();
           
            LOGGER.debug("Updating blueprint repository");
           
            for (String name : repository.getNames()) {
                if (repository.getInstance(name) == null) {
                    LOGGER.debug("Removing uninstantiated recipe {}", new Object[] { name });
                    repository.removeRecipe(name);
                } else {
                    LOGGER.debug("Recipe {} is already instantiated", new Object[] { name });
                }
            }
           
            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

TOP

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

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.