Package org.castor.jdo.conf

Examples of org.castor.jdo.conf.Param


                String jdbcUrl = driver.getUrl();
                Param[] params = driver.getParam();
                Properties props = new Properties();

                for (int i = 0; i < params.length; i++) {
                Param p = params[i];
                props.setProperty(p.getName(), p.getValue());
                }

                _conn = DriverManager.getConnection(jdbcUrl, props);
            } catch (Exception e) {
                throw new DTXException(e);
View Full Code Here


     * {@inheritDoc}
     * @see org.castor.jdo.engine.AbstractConnectionFactory#initializeFactory()
     */
    public void initializeFactory() throws MappingException {
        Enumeration params;
        Param       param;
       
        DatabaseChoice dbChoice = getDatabase().getDatabaseChoice();
        String driverName = dbChoice.getDriver().getClassName();
        if (driverName != null) {
            try {
                Class.forName(driverName).newInstance();
            } catch (InstantiationException e) {
                String msg = Messages.format(
                        "jdo.engine.classNotInstantiable", driverName);
                LOG.error(msg, e);
                throw new MappingException(msg, e);
            } catch (IllegalAccessException e) {
                String msg = Messages.format(
                        "jdo.engine.classNotAccessable", driverName, "constructor");
                LOG.error(msg, e);
                throw new MappingException(msg, e);
            } catch (ClassNotFoundException e) {
                String msg = "Can not load class " + driverName;
                LOG.error(msg, e);
                throw new MappingException(msg, e);
            }
        }
       
        try {
            Driver driver = dbChoice.getDriver();
            if (DriverManager.getDriver(driver.getUrl()) == null) {
                String msg = Messages.format("jdo.missingDriver", driver.getUrl());
                LOG.error(msg);
                throw new MappingException(msg);
            }
        } catch (SQLException ex) {
            throw new MappingException(ex);
        }
       
        _url = dbChoice.getDriver().getUrl();
       
        _props = new Properties();
        params = dbChoice.getDriver().enumerateParam();
        while (params.hasMoreElements()) {
            param = (Param) params.nextElement();
            _props.put(param.getName(), param.getValue());
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Using driver: " + driverName);
        }
View Full Code Here

     * @param name Parameter name.
     * @param value Parameter value.
     * @return Param object.
     */
    private static Param createParam(final String name, final String value) {
        Param param = new Param();
        param.setName(name);
        param.setValue(value);
        return param;
    }
View Full Code Here

        TransactionDemarcation demarcation = _jdoConf.getTransactionDemarcation();
        TransactionManager manager = demarcation.getTransactionManager();
        if (manager != null) {
            Enumeration parameters = manager.enumerateParam();
            while (parameters.hasMoreElements()) {
                Param param = (Param) parameters.nextElement();
                properties.put(param.getName(), param.getValue());
            }
        }
        return properties;
    }
View Full Code Here

TOP

Related Classes of org.castor.jdo.conf.Param

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.