Examples of GerConfigPropertySettingType


Examples of org.apache.geronimo.xbeans.connector.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.connector.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.connector.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.connector.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.connector.GerConfigPropertySettingType

            }
        }
        settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
        GerConfigPropertySettingType[] configs = getConfigProperties();
        for (int i = configs.length-1; i>=0; --i) {
            GerConfigPropertySettingType type = configs[i];
            if(!saved.contains(type.getName())) {
                removeConfigProperty(i);
            }
        }
    }
View Full Code Here

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

            DDBean item = all[i];
            byName.put(item.getText("config-property-name")[0], item);
        }
        GerConfigPropertySettingType[] previous = getConfigProperties();
        for (int i = 0; i < previous.length; i++) {
            GerConfigPropertySettingType setting = previous[i];
            DDBean item = (DDBean) byName.remove(setting.getName());
            if(item != null) {
                list.add(new ConfigPropertySetting(item, setting, false));
            } else {
                System.out.println("Ignoring connectiondefinition-instance/config-setting "+setting.getName()+" (no matching config-property in J2EE DD)");
                //todo: delete it from the XMLBeans tree
            }
        }
        for (Iterator it = byName.keySet().iterator(); it.hasNext();) {
            String name = (String) it.next();
View Full Code Here

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

            }
        }
        settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
        GerConfigPropertySettingType[] configs = getConfigProperties();
        for (int i = configs.length-1; i>=0; --i) {
            GerConfigPropertySettingType type = configs[i];
            if(!saved.contains(type.getName())) {
                removeConfigProperty(i);
            }
        }
    }
View Full Code Here

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

            DDBean item = all[i];
            byName.put(item.getText("config-property-name")[0], item);
        }
        GerConfigPropertySettingType[] previous = getConfigProperties();
        for (int i = 0; i < previous.length; i++) {
            GerConfigPropertySettingType setting = previous[i];
            DDBean item = (DDBean) byName.remove(setting.getName());
            if(item != null) {
                list.add(new ConfigPropertySetting(item, setting, false));
            } else {
                System.out.println("Ignoring connectiondefinition-instance/config-setting "+setting.getName()+" (no matching config-property in J2EE DD)");
                //todo: delete it from the XMLBeans tree
            }
        }
        for (Iterator it = byName.keySet().iterator(); it.hasNext();) {
            String name = (String) it.next();
View Full Code Here

Examples of org.apache.geronimo.xbeans.connector.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.connector.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
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.