Examples of ModuleInitializationException


Examples of org.fcrepo.server.errors.ModuleInitializationException

        } else if (VALUE_RECOVERY_LOG_LEVEL_MEDIUM.equals(level)) {
            logLevel = LEVEL_MEDIUM;
        } else if (VALUE_RECOVERY_LOG_LEVEL_LOW.equals(level)) {
            logLevel = LEVEL_LOW;
        } else {
            throw new ModuleInitializationException("'"
                    + PARAMETER_RECOVERY_LOG_LEVEL + "' parameter must be '"
                    + VALUE_RECOVERY_LOG_LEVEL_LOW + "'(default), '"
                    + VALUE_RECOVERY_LOG_LEVEL_MEDIUM + "' or '"
                    + VALUE_RECOVERY_LOG_LEVEL_HIGH + "'", role);
        }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        } else if (mode.equals(VALUE_JOURNAL_MODE_NORMAL)) {
            inRecoveryMode = false;
        } else if (mode.equals(VALUE_JOURNAL_MODE_RECOVER)) {
            inRecoveryMode = true;
        } else {
            throw new ModuleInitializationException("'"
                                                    + PARAMETER_JOURNAL_MODE + "' parameter must be '"
                                                    + VALUE_JOURNAL_MODE_NORMAL + "'(default) or '"
                                                    + VALUE_JOURNAL_MODE_RECOVER + "'", getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        }
    }

    private void assertInitialized() throws SoapFault {
        if (m_server == null) {
            CXFUtility.throwFault(new ModuleInitializationException("Null was injected for Server to WS implementor",
                    "org.fcrepo.server.access.FedoraAPIA"));
        }
        if (m_access == null) {
            CXFUtility.throwFault(new ModuleInitializationException("No Access module found for WS implementor",
                    "org.fcrepo.server.access.FedoraAPIA"));
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            throws ModuleInitializationException {
        super(parameters, role, server);

        try {
            if (!parameters.containsKey(PARAMETER_RECOVERY_LOG_FILENAME)) {
                throw new ModuleInitializationException("Parameter '"
                                                                + PARAMETER_RECOVERY_LOG_FILENAME
                                                                + "' is not set.",
                                                        role);
            }
            String fileNameTemplate =
                    parameters.get(PARAMETER_RECOVERY_LOG_FILENAME);
            fileName =
                    JournalHelper.createTimestampedFilename(fileNameTemplate,
                                                            new Date());
            tempFileName = insertHyphenBeforeFilename(fileName);
            logFile = new File(tempFileName);
            writer = new FileWriter(logFile);

            super.logHeaderInfo(parameters);
        } catch (IOException e) {
            throw new ModuleInitializationException("Problem writing to the recovery log",
                                                    role,
                                                    e);
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

                            (DOSerializer) Class
                                    .forName(getParameter(paramName))
                                    .newInstance();
                    serMap.put(serName, ser);
                } catch (Exception e) {
                    throw new ModuleInitializationException("Can't instantiate serializer class for format "
                                                                    + serName,
                                                            getRole(),
                                                            e);
                }
            } else if (paramName.startsWith(DESER_PARAM_PREFIX)) {
                String deserName =
                        paramName.substring(DESER_PARAM_PREFIX.length());
                try {
                    DODeserializer deser =
                            (DODeserializer) Class
                                    .forName(getParameter(paramName))
                                    .newInstance();
                    deserMap.put(deserName, deser);
                } catch (Exception e) {
                    throw new ModuleInitializationException("Can't instantiate deserializer class for format "
                                                                    + deserName,
                                                            getRole(),
                                                            e);
                }
            }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        //
        // get and validate maxResults
        //
        if (getParameter("maxResults") == null) {
            throw new ModuleInitializationException("maxResults parameter must be specified.",
                                                    getRole());
        }
        int maxResults = 0;
        try {
            maxResults = Integer.parseInt(getParameter("maxResults"));
            if (maxResults < 1) {
                throw new NumberFormatException("");
            }
        } catch (NumberFormatException nfe) {
            throw new ModuleInitializationException("maxResults must be a positive integer.",
                                                    getRole());
        }

        //
        // get and validate maxSecondsPerSession
        //
        if (getParameter("maxSecondsPerSession") == null) {
            throw new ModuleInitializationException("maxSecondsPerSession parameter must be specified.",
                                                    getRole());
        }
        int maxSecondsPerSession = 0;
        try {
            maxSecondsPerSession =
                    Integer.parseInt(getParameter("maxSecondsPerSession"));
            if (maxSecondsPerSession < 1) {
                throw new NumberFormatException("");
            }
        } catch (NumberFormatException nfe) {
            throw new ModuleInitializationException("maxSecondsPerSession must be a positive integer.",
                                                    getRole());
        }

        //
        // get indexDCFields parameter (default to true if unspecified)
        //
        boolean indexDCFields = true;
        String indexDCFieldsValue = getParameter("indexDCFields");
        if (indexDCFieldsValue != null) {
            String val = indexDCFieldsValue.trim().toLowerCase();
            if (val.equals("false") || val.equals("no")) {
                indexDCFields = false;
            } else if (!val.equals("true") && !val.equals("yes")) {
                throw new ModuleInitializationException("indexDCFields param "
                        + "was not a boolean", getRole());
            }
        }

        //
        // get connectionPool from ConnectionPoolManager
        //
        ConnectionPoolManager cpm =
                (ConnectionPoolManager) getServer()
                        .getModule("org.fcrepo.server.storage.ConnectionPoolManager");
        if (cpm == null) {
            throw new ModuleInitializationException("ConnectionPoolManager module was required, but apparently has "
                                                            + "not been loaded.",
                                                    getRole());
        }
        String cPoolName = getParameter("connectionPool");
        ConnectionPool cPool = null;
        try {
            if (cPoolName == null) {
                logger.debug("connectionPool unspecified; using default from "
                        + "ConnectionPoolManager.");
                cPool = cpm.getPool();
            } else {
                logger.debug("connectionPool specified: " + cPoolName);
                cPool = cpm.getPool(cPoolName);
            }
        } catch (ConnectionPoolNotFoundException cpnfe) {
            throw new ModuleInitializationException("Could not find requested "
                    + "connectionPool.", getRole());
        }
        //
        // get the doManager
        //
        DOManager doManager =
                (DOManager) getServer()
                        .getModule("org.fcrepo.server.storage.DOManager");
        if (doManager == null) {
            throw new ModuleInitializationException("DOManager module was required, but apparently has "
                                                            + "not been loaded.",
                                                    getRole());
        }
        //
        // things look ok...get the wrapped instance
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        super.postInitModule();

        // validate required param: GSEARCH_REST_URL
        _gSearchRESTURL = getParameter(GSEARCH_REST_URL);
        if (_gSearchRESTURL == null) {
            throw new ModuleInitializationException("Required parameter, "
                    + GSEARCH_REST_URL + " was not specified", getRole());
        } else {
            try {
                new URL(_gSearchRESTURL);
                logger.debug("Configured GSearch REST URL: " + _gSearchRESTURL);
            } catch (MalformedURLException e) {
                throw new ModuleInitializationException("Malformed URL given "
                        + "for " + GSEARCH_REST_URL + " parameter: "
                        + _gSearchRESTURL, getRole());
            }
        }

        // validate credentials: if GSEARCH_USERNAME is given, GSEARCH_PASSWORD
        // should also be.
        String user = getParameter(GSEARCH_USERNAME);
        if (user != null) {
            logger.debug("Will authenticate to GSearch service as user: " + user);
            String pass = getParameter(GSEARCH_PASSWORD);
            if (pass != null) {
                _gSearchCredentials =
                        new UsernamePasswordCredentials(user, pass);
            } else {
                throw new ModuleInitializationException(GSEARCH_PASSWORD
                        + " must be specified because " + GSEARCH_USERNAME
                        + " was specified", getRole());
            }
        } else {
            logger.debug(GSEARCH_USERNAME + " unspecified; will not attempt "
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        Properties jndiProps = getJNDISettings();

        try {
            jmsMgr = new JMSManager(jndiProps);
        } catch (Exception e) {
            throw new ModuleInitializationException(e.getMessage(), getRole());
        }

        try {
            String fedoraBaseUrl = ServerUtility.getBaseURL("http");
            msg =
                    new MessagingImpl(fedoraBaseUrl,
                                      createDestinations(),
                                      jmsMgr);
        } catch (Exception e) {
            throw new ModuleInitializationException("Error connecting to JMS ",
                                                    getRole(),
                                                    e);
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

                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;
                }

                int destAckMode = Session.AUTO_ACKNOWLEDGE;

                if (ackMode != null && ackMode.length() > 0) {
                    try {
                        destAckMode = Integer.parseInt(ackMode);
                    } catch (NumberFormatException e) {
                        throw new ModuleInitializationException("ackMode must be a number",
                                                                getRole());
                    }
                }

                try {
                    if (logger.isDebugEnabled()) {
                        logger.debug(String
                                .format("createDestination(%s, %s, %s, %s)",
                                        destName,
                                        destType,
                                        transacted,
                                        destAckMode));
                    }
                    jmsMgr.createDestination(destName,
                                             destType,
                                             transacted,
                                             destAckMode);
                } catch (Exception e) {
                    throw new ModuleInitializationException(e.getMessage(),
                                                            getRole());
                }

                for (String msgType : msgTypes) {
                    mdMap.get(msgType).add(destName);
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    private DatastoreConfig getDatastore(String name)
            throws ModuleInitializationException {
        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
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.