Package org.apache.aries.blueprint.di

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


            }
            return false;
        }

        private Method findMethodWithConversion(Collection<Method> setterMethods, Object value) throws Exception {
            ExecutionContext ctx = ExecutionContext.Holder.getContext();
            List<Method> matchingMethods = new ArrayList<Method>();
            for (Method m : setterMethods) {
                Type paramType = m.getGenericParameterTypes()[0];
                if (ctx.canConvert(value, new GenericType(paramType))) matchingMethods.add(m);
            }
           
            if (matchingMethods.isEmpty()) return null;
            else if (matchingMethods.size() == 1) return matchingMethods.get(0);
            else throw new ComponentDefinitionException(
View Full Code Here


            throw new ComponentDefinitionException("Unable to convert instance " + name, e);
        }
    }
       
    public Object create(String name) throws ComponentDefinitionException {
        ExecutionContext oldContext = ExecutionContext.Holder.setContext(this);
        try {
            Object instance = createInstance(name);                      
            return convert(name, instance);
        } finally {
            ExecutionContext.Holder.setContext(oldContext);
View Full Code Here

            ExecutionContext.Holder.setContext(oldContext);
        }
    }
   
    public Object create(String name, Collection<Class<?>> proxyInterfaces) throws ComponentDefinitionException {
        ExecutionContext oldContext = ExecutionContext.Holder.setContext(this);
        try {
            Object instance = createInstance(name);
            if(instance instanceof UnwrapperedBeanHolder)
                instance = BeanRecipe.wrap((UnwrapperedBeanHolder) instance, proxyInterfaces);
            return convert(name, instance);
View Full Code Here

            ExecutionContext.Holder.setContext(oldContext);
        }
    }
   
    public Map<String, Object> createAll(Collection<String> names, Collection<Class<?>> proxyInterfaces) throws ComponentDefinitionException {
        ExecutionContext oldContext = ExecutionContext.Holder.setContext(this);
        try {
            Map<String, Object> instances = createInstances(names);
            for (String name : instances.keySet()) {
                Object obj = instances.get(name);
                if(obj instanceof UnwrapperedBeanHolder)
View Full Code Here

            ExecutionContext.Holder.setContext(oldContext);
        }
    }
   
    public void createAll(Collection<String> names) throws ComponentDefinitionException {
        ExecutionContext oldContext = ExecutionContext.Holder.setContext(this);
        try {
            createInstances(names);
            return;
        } finally {
            ExecutionContext.Holder.setContext(oldContext);
View Full Code Here

        }
        return recipes;
    }

    public Set<Recipe> getAllRecipes(String... names) {
        ExecutionContext oldContext = ExecutionContext.Holder.setContext(this);
        try {
            Set<Recipe> allRecipes = new HashSet<Recipe>();
            Collection<String> topLevel = names != null && names.length > 0 ? Arrays.asList(names) : recipes.keySet();
            for (String name : topLevel) {
                internalGetAllRecipes(allRecipes, getRecipe(name));
View Full Code Here

            ((ExtensionManagerImpl)orig).removeBeansOfNames(names);
        }
    }
   
    public <T> T getBeanOfType(String name, Class<T> type) {
        ExecutionContext origContext
            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
        try {
            Recipe r = container.getRepository().getRecipe(name);
            if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
                && type.isAssignableFrom(((BeanRecipe)r).getType())) {
View Full Code Here

        return orig.getBeanOfType(name, type);
    }
    /** {@inheritDoc}*/
    public List<String> getBeanNamesOfType(Class<?> type) {
        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
View Full Code Here

    /** {@inheritDoc}*/
    public <T> Collection<? extends T> getBeansOfType(Class<T> type) {
        List<T> list = new ArrayList<T>();
       
        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
View Full Code Here

    /** {@inheritDoc}*/
    public <T> boolean loadBeansOfType(Class<T> type, BeanLoaderListener<T> listener) {
        List<String> names = new ArrayList<String>();
        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
View Full Code Here

TOP

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

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.