Examples of ModuleInitializationException


Examples of org.fcrepo.server.errors.ModuleInitializationException

        // Verify required modules have been loaded
        m_manager =
                getServer()
                        .getBean("org.fcrepo.server.storage.DOManager", DOManager.class);
        if (m_manager == null) {
            throw new ModuleInitializationException("Can't get a DOManager "
                                                    + "from Server.getModule", getRole());
        }
        m_contentManager =
                getServer()
                        .getBean("org.fcrepo.server.storage.ExternalContentManager", ExternalContentManager.class);
        if (m_contentManager == null) {
            throw new ModuleInitializationException("Can't get an ExternalContentManager "
                                                    + "from Server.getModule",
                                                    getRole());
        }

        m_fedoraXACMLModule =
                getServer()
                        .getBean("org.fcrepo.server.security.Authorization", Authorization.class);
        if (m_fedoraXACMLModule == null) {
            throw new ModuleInitializationException(
                    "Can't get Authorization module (in default management) from Server.getModule",
                    getRole());
        }

        Management m =
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            throws ModuleInitializationException {
        try {
            invocationHandlers = getInvocationHandlers();
            return (Management) ProxyFactory.getProxy(m, invocationHandlers);
        } catch (Exception e) {
            throw new ModuleInitializationException(e.getMessage(), 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.management.FedoraAPIM"));
        }
        if (m_management == null) {
            CXFUtility.throwFault(new ModuleInitializationException("No Management module found for WS implementor",
                    "org.fcrepo.server.management.FedoraAPIM"));
        }
    }
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.FedoraAPIAMTOM"));
        }
        if (m_access == null) {
            CXFUtility.throwFault(new ModuleInitializationException("No Access module found for WS implementor",
                    "org.fcrepo.server.access.FedoraAPIAMTOM"));
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            logger.info("JournalReader is " + journalReader.toString());
            return (JournalReader) journalReader;
        } catch (JournalException e) {
            String msg = "Can't create JournalReader";
            logger.error(msg, e);
            throw new ModuleInitializationException(msg, role, e);
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    public void postInitModule() throws ModuleInitializationException {
        m_manager =
                (DOManager) getServer()
                        .getModule("org.fcrepo.server.storage.DOManager");
        if (m_manager == null) {
            throw new ModuleInitializationException("[DynamicAccessModule] "
                    + "Can't get a DOManager from Server.getModule", getRole());
        }
        m_access =
                (Access) getServer().getModule("org.fcrepo.server.access.Access");
        if (m_access == null) {
            throw new ModuleInitializationException("[DynamicAccessModule] "
                                                            + "Can't get a ref to Access from Server.getModule",
                                                    getRole());
        }
        // Get the repository Base URL
        InetAddress hostIP = null;
        try {
            hostIP = InetAddress.getLocalHost();
        } catch (UnknownHostException uhe) {
            logger.error("Unable to resolve Fedora host", uhe);
        }
        String fedoraServerHost = getServer().getParameter("fedoraServerHost");
        if (fedoraServerHost == null || fedoraServerHost.equals("")) {
            fedoraServerHost = hostIP.getHostName();
        }
        reposHomeDir = getServer().getHomeDir();

        // FIXIT!! In the future, we want to read the repository configuration
        // file for the list of dynamic Service Definitions and their
        // associated internal service classes.  For now, we are explicitly
        // loading up the Default service def/dep since this is the only
        // thing supported in the system right now.
        dynamicServiceToDeployment = new Hashtable();
        try {
            dynamicServiceToDeployment.put("fedora-system:3", Class
                    .forName(getParameter("fedora-system:4")));
        } catch (Exception e) {
            throw new ModuleInitializationException(e.getMessage(),
                                                    "org.fcrepo.server.validation.DOValidatorModule");
        }

        // get ref to the Dynamic Access implementation class
        da = new DynamicAccessImpl(m_access, reposHomeDir, dynamicServiceToDeployment);
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        try {
            writer = JournalWriter.getInstance(parameters, role, server);
        } catch (JournalException e) {
            String msg = "Problem creating the JournalWriter";
            logger.error(msg, e);
            throw new ModuleInitializationException(msg, role, e);
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    @Override
    public void initModule() throws ModuleInitializationException {
        // pidNamespace (required, 1-17 chars, a-z, A-Z, 0-9 '-' '.')
        m_pidNamespace = getParameter("pidNamespace");
        if (m_pidNamespace == null) {
            throw new ModuleInitializationException(
                    "pidNamespace parameter must be specified.", getRole());
        }
        if (m_pidNamespace.length() > 17 || m_pidNamespace.length() < 1) {
            throw new ModuleInitializationException(
                    "pidNamespace parameter must be 1-17 chars long", getRole());
        }
        StringBuffer badChars = new StringBuffer();
        for (int i = 0; i < m_pidNamespace.length(); i++) {
            char c = m_pidNamespace.charAt(i);
            boolean invalid = true;
            if (c >= '0' && c <= '9') {
                invalid = false;
            } else if (c >= 'a' && c <= 'z') {
                invalid = false;
            } else if (c >= 'A' && c <= 'Z') {
                invalid = false;
            } else if (c == '-') {
                invalid = false;
            } else if (c == '.') {
                invalid = false;
            }
            if (invalid) {
                badChars.append(c);
            }
        }
        if (badChars.toString().length() > 0) {
            throw new ModuleInitializationException("pidNamespace contains " +
                    "invalid character(s) '" + badChars.toString() + "'",
                    getRole());
        }
        // storagePool (optional, default=ConnectionPoolManager's default pool)
        m_storagePool = getParameter("storagePool");
        if (m_storagePool == null) {
            logger.debug("Parameter storagePool "
                    + "not given, will defer to ConnectionPoolManager's "
                    + "default pool.");
        }
        // internal storage format (required)
        logger.debug("Server property format.storage= " + Server.STORAGE_FORMAT);
        m_defaultStorageFormat = Server.STORAGE_FORMAT;
        if (m_defaultStorageFormat == null) {
            throw new ModuleInitializationException(
                    "System property format.storage "
                            + "not given, but it's required.", getRole());
        }
        // default export format (required)
        m_defaultExportFormat = getParameter("defaultExportFormat");
        if (m_defaultExportFormat == null) {
            throw new ModuleInitializationException(
                    "Parameter defaultExportFormat "
                            + "not given, but it's required.", getRole());
        }
        // storageCharacterEncoding (optional, default=UTF-8)
        m_storageCharacterEncoding = getParameter("storageCharacterEncoding");
        if (m_storageCharacterEncoding == null) {
            logger.debug("Parameter storage_character_encoding "
                    + "not given, using UTF-8");
            m_storageCharacterEncoding = "UTF-8";
        }
        initRetainPID();

        // readerCacheSize and readerCacheSeconds (optional, defaults = 20, 5)
        String rcSize = getParameter("readerCacheSize");
        if (rcSize == null) {
            logger.debug("Parameter readerCacheSize not given, using 20");
            rcSize = "20";
        }
        int readerCacheSize;
        try {
            readerCacheSize = Integer.parseInt(rcSize);
            if (readerCacheSize < 0) {
                throw new Exception("Cannot be less than zero");
            }
        } catch (Exception e) {
            throw new ModuleInitializationException(
                    "Bad value for readerCacheSize parameter: " +
                            e.getMessage(), getRole());
        }

        String rcSeconds = getParameter("readerCacheSeconds");
        if (rcSeconds == null) {
            logger.debug("Parameter readerCacheSeconds not given, using 5");
            rcSeconds = "5";
        }
        int readerCacheSeconds;
        try {
            readerCacheSeconds = Integer.parseInt(rcSeconds);
            if (readerCacheSeconds < 1) {
                throw new Exception("Cannot be less than one");
            }
        } catch (Exception e) {
            throw new ModuleInitializationException(
                    "Bad value for readerCacheSeconds parameter: " +
                            e.getMessage(), getRole());
        }

        // configuration of ingest validation
        String ingestValidationLevel = getParameter("ingestValidationLevel");
        if (ingestValidationLevel == null) {
            logger.debug("Ingest validation level not specified, using default of all");
            m_ingestValidationLevel = DOValidator.VALIDATE_ALL;
        } else {
            m_ingestValidationLevel = Integer.parseInt(ingestValidationLevel);
            // check the values.  better to declare the levels as enums, but this
            // would require DOValidator interface change
            if (m_ingestValidationLevel < -1 || m_ingestValidationLevel > 2) {
                throw new ModuleInitializationException(
                        "Bad value for ingestValidationLevel", getRole());
            }
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        // get ref to management module
        m_management =
                (Management) getServer().getModule(
                        "org.fcrepo.server.management.Management");
        if (m_management == null) {
            throw new ModuleInitializationException(
                    "Management module not loaded.", getRole());
        }

        // get ref to contentmanager module
        m_contentManager =
                (ExternalContentManager) getServer().getModule(
                        "org.fcrepo.server.storage.ExternalContentManager");
        if (m_contentManager == null) {
            throw new ModuleInitializationException(
                    "ExternalContentManager not loaded.", getRole());
        }
        // get ref to fieldsearch module
        m_fieldSearch =
                getServer().getBean(
                        "org.fcrepo.server.search.FieldSearch", FieldSearch.class);
        // get ref to pidgenerator
        m_pidGenerator =
                (PIDGenerator) getServer().getModule(
                        "org.fcrepo.server.management.PIDGenerator");
        // note: permanent and temporary storage handles are lazily instantiated

        // get ref to translator and derive storageFormat default if not given
        m_translator =
                (DOTranslator) getServer().getModule(
                        "org.fcrepo.server.storage.translation.DOTranslator");
        // get ref to digital object xml validator
        m_validator =
                (DOValidator) getServer().getModule(
                        "org.fcrepo.server.validation.DOValidator");
        if (m_validator == null) {
            throw new ModuleInitializationException("DOValidator not loaded.",
                    getRole());
        }
        // get ref to digital object validator
        m_objectValidator =
                (DOObjectValidator) getServer().getModule(
                        "org.fcrepo.server.validation.DOObjectValidator");
        if (m_objectValidator == null) {
            throw new ModuleInitializationException(
                    "DOObjectValidator not loaded.", getRole());
        }

        // get ref to ResourceIndex
        m_resourceIndex =
                (ResourceIndex) getServer().getModule(
                        "org.fcrepo.server.resourceIndex.ResourceIndex");
        if (m_resourceIndex == null) {
            logger.error("ResourceIndex not loaded");
            throw new ModuleInitializationException("ResourceIndex not loaded",
                    getRole());
        }

        // now get the connectionpool
        ConnectionPoolManager cpm =
                (ConnectionPoolManager) getServer().getModule(
                        "org.fcrepo.server.storage.ConnectionPoolManager");
        if (cpm == null) {
            throw new ModuleInitializationException(
                    "ConnectionPoolManager not loaded.", getRole());
        }
        try {
            if (m_storagePool == null) {
                m_connectionPool = cpm.getPool();
            } else {
                m_connectionPool = cpm.getPool(m_storagePool);
            }
        } catch (ConnectionPoolNotFoundException cpnfe) {
            throw new ModuleInitializationException("Couldn't get required "
                    + "connection pool; wasn't found", getRole());
        }
        try {
            String dbSpec =
                    "org/fcrepo/server/storage/resources/DefaultDOManager.dbspec";
            InputStream specIn =
                    this.getClass().getClassLoader()
                            .getResourceAsStream(dbSpec);
            if (specIn == null) {
                throw new IOException("Cannot find required " + "resource: " +
                        dbSpec);
            }
            SQLUtility.createNonExistingTables(m_connectionPool, specIn);
        } catch (Exception e) {
            throw new ModuleInitializationException(
                    "Error while attempting to " +
                            "check for and create non-existing table(s): " +
                            e.getClass().getName() + ": " + e.getMessage(),
                    getRole(), e);
        }

        // get ref to lowlevelstorage module
        m_permanentStore =
                (ILowlevelStorage) getServer().getModule(
                        "org.fcrepo.server.storage.lowlevel.ILowlevelStorage");
        if (m_permanentStore == null) {
            logger.error("LowlevelStorage not loaded");
            throw new ModuleInitializationException(
                    "LowlevelStorage not loaded", getRole());
        }
        m_checkableStore = (m_permanentStore instanceof ICheckable);
        // get ref to DOReaderCache module
        m_readerCache = (DOReaderCache) getServer().getBean("org.fcrepo.server.readerCache");
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

                                        level,
                                        syncUpdates);
            setAliasMap(getAliases());

        } catch (Exception e) {
            throw new ModuleInitializationException("Error initializing RI",
                                                    getRole(),
                                                    e);
        }
    }
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.