Examples of ModuleInitializationException


Examples of org.fcrepo.server.errors.ModuleInitializationException

    @Override
    public void postInitModule() throws ModuleInitializationException {
        try {
            m_llstore = new DefaultLowlevelStorage(getModuleParameters());
        } catch (LowlevelStorageException e) {
            throw new ModuleInitializationException(e.getMessage(), getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        String param =
                getModuleParameter("backslash_is_escape", false).toLowerCase();
        if (param.equals("true") || param.equals("false")) {
            backslashIsEscape = param;
        } else {
            throw new ModuleInitializationException("backslash_is_escape parameter must be either true or false",
                                                    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());
        }

        ConnectionPool cPool;
        try {
            cPool = cpm.getPool();
        } catch (ConnectionPoolNotFoundException e1) {
            throw new ModuleInitializationException("Could not find requested "
                    + "connectionPool.", getRole());
        }

        Map<String, Object> configuration = new HashMap<String, Object>();
        configuration.put(DefaultLowlevelStorage.FILESYSTEM, filesystem);
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            throws ModuleInitializationException {
        String parameterValue =
                getParameter(parameterName, parameterAsAbsolutePath);

        if (parameterValue == null) {
            throw new ModuleInitializationException(parameterName
                    + " parameter must be specified", getRole());
        }
        return parameterValue;
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

                    .append(ServerState.STARTING,
                            "Initializing XACML Authorization Module");
            xacmlPep = getServer().getBean(PolicyEnforcementPoint.class.getName(), PolicyEnforcementPoint.class);
            xacmlPep.newPdp();
        } catch (Throwable e1) {
            throw new ModuleInitializationException(e1.getMessage(),
                                                    getRole(),
                                                    e1);
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    }

    @Override
    public void postInitModule() throws ModuleInitializationException {
        if (m_impl == null) {
            throw new ModuleInitializationException("Error initializing: "
                    + "no ILowlevelStorage impl ", getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        try {
            Server s_server = getServer();
            logger.debug("DefaultBackendSecurity initialized");
            String fedoraHome = Constants.FEDORA_HOME;
            if (fedoraHome == null) {
                throw new ModuleInitializationException("[DefaultBackendSecurity] Module failed to initialize: "
                                                                + "FEDORA_HOME is undefined",
                                                        getRole());
            } else {
                m_beSecurityPath = fedoraHome + "/server/config/beSecurity.xml";
            }
            logger.debug("m_beSecurityPath: " + m_beSecurityPath);

            String validate = getParameter("beSecurity_validation");
            if (validate != null) {
                if (!validate.equals("true") && !validate.equals("false")) {
                    logger.warn("Validation setting for backend "
                                    + "security configuration file must be either \"true\" or \"false\". "
                                    + "Value specified was: \"" + validate
                                    + "\". Validation is defaulted to "
                                    + "\"false\".");
                } else {
                    m_validate = new Boolean(validate).booleanValue();
                }
            } else {
                logger.warn("Validation setting for backend "
                                + "security configuration file was not specified. Validation is defaulted to "
                                + "\"false\".");
            }
            logger.debug("beSecurity_validate: " + m_validate);

            m_encoding = getParameter("beSecurity_char_encoding");
            if (m_encoding == null) {
                m_encoding = "utf-8";
                logger.warn("Character encoding for backend "
                        + "security configuration file was not specified. Encoding defaulted to "
                        + "\"utf-8\".");
            }
            logger.debug("beSecurity_char_encoding: " + m_encoding);

            // initialize static BackendSecuritySpec instance
            setBackendSecuritySpec();
            if (logger.isDebugEnabled()) {
                Set roleList = beSS.listRoleKeys();
                Iterator iter = roleList.iterator();
                while (iter.hasNext()) {
                    logger.debug("beSecurity ROLE: " + iter.next());
                }
            }

        } catch (Throwable th) {
            throw new ModuleInitializationException("[DefaultBackendSecurity] "
                    + "BackendSecurity "
                    + "could not be instantiated. The underlying error was a "
                    + th.getClass().getName() + "The message was \""
                    + th.getMessage() + "\".", getRole());
        }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            m_enforceMode = moduleParameters.get(ENFORCE_MODE_CONFIG_KEY);
            if (ENFORCE_MODE_ENFORCE_POLICIES.equals(m_enforceMode)) {
            } else if (ENFORCE_MODE_PERMIT_ALL_REQUESTS.equals(m_enforceMode)) {
            } else if (ENFORCE_MODE_DENY_ALL_REQUESTS.equals(m_enforceMode)) {
            } else {
                throw new ModuleInitializationException("invalid enforceMode from config \"" + m_enforceMode + "\"", ROLE);
            }
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

     *         If initialization values are invalid or initialization fails for
     *         some other reason.
     */
    public void initModule() throws ModuleInitializationException {
        if (1 == 2) {
            throw new ModuleInitializationException(null, null);
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

     *         If initialization values are invalid or initialization fails for
     *         some other reason.
     */
    public void postInitModule() throws ModuleInitializationException {
        if (1 == 2) {
            throw new ModuleInitializationException(null, null);
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            min = "5";
        }
        try {
            m_uploadStorageMinutes = Integer.parseInt(min);
            if (m_uploadStorageMinutes < 1) {
                throw new ModuleInitializationException("uploadStorageMinutes "
                                                        + "must be 1 or more, if specified.", getRole());
            }
        } catch (NumberFormatException nfe) {
            throw new ModuleInitializationException("uploadStorageMinutes must "
                                                    + "be an integer, if specified.",
                                                    getRole());
        }
        // initialize storage area by 1) ensuring the directory is there
        // and 2) reading in the existing files, if any, and setting their
        // startTime to the current time.
        try {
            m_tempDir = getServer().getUploadDir();
            if (!m_tempDir.isDirectory()) {
                m_tempDir.mkdirs();
                if (!m_tempDir.isDirectory()) {
                    throw new ModuleInitializationException(
                            "Failed to create temp dir at " +
                                    m_tempDir.toString(), getRole());
                }
            }

            // put leftovers in hash, while saving highest id as m_lastId
            m_uploadStartTime = new Hashtable<String, Long>();
            String[] fNames = m_tempDir.list();
            Long leftoverStartTime = new Long(System.currentTimeMillis());
            m_lastId = 0;
            for (String element : fNames) {
                try {
                    int id = Integer.parseInt(element);
                    if (id > m_lastId) {
                        m_lastId = id;
                    }
                    m_uploadStartTime.put(element, leftoverStartTime);
                } catch (NumberFormatException nfe) {
                    // skip files that aren't named numerically
                }
            }
        } catch (Exception e) {
            throw new ModuleInitializationException("Error while initializing "
                                                    + "temporary storage area: " + e.getClass().getName()
                                                    + ": " + e.getMessage(), getRole(), e);
        }

        // initialize variables pertaining to checksumming datastreams.
        String auto = getParameter("autoChecksum");
        logger.debug("Got Parameter: autoChecksum = " + auto);
        if (auto != null && auto.equalsIgnoreCase("true")) {
            Datastream.autoChecksum = true;
            Datastream.defaultChecksumType = getParameter("checksumAlgorithm");
        }
        logger.debug("autoChecksum is " + auto);
        logger.debug("defaultChecksumType is " + Datastream.defaultChecksumType);

        // get delay between purge of two uploaded files (default 1 minute)
        String purgeDelayInMillis = getParameter("purgeDelayInMillis");
        if (purgeDelayInMillis == null) {
            purgeDelayInMillis = "60000";
        }
        try {
            this.m_purgeDelayInMillis = Integer.parseInt(purgeDelayInMillis);
        } catch (NumberFormatException nfe) {
            throw new ModuleInitializationException(
                    "purgeDelayInMillis must be an integer, if specified.",
                    getRole());
        }
    }
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.