Package org.fcrepo.server

Examples of org.fcrepo.server.DatastoreConfig


            // Pool names should be comma delimited
            String[] poolNames = poolList.split(",");

            // Initialize each connection pool
            for (int i = 0; i < poolNames.length; i++) {
                DatastoreConfig config =
                        s_server.getDatastoreConfig(poolNames[i]);
                jdbcDriverClass = config.getParameter("jdbcDriverClass");
                dbUsername = config.getParameter("dbUsername");
                dbPassword = config.getParameter("dbPassword");
                jdbcURL = config.getParameter("jdbcURL");
                maxActive =
                        new Integer(config.getParameter("maxActive"))
                                .intValue();
                maxIdle =
                        new Integer(config.getParameter("maxIdle")).intValue();
                maxWait =
                        new Integer(config.getParameter("maxWait")).intValue();
                minIdle =
                        new Integer(config.getParameter("minIdle")).intValue();
                numTestsPerEvictionRun =
                        new Integer(config
                                .getParameter("numTestsPerEvictionRun"))
                                .intValue();
                minEvictableIdleTimeMillis =
                        new Long(config
                                .getParameter("minEvictableIdleTimeMillis"))
                                .longValue();
                timeBetweenEvictionRunsMillis =
                        new Long(config
                                .getParameter("timeBetweenEvictionRunsMillis"))
                                .longValue();
                validationQuery = config.getParameter("validationQuery");
                testOnBorrow =
                        new Boolean(config.getParameter("testOnBorrow"))
                                .booleanValue();
                testOnReturn =
                        new Boolean(config.getParameter("testOnReturn"))
                                .booleanValue();
                testWhileIdle =
                        new Boolean(config.getParameter("testWhileIdle"))
                                .booleanValue();
                whenExhaustedAction =
                        new Byte(config.getParameter("whenExhaustedAction"))
                                .byteValue();
                if (whenExhaustedAction != 0 && whenExhaustedAction != 1
                        && whenExhaustedAction != 2) {
                    logger.debug("Valid values for whenExhaustedAction are: 0 - (fail), 1 - (block), or 2 - (grow)");
                    throw new ModuleInitializationException("A connection pool could "
                            + "not be instantiated. The underlying error was an "
                            + "invalid value for the whenExhaustedAction parameter."
                            + "Valid values are 0 - (fail), 1 - (block), or 2 - (grow). Value specified"
                            + "was \"" + whenExhaustedAction + "\".", getRole());
                }

                if (logger.isDebugEnabled()) {
                    logger.debug("poolName[" + i + "] = " + poolNames[i]);
                    logger.debug("JDBC driver: " + jdbcDriverClass);
                    logger.debug("Database username: " + dbUsername);
                    logger.debug("Database password: " + dbPassword);
                    logger.debug("JDBC connection URL: " + jdbcURL);
                    logger.debug("Maximum active connections: " + maxActive);
                    logger.debug("Maximum idle connections: " + maxIdle);
                    logger.debug("Maximum wait time: " + maxWait);
                    logger.debug("Minimum idle time: " + minIdle);
                    logger.debug("Number of tests per eviction run: "
                            + numTestsPerEvictionRun);
                    logger.debug("Minimum Evictable Idle time: "
                            + minEvictableIdleTimeMillis);
                    logger.debug("Minimum Evictable Idle time: "
                            + timeBetweenEvictionRunsMillis);
                    logger.debug("Validation query: " + validationQuery);
                    logger.debug("Test on borrow: " + testOnBorrow);
                    logger.debug("Test on return: " + testOnReturn);
                    logger.debug("Test while idle: " + testWhileIdle);
                    logger.debug("whenExhaustedAction: " + whenExhaustedAction);
                }

                // Treat any parameters whose names start with "connection."
                // as connection parameters
                Map<String, String> cProps = new HashMap<String, String>();
                for (String name : config.getParameters().keySet()) {
                    if (name.startsWith("connection.")) {
                        String realName = name.substring(11);
                        logger.debug("Connection property " + realName + " = "
                                + config.getParameter(name));
                        cProps.put(realName, config.getParameter(name));
                    }
                }

                // If a ddlConverter has been specified for the pool,
                // try to instantiate it so the ConnectionPool can use
View Full Code Here


        Iterator<String> parameters = parameterNames();
        String param;
        while (parameters.hasNext()) {
            param = parameters.next();
            if (param.startsWith("datastore")) {
                DatastoreConfig dsConfig = getDatastore(param);
                String[] msgTypes =
                        dsConfig.getParameter("messageTypes").split(" ");
                for (String msgType : msgTypes) {
                    if (!mdMap.containsKey(msgType)) {
                        throw new ModuleInitializationException(msgType
                                + " is not a supported MessageType.", getRole());
                    }
                }

                String destName = dsConfig.getParameter("name");
                String type = dsConfig.getParameter("type");
                boolean transacted =
                        Boolean.parseBoolean(dsConfig
                                .getParameter("transacted"));
                String ackMode = dsConfig.getParameter("ackMode");

                DestinationType destType = DestinationType.Topic;
                if (type.equalsIgnoreCase("queue")) {
                    destType = DestinationType.Queue;
                }
View Full Code Here

        String value = getParameter(name);
        if (value == null || value.length() == 0) {
            throw new ModuleInitializationException(name + " parameter "
                    + "is required", getRole());
        }
        DatastoreConfig dsConfig = getServer().getDatastoreConfig(value);
        if (dsConfig == null) {
            throw new ModuleInitializationException(value + " datastore "
                    + "configuration is missing.", getRole());
        }
        return dsConfig;
View Full Code Here

TOP

Related Classes of org.fcrepo.server.DatastoreConfig

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.