Examples of Tbean


Examples of org.apache.aries.blueprint.jaxb.Tbean

        }
       
        for (Class clazz : beanClasses) {
            // @Bean annotation detected
            Bean bean = (Bean)clazz.getAnnotation(Bean.class);
            Tbean tbean = new Tbean();
           
            // process depends-on property
            String[] dependsOn = bean.dependsOn();
            if (!containsValid(dependsOn)) {
                tbean.setDependsOn(null);
            } else {
                List<String> dons = Arrays.asList(dependsOn);
                tbean.setDependsOn(dons);
            }
           
            // process id property
            String id = bean.id();
            if (id.length() > 0) {
                tbean.setId(id);
            } else {
                // should we auto generate an id, based on the class name?
                tbean.setId(clazz.getSimpleName());
            }

            // process the clazz property
            tbean.setClazz(clazz.getName());
           
            // process activation
            String activation = bean.activation();
            if (activation.length() > 0) {
                if (activation.equalsIgnoreCase("eager") || activation.equalsIgnoreCase("lazy")) {
                    tbean.setActivation(bean.activation());
                } else {
                    throw new BlueprintAnnotationException("Invalid bean activation value " + activation + " for " + clazz.getName());
                }
            }
           
            // process description
            if (bean.description().length() > 0) {
                Tdescription desp = new Tdescription();
                desp.getContent().add(bean.description());
                tbean.setDescription(desp);
            }
           
            // process scope
            String scope = bean.scope();
            if (scope.length() > 0) {
                if (scope.equalsIgnoreCase("singleton") || scope.equalsIgnoreCase("prototype")) {
                    tbean.setScope(scope);
                } else {
                    throw new BlueprintAnnotationException("Invalid bean scope value " + scope + " for " + clazz.getName());
                }
            }
           
            // process factory ref
            String factoryRef = bean.factoryRef();
            if (factoryRef.length() > 0) {
                tbean.setFactoryRef(factoryRef);
            }
           
            // process factory method
            String factoryMethod = bean.factoryMethod();
            if (factoryMethod.length() > 0) {
                tbean.setFactoryMethod(factoryMethod);
            }
           

            List<Object> props = tbean.getArgumentOrPropertyOrAny();

            // process args
            Arg[] args = bean.args();
           
            if (args.length > 0) {
                for (int i = 0; i < args.length; i++) {
                    Targument targ = createTargument(args[i]);
                    if (targ != null) {
                        props.add(targ);
                    }
                }
            }
           
            Field[] fields = clazz.getDeclaredFields();
            for (int i = 0; i < fields.length; i++) {
                if (fields[i].isAnnotationPresent(Inject.class)) {
                    if (fields[i].isAnnotationPresent(Reference.class)) {
                        // the field is also annotated with @Reference
                        Reference ref = (Reference)fields[i].getAnnotation(Reference.class);
                        Treference tref = generateTref(ref, reflMap);
                        components.add(tref);
                    } else if (fields[i].isAnnotationPresent(ReferenceList.class)) {
                        // the field is also annotated with @ReferenceList
                        ReferenceList ref = (ReferenceList)fields[i].getAnnotation(ReferenceList.class);
                        TreferenceList tref = generateTrefList(ref, reflMap);
                        components.add(tref);
                       
                    } else {
                        Tproperty tp = createTproperty(fields[i].getName(), fields[i].getAnnotation(Inject.class));
                        props.add(tp);
                    }
                }
            }
                   
            // check if the bean also declares init, destroy or inject annotation on methods
            Method[] methods = clazz.getDeclaredMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].isAnnotationPresent(Init.class)) {
                    tbean.setInitMethod(methods[i].getName());
                } else if (methods[i].isAnnotationPresent(Destroy.class)) {
                    tbean.setDestroyMethod(methods[i].getName());
                } else if (methods[i].isAnnotationPresent(Inject.class)) {
                    String propertyName = convertFromMethodName(methods[i].getName());
                    Tproperty tp = createTproperty(propertyName, methods[i].getAnnotation(Inject.class));
                    props.add(tp)
                } else if (methods[i].isAnnotationPresent(Arg.class)) {
View Full Code Here

Examples of org.apache.aries.blueprint.jaxb.Tbean

            file.createNewFile();
        }

        Tblueprint tblueprint = new Tblueprint();
        List<Object> components = tblueprint.getServiceOrReferenceListOrBean();
        Tbean tbean = new Tbean();
        tbean.setDependsOn(null);
        tbean.setId("Bar");
        tbean.setClazz("org.apache.aries.blueprint.sample.Bar");
        List<Object> props = tbean.getArgumentOrPropertyOrAny();

        String value = "Hello Bar";
        Tproperty tp = new Tproperty();
        tp.setName("value");
        //Tvalue tvalue = new Tvalue();
View Full Code Here

Examples of org.apache.aries.blueprint.jaxb.Tbean

        }
       
        for (Class clazz : beanClasses) {
            // @Bean annotation detected
            Bean bean = (Bean)clazz.getAnnotation(Bean.class);
            Tbean tbean = new Tbean();
           
            // process depends-on property
            String[] dependsOn = bean.dependsOn();
            if (!containsValid(dependsOn)) {
                tbean.setDependsOn(null);
            } else {
                List<String> dons = Arrays.asList(dependsOn);
                tbean.setDependsOn(dons);
            }
           
            // process id property
            String id = bean.id();
            if (id.length() > 0) {
                tbean.setId(id);
            } else {
                // should we auto generate an id, based on the class name?
                tbean.setId(clazz.getSimpleName());
            }

            // process the clazz property
            tbean.setClazz(clazz.getName());
           
            // process activation
            String activation = bean.activation();
            if (activation.length() > 0) {
                if (activation.equalsIgnoreCase("eager") || activation.equalsIgnoreCase("lazy")) {
                    tbean.setActivation(bean.activation());
                } else {
                    throw new BlueprintAnnotationException("Invalid bean activation value " + activation + " for " + clazz.getName());
                }
            }
           
            // process description
            if (bean.description().length() > 0) {
                Tdescription desp = new Tdescription();
                desp.getContent().add(bean.description());
                tbean.setDescription(desp);
            }
           
            // process scope
            String scope = bean.scope();
            if (scope.length() > 0) {
                if (scope.equalsIgnoreCase("singleton") || scope.equalsIgnoreCase("prototype")) {
                    tbean.setScope(scope);
                } else {
                    throw new BlueprintAnnotationException("Invalid bean scope value " + scope + " for " + clazz.getName());
                }
            }
           
            // process factory ref
            String factoryRef = bean.factoryRef();
            if (factoryRef.length() > 0) {
                tbean.setFactoryRef(factoryRef);
            }
           
            // process factory method
            String factoryMethod = bean.factoryMethod();
            if (factoryMethod.length() > 0) {
                tbean.setFactoryMethod(factoryMethod);
            }
           

            List<Object> props = tbean.getArgumentOrPropertyOrAny();

            // process args
            Arg[] args = bean.args();
           
            if (args.length > 0) {
                for (int i = 0; i < args.length; i++) {
                    Targument targ = createTargument(args[i]);
                    if (targ != null) {
                        props.add(targ);
                    }
                }
            }
           
            Field[] fields = clazz.getDeclaredFields();
            for (int i = 0; i < fields.length; i++) {
                if (fields[i].isAnnotationPresent(Inject.class)) {
                    if (fields[i].isAnnotationPresent(Reference.class)) {
                        // the field is also annotated with @Reference
                        Reference ref = fields[i].getAnnotation(Reference.class);
                        Treference tref = generateTref(ref, reflMap);
                        components.add(tref);
                    } else if (fields[i].isAnnotationPresent(ReferenceList.class)) {
                        // the field is also annotated with @ReferenceList
                        ReferenceList ref = fields[i].getAnnotation(ReferenceList.class);
                        TreferenceList tref = generateTrefList(ref, reflMap);
                        components.add(tref);
                       
                    } else {
                        Tproperty tp = createTproperty(fields[i].getName(), fields[i].getAnnotation(Inject.class));
                        props.add(tp);
                    }
                }
            }
                   
            // check if the bean also declares init, destroy or inject annotation on methods
            Method[] methods = clazz.getDeclaredMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].isAnnotationPresent(Init.class)) {
                    tbean.setInitMethod(methods[i].getName());
                } else if (methods[i].isAnnotationPresent(Destroy.class)) {
                    tbean.setDestroyMethod(methods[i].getName());
                } else if (methods[i].isAnnotationPresent(Inject.class)) {
                    String propertyName = convertFromMethodName(methods[i].getName());
                    Tproperty tp = createTproperty(propertyName, methods[i].getAnnotation(Inject.class));
                    props.add(tp)
                } else if (methods[i].isAnnotationPresent(Arg.class)) {
View Full Code Here

Examples of org.apache.aries.blueprint.jaxb.Tbean

        }
       
        for (Class clazz : beanClasses) {
            // @Bean annotation detected
            Bean bean = (Bean)clazz.getAnnotation(Bean.class);
            Tbean tbean = new Tbean();
           
            // process depends-on property
            String[] dependsOn = bean.dependsOn();
            if (!containsValid(dependsOn)) {
                tbean.setDependsOn(null);
            } else {
                List<String> dons = Arrays.asList(dependsOn);
                tbean.setDependsOn(dons);
            }
           
            // process id property
            String id = bean.id();
            if (id.length() > 0) {
                tbean.setId(id);
            } else {
                // should we auto generate an id, based on the class name?
                tbean.setId(clazz.getSimpleName());
            }

            // process the clazz property
            tbean.setClazz(clazz.getName());
           
            // process activation
            String activation = bean.activation();
            if (activation.length() > 0) {
                if (activation.equalsIgnoreCase("eager") || activation.equalsIgnoreCase("lazy")) {
                    tbean.setActivation(bean.activation());
                } else {
                    throw new BlueprintAnnotationException("Invalid bean activation value " + activation + " for " + clazz.getName());
                }
            }
           
            // process description
            if (bean.description().length() > 0) {
                Tdescription desp = new Tdescription();
                desp.getContent().add(bean.description());
                tbean.setDescription(desp);
            }
           
            // process scope
            String scope = bean.scope();
            if (scope.length() > 0) {
                if (scope.equalsIgnoreCase("singleton") || scope.equalsIgnoreCase("prototype")) {
                    tbean.setScope(scope);
                } else {
                    throw new BlueprintAnnotationException("Invalid bean scope value " + scope + " for " + clazz.getName());
                }
            }
           
            // process factory ref
            String factoryRef = bean.factoryRef();
            if (factoryRef.length() > 0) {
                tbean.setFactoryRef(factoryRef);
            }
           
            // process factory method
            String factoryMethod = bean.factoryMethod();
            if (factoryMethod.length() > 0) {
                tbean.setFactoryMethod(factoryMethod);
            }
           

            List<Object> props = tbean.getArgumentOrPropertyOrAny();

            // process args
            Arg[] args = bean.args();
           
            if (args.length > 0) {
                for (int i = 0; i < args.length; i++) {
                    Targument targ = createTargument(args[i]);
                    if (targ != null) {
                        props.add(targ);
                    }
                }
            }
           
            Field[] fields = clazz.getDeclaredFields();
            for (int i = 0; i < fields.length; i++) {
                if (fields[i].isAnnotationPresent(Inject.class)) {
                    if (fields[i].isAnnotationPresent(Reference.class)) {
                        // the field is also annotated with @Reference
                        Reference ref = (Reference)fields[i].getAnnotation(Reference.class);
                        Treference tref = generateTref(ref, reflMap);
                        components.add(tref);
                    } else if (fields[i].isAnnotationPresent(ReferenceList.class)) {
                        // the field is also annotated with @ReferenceList
                        ReferenceList ref = (ReferenceList)fields[i].getAnnotation(ReferenceList.class);
                        TreferenceList tref = generateTrefList(ref, reflMap);
                        components.add(tref);
                       
                    } else {
                        Tproperty tp = createTproperty(fields[i].getName(), fields[i].getAnnotation(Inject.class));
                        props.add(tp);
                    }
                }
            }
                   
            // check if the bean also declares init, destroy or inject annotation on methods
            Method[] methods = clazz.getDeclaredMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].isAnnotationPresent(Init.class)) {
                    tbean.setInitMethod(methods[i].getName());
                } else if (methods[i].isAnnotationPresent(Destroy.class)) {
                    tbean.setDestroyMethod(methods[i].getName());
                } else if (methods[i].isAnnotationPresent(Inject.class)) {
                    String propertyName = convertFromMethodName(methods[i].getName());
                    Tproperty tp = createTproperty(propertyName, methods[i].getAnnotation(Inject.class));
                    props.add(tp)
                } else if (methods[i].isAnnotationPresent(Arg.class)) {
View Full Code Here

Examples of org.sdnplatform.sync.internal.store.TBean

    public void testBasicOneNode() throws Exception {
        AbstractSyncManager sync = syncManagers[0];
        IStoreClient<Key, TBean> testClient =
                sync.getStoreClient("global", Key.class, TBean.class);
        Key k = new Key("com.bigswitch.bigsync.internal", "test");
        TBean tb = new TBean("hello", 42);
        TBean tb2 = new TBean("hello", 84);
        TBean tb3 = new TBean("hello", 126);
       
        assertNotNull(testClient.get(k));
        assertNull(testClient.get(k).getValue());
       
        testClient.put(k, tb);
View Full Code Here

Examples of org.sdnplatform.sync.internal.store.TBean

                sync.getStoreClient("local", Key.class, TBean.class);
       
        HashMap<Key, TBean> testMap = new HashMap<Key, TBean>();
        for (int i = 0; i < 100; i++) {
            Key k = new Key("com.bigswitch.bigsync.internal", "test" + i);
            TBean tb = new TBean("value", i);
            testMap.put(k, tb);
            testClient.put(k, tb);
        }
       
        IClosableIterator<Entry<Key, Versioned<TBean>>> iter =
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.