Package org.apache.geronimo.gbean

Examples of org.apache.geronimo.gbean.GReferenceInfo


        Set referencesSet = new HashSet();
        Set dependencySet = new HashSet();
        // add the references
        Map dataReferences = gbeanData.getReferences();
        for (Iterator iterator = gbeanInfo.getReferences().iterator(); iterator.hasNext();) {
            GReferenceInfo referenceInfo = (GReferenceInfo) iterator.next();
            String referenceName = referenceInfo.getName();
            ReferencePatterns referencePatterns = (ReferencePatterns) dataReferences.remove(referenceName);
            if (referenceInfo.getProxyType().equals(Collection.class.getName())) {
                referencesSet.add(new GBeanCollectionReference(this, referenceInfo, kernel, referencePatterns));

            } else {
                referencesSet.add(new GBeanSingleReference(this, referenceInfo, kernel, referencePatterns));
                if (referencePatterns != null) {
View Full Code Here


        }

        // set references
        for (Map.Entry<String, ReferencePatterns> entry : getReferences().entrySet()) {
            String referenceName = entry.getKey();
            GReferenceInfo referenceInfo = gbeanInfo.getReference(referenceName);
            if (referenceInfo == null) {
                throw new InvalidConfigException("No reference: " + referenceName + " for gbean: " + data.getAbstractName());
            }

            ReferencePatterns referencePatterns = entry.getValue();
View Full Code Here

    private AbstractNameQuery buildAbstractNameQuery(String refName, PatternType pattern) throws DeploymentException {
//        if (refName == null) {
//            throw new DeploymentException("No type specified in dependency pattern " + pattern + " for gbean " + gbean.getName());
//        }
        assert refName != null;
        GReferenceInfo referenceInfo = null;
        Set referenceInfos = gbean.getGBeanInfo().getReferences();
        for (Iterator iterator = referenceInfos.iterator(); iterator.hasNext();) {
            GReferenceInfo testReferenceInfo = (GReferenceInfo) iterator.next();
            String testRefName = testReferenceInfo.getName();
            if (testRefName.equals(refName)) {
                referenceInfo = testReferenceInfo;
            }
        }
        if (referenceInfo == null) {
View Full Code Here

        for (Method method : methods) {
            Reference reference = method.getAnnotation(Reference.class);
            Class type = method.getParameterTypes()[0];
            Class referenceType = getGenericActualType(method.getGenericParameterTypes()[0], type);
            String name = getName(method);
            GReferenceInfo referenceInfo = new GReferenceInfo(name,
                referenceType.getName(),
                type.getName(),
                method.getName(),
                reference.namingType());
            infoBuilder.addReference(referenceInfo);
View Full Code Here

    static void preprocessGBeanData(AbstractName configurationName, Configuration configuration, GBeanData gbeanData) throws InvalidConfigException {
        if (log.isDebugEnabled()) {
            log.debug("resolving dependencies for " + gbeanData.getAbstractName());
        }
        for (String referenceName : gbeanData.getReferencesNames()) {
            GReferenceInfo referenceInfo = gbeanData.getGBeanInfo().getReference(referenceName);
            if (referenceInfo == null) {
                throw new InvalidConfigException("No reference named " + referenceName + " in gbean " + gbeanData.getAbstractName());
            }
            boolean isSingleValued = !referenceInfo.getProxyType().equals(Collection.class.getName());
            if (isSingleValued) {
                ReferencePatterns referencePatterns = gbeanData.getReferencePatterns(referenceName);
                AbstractName abstractName;
                try {
                    abstractName = configuration.findGBean(referencePatterns);
View Full Code Here

       
        GAttributeInfo nameAttribute = beanInfo.getAttribute("name");
        assertNotNull(nameAttribute);
        assertEquals(String.class.getName(), nameAttribute.getType());

        GReferenceInfo nameReference = beanInfo.getReference("Name");
        assertNotNull(nameReference);
        assertEquals(Runnable.class.getName(), nameReference.getProxyType());
       
        GReferenceInfo collectionReference = beanInfo.getReference("Collection");
        assertNotNull(collectionReference);
        assertEquals(Collection.class.getName(), collectionReference.getProxyType());
        assertEquals(Runnable.class.getName(), collectionReference.getReferenceType());
       
        GAttributeInfo setterAttribute = beanInfo.getAttribute("setterAttribute");
        assertNotNull(setterAttribute);
        assertEquals(String.class.getName(), setterAttribute.getType());
        assertEquals(true, setterAttribute.isPersistent());
        assertEquals(true, setterAttribute.isManageable());
        assertEquals(EncryptionSetting.ENCRYPTED, setterAttribute.getEncryptedSetting());
       
        GAttributeInfo password = beanInfo.getAttribute("password");
        assertNotNull(password);
        assertEquals(String.class.getName(), password.getType());
        assertEquals(true, password.isPersistent());
        assertEquals(true, password.isManageable());
        assertEquals(EncryptionSetting.ENCRYPTED, password.getEncryptedSetting());

        GAttributeInfo setterNotManageableAttribute = beanInfo.getAttribute("setterNotManageableAttribute");
        assertNotNull(setterNotManageableAttribute);
        assertEquals(String.class.getName(), setterNotManageableAttribute.getType());
        assertEquals(true, setterNotManageableAttribute.isPersistent());
        assertEquals(false, setterNotManageableAttribute.isManageable());
        assertEquals(EncryptionSetting.PLAINTEXT, setterNotManageableAttribute.getEncryptedSetting());
       
        GReferenceInfo setterReference = beanInfo.getReference("SetterReference");
        assertNotNull(setterReference);
        assertEquals(Runnable.class.getName(), setterReference.getProxyType());

        GReferenceInfo setterCollectionReference = beanInfo.getReference("SetterCollectionReference");
        assertNotNull(setterCollectionReference);
        assertEquals(Collection.class.getName(), setterCollectionReference.getProxyType());
        assertEquals(Runnable.class.getName(), setterCollectionReference.getReferenceType());
    }
View Full Code Here

        }
        return failures;
    }

    private String verifyReference(GBeanData gbean, String referenceName, ReferencePatterns referencePatterns, Configuration configuration) {
        GReferenceInfo referenceInfo = gbean.getGBeanInfo().getReference(referenceName);

        // if there is no reference info we can't verify
        if (referenceInfo == null) return null;

        // A collection valued reference doesn't need to be verified
        if (referenceInfo.getProxyType().equals(Collection.class.getName())) return null;

        String message = isVerifyReference(referencePatterns, configuration);
        if (message != null) {
            return "Unable to resolve reference \"" + referenceName + "\"\n" +
                    "    in gbean " + gbean.getAbstractName() + "\n    to a gbean matching the pattern " + referencePatterns.getPatterns() + "\n    due to: " + message;
View Full Code Here

        }

        // set references
        for (Map.Entry<String, ReferencePatterns> entry : getReferences().entrySet()) {
            String referenceName = entry.getKey();
            GReferenceInfo referenceInfo = gbeanInfo.getReference(referenceName);
            if (referenceInfo == null) {
                throw new InvalidConfigException("No reference: " + referenceName + " for gbean: " + data.getAbstractName());
            }

            ReferencePatterns referencePatterns = entry.getValue();
View Full Code Here

    private AbstractNameQuery buildAbstractNameQuery(String refName, PatternType pattern) throws DeploymentException {
//        if (refName == null) {
//            throw new DeploymentException("No type specified in dependency pattern " + pattern + " for gbean " + gbean.getName());
//        }
        assert refName != null;
        GReferenceInfo referenceInfo = null;
        Set referenceInfos = gbean.getGBeanInfo().getReferences();
        for (Iterator iterator = referenceInfos.iterator(); iterator.hasNext();) {
            GReferenceInfo testReferenceInfo = (GReferenceInfo) iterator.next();
            String testRefName = testReferenceInfo.getName();
            if (testRefName.equals(refName)) {
                referenceInfo = testReferenceInfo;
            }
        }
        if (referenceInfo == null) {
View Full Code Here

        }

        // set references
        for (Map.Entry<String, ReferencePatterns> entry : getReferences().entrySet()) {
            String referenceName = entry.getKey();
            GReferenceInfo referenceInfo = gbeanInfo.getReference(referenceName);
            if (referenceInfo == null) {
                throw new InvalidConfigException("No reference: " + referenceName + " for gbean: " + data.getAbstractName());
            }

            ReferencePatterns referencePatterns = entry.getValue();
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gbean.GReferenceInfo

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.