Examples of ModuleInitializationException


Examples of org.fcrepo.server.errors.ModuleInitializationException

    }

    private TriplestoreConnector getConnector(Parameterized datastore)
            throws Exception {
        if (datastore == null) {
            throw new ModuleInitializationException("Specifed datastore "
                    + "does not exist in fedora.fcfg", getRole());
        }
        Map<String, String> config = datastore.getParameters();
        // make sure path, if specified and relative, is translated
        // to an absolute path based on the value of FEDORA_HOME
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    private int getRequiredInt(String name, int min, int max)
            throws ModuleInitializationException {
        try {
            int value = Integer.parseInt(getRequired(name));
            if (value < min || value > max) {
                throw new ModuleInitializationException(name
                        + " parameter is out of range, expected [" + min + "-"
                        + max + "]", getRole());
            }
            return value;
        } catch (NumberFormatException e) {
            throw new ModuleInitializationException(name
                    + " parameter must be " + "an integer", getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            return true;
        } else if (value.equals("false") || value.equals("no")
                || value.equals("off")) {
            return false;
        } else {
            throw new ModuleInitializationException(name + " parameter, if "
                    + "specified, must be a boolean (true or false)", getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            throws ModuleInitializationException {
        String value = getParameter(name);
        if (value != null) {
            return value;
        } else {
            throw new ModuleInitializationException(name + " parameter "
                    + "is required", getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    @Override
    public void postInitModule() throws ModuleInitializationException {
        String repositoryName = getParameter("repositoryName");
        if (repositoryName == null) {
            throw new ModuleInitializationException("repositoryName must be specified.",
                                                    getRole());
        }
        String repositoryDomainName = getParameter("repositoryDomainName");
        if (repositoryDomainName == null) {
            throw new ModuleInitializationException("repositoryDomainName must be specified.",
                                                    getRole());
        }
        String host = getServer().getParameter("fedoraServerHost");
        if (host == null) {
            throw new ModuleInitializationException("fedoraServerHost must be specified as primary server config element.",
                                                    getRole());
        }
        String context = getServer().getParameter("fedoraAppServerContext");
        if (context == null) {
            throw new ModuleInitializationException("fedoraAppServerContext must be specified as primary server config element.",
                                                    getRole());
        }

        String port = getServer().getParameter("fedoraServerPort");
        if (port == null) {
            throw new ModuleInitializationException("fedoraServerPort must be specified as primary server config element.",
                                                    getRole());
        }
        Module mgr = getServer().getModule("org.fcrepo.server.storage.DOManager");
        if (mgr == null) {
            throw new ModuleInitializationException("DOManager is required (for pidNamespace param), but isn't loaded.",
                                                    getRole());
        }
        String pidNamespace = mgr.getParameter("pidNamespace");
        if (pidNamespace == null) {
            throw new ModuleInitializationException("DOManager did not specify a pidNamespace, but this module requires that it does.",
                                                    getRole());
        }
        String aes = getParameter("adminEmails");
        if (aes == null) {
            throw new ModuleInitializationException("adminEmails must be specified.",
                                                    getRole());
        }
        HashSet<String> adminEmails = new HashSet<String>();
        if (aes.indexOf(" ") == -1) {
            adminEmails.add(aes);
        } else {
            String[] emails = aes.split(" ");
            for (String element : emails) {
                adminEmails.add(element);
            }
        }
        HashSet<String> friends = new HashSet<String>();
        if (getParameter("friends") != null) {
            String f = getParameter("friends");
            if (f.indexOf(" ") == -1) {
                friends.add(f);
            } else {
                String[] fs = f.split(" ");
                for (String element : fs) {
                    friends.add(element);
                }
            }
        }
        FieldSearch fieldSearch =
                (FieldSearch) getServer()
                        .getModule("org.fcrepo.server.search.FieldSearch");
        if (fieldSearch == null) {
            throw new ModuleInitializationException("FieldSearch module was not loaded, but is required.",
                                                    getRole());
        }
        Module fsModule =
                getServer().getModule("org.fcrepo.server.search.FieldSearch");

        if (fsModule.getParameter("maxResults") == null) {
            throw new ModuleInitializationException("maxResults parameter must be specified in FieldSearch module's configuration.",
                                                    getRole());
        }
        int maxResults = 0;
        try {
            maxResults = Integer.parseInt(fsModule.getParameter("maxResults"));
            if (maxResults < 1) {
                throw new NumberFormatException("");
            }
        } catch (NumberFormatException nfe) {
            throw new ModuleInitializationException("maxResults specified in FieldSearch module's configuration must be a positive integer.",
                                                    getRole());
        }

        long maxSets = 100; // unused for now, but passed in the constructor anyway
        long maxRecords = maxResults;
        long maxHeaders = maxResults;
        String maxRecordsString = getParameter("maxRecords");
        if (maxRecordsString != null) {
            try {
                maxRecords = Long.parseLong(maxRecordsString);
                if (maxRecords > maxResults) {
                    logger.warn("maxRecords was over the limit given by the FieldSearch module, using highest possible value: "
                                    + maxResults);
                    maxRecords = maxResults;
                }
            } catch (NumberFormatException nfe) {
                throw new ModuleInitializationException("maxRecords value is invalid.",
                                                        getRole());
            }
        }
        String maxHeadersString = getParameter("maxHeaders");
        if (maxHeadersString != null) {
            try {
                maxHeaders = Long.parseLong(maxHeadersString);
                if (maxHeaders > maxResults) {
                    logger.warn("maxHeaders was over the limit given by the FieldSearch module, using highest possible value: "
                                    + maxResults);
                    maxHeaders = maxResults;
                }
            } catch (NumberFormatException nfe) {
                throw new ModuleInitializationException("maxHeaders value is invalid.",
                                                        getRole());
            }
        }
        m_wrappedOAIProvider =
                new FedoraOAIProvider(repositoryName,
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    public void postInitModule() throws ModuleInitializationException {
        ConnectionPoolManager mgr =
                (ConnectionPoolManager) getServer()
                        .getModule("org.fcrepo.server.storage.ConnectionPoolManager");
        if (mgr == null) {
            throw new ModuleInitializationException("ConnectionPoolManager module not loaded.",
                                                    getRole());
        }
        try {
            m_pidGenerator = new DBPIDGenerator(mgr.getPool(), m_oldPidGenDir);
        } catch (Exception e) {
            String msg = "Can't get default connection pool";
            logger.error(msg, e);
            throw new ModuleInitializationException(msg, getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

    @Override
    public void initModule() throws ModuleInitializationException {

        String dsMediation = getParameter("doMediateDatastreams");
        if (dsMediation == null) {
            throw new ModuleInitializationException("doMediateDatastreams parameter must be specified.",
                                                    getRole());
        }
    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

        // get ref to DOManager
        m_manager =
                (DOManager) getServer()
                        .getModule("org.fcrepo.server.storage.DOManager");
        if (m_manager == null) {
            throw new ModuleInitializationException("Can't get a DOManager "
                                                    + "from Server.getModule", getRole());
        }
        // get ref to DynamicAccess module
        m_dynamicAccess =
                (DynamicAccessModule) getServer()
                        .getModule("org.fcrepo.server.access.DynamicAccess");

        // get ref to ExternalContentManager
        m_externalContentManager =
                (ExternalContentManager) getServer()
                        .getModule("org.fcrepo.server.storage.ExternalContentManager");

        // get ref to OAIProvider, for repositoryDomainName param for oai info
        Module oaiProvider = getServer().getModule("org.fcrepo.oai.OAIProvider");
        if (oaiProvider == null) {
            throw new ModuleInitializationException("DefaultAccess module requires that the server "
                                                    + "has an OAIProvider module configured so that it can get the repositoryDomainName parameter.",
                                                    getRole());
        }
        m_repositoryDomainName =
                oaiProvider.getParameter("repositoryDomainName");
        if (m_repositoryDomainName == null) {
            throw new ModuleInitializationException("DefaultAccess module requires that the OAIProvider "
                                                    + "module has the repositoryDomainName parameter specified.",
                                                    getRole());
        }

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

    }
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

            }

            m_http = new WebClient(m_httpconfig);

        } catch (Throwable th) {
            throw new ModuleInitializationException("[DefaultExternalContentManager] "
                                                            + "An external content manager "
                                                            + "could not be instantiated. The underlying error was a "
                                                            + th.getClass()
                                                                    .getName()
                                                            + "The message was \""
View Full Code Here

Examples of org.fcrepo.server.errors.ModuleInitializationException

                    (BackendSecurity) getServer()
                            .getModule("org.fcrepo.server.security.BackendSecurity");
            try {
                m_beSS = m_beSecurity.getBackendSecuritySpec();
            } catch (Exception e) {
                throw new ModuleInitializationException(
                        "Can't intitialize BackendSecurity module (in default access) from Server.getModule",
                        getRole());
            }
            Hashtable<String, String> beHash =
                    m_beSS.getSecuritySpec(BackendPolicies.FEDORA_INTERNAL_CALL);
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.