Examples of GerConfigPropertySettingType


Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

        Set xmlBeans = new HashSet(Arrays.asList(configPropertiesSource.getConfigPropertySettingArray()));
        for (int i = 0; i < beans.length; i++) {
            DDBean bean = beans[i];
            String[] names = bean.getText(configPropertyNameXPath);
            String name = names.length == 1 ? names[0] : "";
            GerConfigPropertySettingType target = null;
            for (Iterator it = xmlBeans.iterator(); it.hasNext();) {
                GerConfigPropertySettingType setting = (GerConfigPropertySettingType) it.next();
                if (setting.getName().equals(name)) {
                    target = setting;
                    xmlBeans.remove(target);
                    break;
                }
            }
            if (target == null) {
                target = configPropertiesSource.addNewConfigPropertySetting();
            }
            configs[i] = new ConfigPropertySettings();
            configs[i].initialize(target, bean);
        }
        for (Iterator it = xmlBeans.iterator(); it.hasNext();) { // used to be in XmlBeans, no longer anything matching in J2EE DD
            GerConfigPropertySettingType target = (GerConfigPropertySettingType) it.next();
            GerConfigPropertySettingType[] xmlConfigs = configPropertiesSource.getConfigPropertySettingArray();
            for (int i = 0; i < xmlConfigs.length; i++) {
                if (xmlConfigs[i] == target) {
                    configPropertiesSource.removeConfigPropertySetting(i);
                    break;
                }
            }
        }
        configPropertiesSource.setConfigPropertySettings(configs);
        XpathListener configListener = new XpathListener() {
            public void fireXpathEvent(XpathEvent xpe) {
                ConfigPropertySettings[] configs = configPropertiesSource.getConfigPropertySettings();
                if (xpe.isAddEvent()) {
                    ConfigPropertySettings[] bigger = new ConfigPropertySettings[configs.length + 1];
                    System.arraycopy(configs, 0, bigger, 0, configs.length);
                    bigger[configs.length] = new ConfigPropertySettings();
                    bigger[configs.length].initialize(configPropertiesSource.addNewConfigPropertySetting(), xpe.getBean());
                    configPropertiesSource.setConfigPropertySettings(bigger);
                } else if (xpe.isRemoveEvent()) {
                    int index = -1;
                    for (int i = 0; i < configs.length; i++) {
                        if (configs[i].matches(xpe.getBean())) {
                            // remove the XMLBean
                            GerConfigPropertySettingType[] xmlConfigs = configPropertiesSource.getConfigPropertySettingArray();
                            for (int j = 0; j < xmlConfigs.length; j++) {
                                GerConfigPropertySettingType test = xmlConfigs[j];
                                if (test == configs[i].getConfigPropertySetting()) {
                                    configPropertiesSource.removeConfigPropertySetting(j);
                                    break;
                                }
                            }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

                getOutboundResourceadapter().getConnectionDefinitionArray(0).
                getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
        assertEquals(2, settings.length);
        Set seen = new HashSet();
        for (int i = 0; i < settings.length; i++) {
            GerConfigPropertySettingType setting = settings[i];
            if(seen.contains(setting.getName())) {
                fail("Duplicate for config property setting '"+setting.getName()+"'");
            }
            seen.add(setting.getName());
// These two are set to their defaults and now no longer appear
//            if(setting.getName().equals("CommitBeforeAutocommit")) {
//                assertEquals("false", setting.getStringValue());
//            } else if(setting.getName().equals("ExceptionSorterClass")) {
//                assertEquals("org.tranql.connector.AllExceptionsAreFatalSorter", setting.getStringValue());
            if(setting.getName().equals("Driver")) {
                assertEquals("org.apache.derby.jdbc.EmbeddedDriver", setting.getStringValue());
            } else if(setting.getName().equals("ConnectionURL")) {
                assertEquals("jdbc:derby:TestDatabase;create=true", setting.getStringValue());
            } else fail("Unknown connection setting '"+setting.getName()+"'");
        }
        // Make sure the original objects didn't lose track of the null config settings
        assertEquals(6, instance.getConfigPropertySetting().length);
        // Now set them to blank
        nullCount = 0;
        for (int i = 0; i < 6; i++) {
            if(instance.getConfigPropertySetting()[i].getValue() == null || instance.getConfigPropertySetting()[i].isSetToDefault()) {
                instance.getConfigPropertySetting()[i].setValue("");
                ++nullCount;
            }
        }
        assertEquals(4, nullCount);
        // Now make sure we write out with 6
        pout = new ByteArrayOutputStream();
        dcbRoot.toXML(pout);
        pout.close();
        pin = new ByteArrayInputStream(pout.toByteArray());
        doc = GerConnectorDocument.Factory.parse(pin);
        pin.close();
        settings = doc.getConnector().getResourceadapterArray(0).
                getOutboundResourceadapter().getConnectionDefinitionArray(0).
                getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
        assertEquals(6, settings.length);
        seen.clear();
        for (int i = 0; i < settings.length; i++) {
            GerConfigPropertySettingType setting = settings[i];
            if(seen.contains(setting.getName())) {
                fail("Duplicate for config property setting '"+setting.getName()+"'");
            }
            seen.add(setting.getName());
            if(setting.getName().equals("UserName")) {
                assertEquals("", setting.getStringValue());
            } else if(setting.getName().equals("Password")) {
                assertEquals("", setting.getStringValue());
            } else if(setting.getName().equals("CommitBeforeAutocommit")) {
                assertEquals("", setting.getStringValue());
            } else if(setting.getName().equals("Driver")) {
                assertEquals("org.apache.derby.jdbc.EmbeddedDriver", setting.getStringValue());
            } else if(setting.getName().equals("ExceptionSorterClass")) {
                assertEquals("", setting.getStringValue());
            } else if(setting.getName().equals("ConnectionURL")) {
                assertEquals("jdbc:derby:TestDatabase;create=true", setting.getStringValue());
            } else fail("Unknown connection setting '"+setting.getName()+"'");
        }
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

        GerConfigPropertySettingType[] settings = doc.getConnector().getResourceadapterArray(0).
                getResourceadapterInstance().getConfigPropertySettingArray();
        assertEquals(2, settings.length);
        seen.clear();
        for (int i = 0; i < settings.length; i++) {
            GerConfigPropertySettingType setting = settings[i];
            if(seen.contains(setting.getName())) {
                fail("Duplicate for config property setting '"+setting.getName()+"'");
            }
            seen.add(setting.getName());
            if(setting.getName().equals("UserName")) {
                assertEquals("geronimo-user", setting.getStringValue());
            } else if(setting.getName().equals("Password")) {
                assertEquals("geronimo-pw", setting.getStringValue());
            } else fail("Unknown connection setting '"+setting.getName()+"'");
        }
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

        if (configPropertySettings.length == 0) {
            //we are new
            for (int i = 0; i < configProperties.length; i++) {
                DDBean configProperty = configProperties[i];
                GerConfigPropertySettingType configPropertySetting = configPropertiesSource.addNewConfigPropertySetting();
                String name = configProperty.getText(configPropertyNameXPath)[0];
                ConfigPropertySettingDConfigBean configPropertySettingDConfigBean = new ConfigPropertySettingDConfigBean(configProperty, configPropertySetting);
                configPropertiesMap.put(name, configPropertySettingDConfigBean);
            }
        } else {
            //we are read in from xml.  Check correct length
            assert configProperties.length == configPropertySettings.length;
            for (int i = 0; i < configProperties.length; i++) {
                DDBean configProperty = configProperties[i];
                GerConfigPropertySettingType configPropertySetting = configPropertySettings[i];
                String name = configProperty.getText(configPropertyNameXPath)[0];
                assert name.equals(configPropertySetting.getName());
                ConfigPropertySettingDConfigBean configPropertySettingDConfigBean = new ConfigPropertySettingDConfigBean(configProperty, configPropertySetting);
                configPropertiesMap.put(name, configPropertySettingDConfigBean);
            }
        }
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

        Set xmlBeans = new HashSet(Arrays.asList(configPropertiesSource.getConfigPropertySettingArray()));
        for (int i = 0; i < beans.length; i++) {
            DDBean bean = beans[i];
            String[] names = bean.getText(configPropertyNameXPath);
            String name = names.length == 1 ? names[0] : "";
            GerConfigPropertySettingType target = null;
            for (Iterator it = xmlBeans.iterator(); it.hasNext();) {
                GerConfigPropertySettingType setting = (GerConfigPropertySettingType) it.next();
                if (setting.getName().equals(name)) {
                    target = setting;
                    xmlBeans.remove(target);
                    break;
                }
            }
            if (target == null) {
                target = configPropertiesSource.addNewConfigPropertySetting();
            }
            configs[i] = new ConfigPropertySettings();
            configs[i].initialize(target, bean);
        }
        for (Iterator it = xmlBeans.iterator(); it.hasNext();) { // used to be in XmlBeans, no longer anything matching in J2EE DD
            GerConfigPropertySettingType target = (GerConfigPropertySettingType) it.next();
            GerConfigPropertySettingType[] xmlConfigs = configPropertiesSource.getConfigPropertySettingArray();
            for (int i = 0; i < xmlConfigs.length; i++) {
                if (xmlConfigs[i] == target) {
                    configPropertiesSource.removeConfigPropertySetting(i);
                    break;
                }
            }
        }
        configPropertiesSource.setConfigPropertySettings(configs);
        XpathListener configListener = new XpathListener() {
            public void fireXpathEvent(XpathEvent xpe) {
                ConfigPropertySettings[] configs = configPropertiesSource.getConfigPropertySettings();
                if (xpe.isAddEvent()) {
                    ConfigPropertySettings[] bigger = new ConfigPropertySettings[configs.length + 1];
                    System.arraycopy(configs, 0, bigger, 0, configs.length);
                    bigger[configs.length] = new ConfigPropertySettings();
                    bigger[configs.length].initialize(configPropertiesSource.addNewConfigPropertySetting(), xpe.getBean());
                    configPropertiesSource.setConfigPropertySettings(bigger);
                } else if (xpe.isRemoveEvent()) {
                    int index = -1;
                    for (int i = 0; i < configs.length; i++) {
                        if (configs[i].matches(xpe.getBean())) {
                            // remove the XMLBean
                            GerConfigPropertySettingType[] xmlConfigs = configPropertiesSource.getConfigPropertySettingArray();
                            for (int j = 0; j < xmlConfigs.length; j++) {
                                GerConfigPropertySettingType test = xmlConfigs[j];
                                if (test == configs[i].getConfigPropertySetting()) {
                                    configPropertiesSource.removeConfigPropertySetting(j);
                                    break;
                                }
                            }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

    }

    private Map getExplicitValuesMap(GerConfigPropertySettingType[] configPropertySettings) {
        Map explicitValues = new HashMap();
        for (int j = 0; j < configPropertySettings.length; j++) {
            GerConfigPropertySettingType configPropertySetting = configPropertySettings[j];
            String name = configPropertySetting.getName();
            String value = configPropertySetting.getStringValue();
            explicitValues.put(name, value);
        }
        return explicitValues;
    }
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

        InputStream is = new ByteArrayInputStream(bytes);
        GerConnectorDocument gcDoc = GerConnectorDocument.Factory.parse(is);
        GerResourceadapterType ra = gcDoc.getConnector().getResourceadapterArray()[0];
        GerResourceadapterInstanceType rai = ra.getResourceadapterInstance();
        assertEquals("TestRAName", rai.getResourceadapterName());
        GerConfigPropertySettingType rasetting = rai.getConfigPropertySettingArray(0);
        assertEquals("TestRAValue", rasetting.getStringValue());

        //admin object
//        GerAdminobjectType adminobjectType1 = ra.getAdminobjectArray(0);
//        GerAdminobjectInstanceType adminobjectInstanceType2 = adminobjectType1.getAdminobjectInstanceArray(0);
//        assertEquals("TestAOValue1", adminobjectInstanceType2.getConfigPropertySettingArray(0).getStringValue());
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

                PropertyEditor editor = PropertyEditors.findEditor(configProperty.getConfigPropertyType().getStringValue());
                String valueString = null;
                if (editor != null) {
//look for explicit value setting
                    for (int j = 0; j < configPropertySettings.length; j++) {
                        GerConfigPropertySettingType configPropertySetting = configPropertySettings[j];
                        if (configPropertySetting.getName().equals(configProperty.getConfigPropertyName().getStringValue())) {
                            valueString = configPropertySetting.getStringValue();
                            break;
                        }
                    }
//look for default value
                    if (valueString == null) {
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

        InputStream is = new ByteArrayInputStream(bytes);
        GerConnectorDocument gcDoc = GerConnectorDocument.Factory.parse(is);
        GerResourceadapterType ra = gcDoc.getConnector().getResourceadapter();
        GerResourceadapterInstanceType rai = ra.getResourceadapterInstance();
        assertEquals("TestRAName", rai.getResourceadapterName());
        GerConfigPropertySettingType rasetting = rai.getConfigPropertySettingArray(0);
        assertEquals("TestRAValue", rasetting.getStringValue());

        //admin object
        GerAdminobjectType adminobjectType1 = ra.getAdminobjectArray(0);
        GerAdminobjectInstanceType adminobjectInstanceType2 = adminobjectType1.getAdminobjectInstanceArray(0);
        assertEquals("TestAOValue1", adminobjectInstanceType2.getConfigPropertySettingArray(0).getStringValue());
View Full Code Here

Examples of org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType

                PropertyEditor editor = PropertyEditors.findEditor(configProperty.getConfigPropertyType().getStringValue());
                String valueString = null;
                if (editor != null) {
//look for explicit value setting
                    for (int j = 0; j < configPropertySettings.length; j++) {
                        GerConfigPropertySettingType configPropertySetting = configPropertySettings[j];
                        if (configPropertySetting.getName().equals(configProperty.getConfigPropertyName().getStringValue())) {
                            valueString = configPropertySetting.getStringValue();
                            break;
                        }
                    }
//look for default value
                    if (valueString == null) {
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.