Package org.fcrepo.server.errors

Examples of org.fcrepo.server.errors.GeneralException


            throw new ObjectIntegrityException("Object "
                    + reader.GetObjectPID()
                    + " has a DC datastream, but it's not inline XML.");

        } catch (UnsupportedEncodingException uee) {
            throw new GeneralException("[DefaultDisseminatorImpl] An error has occurred. "
                    + "The error was a \""
                    + uee.getClass().getName()
                    + "\"  . The "
                    + "Reason was \""
                    + uee.getMessage()
View Full Code Here


        String msgOut = sb.toString();
        ByteArrayInputStream in = null;
        try {
            in = new ByteArrayInputStream(msgOut.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException uee) {
            throw new GeneralException("[DefaultDisseminatorImpl] An error has occurred. "
                    + "The error was a \""
                    + uee.getClass().getName()
                    + "\"  . The "
                    + "Reason was \""
                    + uee.getMessage()
View Full Code Here

            cje.addArgument(ARGUMENT_NAME_FORMAT, format);
            cje.addArgument(ARGUMENT_NAME_ENCODING, encoding);
            cje.addArgument(ARGUMENT_NAME_NEW_PID, pid);
            return (String) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
View Full Code Here

            cje.addArgument(ARGUMENT_NAME_OWNERID, ownerId);
            cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
            cje.addArgument(ARGUMENT_NAME_LAST_MODIFIED_DATE, lastModifiedDate);
            return (Date) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
View Full Code Here

                    new CreatorJournalEntry(METHOD_PURGE_OBJECT, context);
            cje.addArgument(ARGUMENT_NAME_PID, pid);
            cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
            return (Date) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
View Full Code Here

            cje.addArgument(ARGUMENT_NAME_CHECKSUM_TYPE, checksumType);
            cje.addArgument(ARGUMENT_NAME_CHECKSUM, checksum);
            cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
            return (String) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
View Full Code Here

            cje.addArgument(ARGUMENT_NAME_CHECKSUM, checksum);
            cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
            cje.addArgument(ARGUMENT_NAME_LAST_MODIFIED_DATE, lastModifiedDate);
            return (Date) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
View Full Code Here

                // API), make sure it doesn't conflict with the (optional) PID
                // of the digital object
                if (pid != null && pid.length() > 0 && !pid.equals("new")) {
                    if (obj.getPid() != null && obj.getPid().length() > 0) {
                        if (!pid.equals(obj.getPid())) {
                            throw new GeneralException(
                                    "The PID of the digital object and the PID provided as parameter are different. Digital object: " +
                                            obj.getPid() + " parameter: " + pid);
                        }
                    } else {
                        obj.setPid(pid);
                    }

                }
                // PID VALIDATION:
                // validate and normalized the provided pid, if any
                if (obj.getPid() != null && obj.getPid().length() > 0) {
                    obj.setPid(Server.getPID(obj.getPid()).toString());
                }

                // PID GENERATION:
                // have the system generate a PID if one was not provided
                if (obj.getPid() != null &&
                        obj.getPid().indexOf(":") != -1 &&
                        (m_retainPIDs == null || m_retainPIDs.contains(obj
                                .getPid().split(":")[0]))) {
                    logger.debug("Stream contained PID with retainable namespace-id; will use PID from stream");
                    try {
                        m_pidGenerator.neverGeneratePID(obj.getPid());
                    } catch (IOException e) {
                        throw new GeneralException(
                                "Error calling pidGenerator.neverGeneratePID(): " +
                                        e.getMessage());
                    }
                } else {
                    if (pid.equals("new")) {
                        logger.debug("Client wants a new PID");
                        // yes... so do that, then set it in the obj.
                        String p = null;
                        try {
                            // If the context contains a recovery PID, use that.
                            // Otherwise, generate a new PID as usual.
                            if (context instanceof RecoveryContext) {
                                RecoveryContext rContext =
                                        (RecoveryContext) context;
                                p =
                                        rContext.getRecoveryValue(Constants.RECOVERY.PID.uri);
                            }
                            if (p == null) {
                                p =
                                        m_pidGenerator.generatePID(
                                                m_pidNamespace).toString();
                            } else {
                                logger.debug("Using new PID from recovery context");
                                m_pidGenerator.neverGeneratePID(p);
                            }
                        } catch (Exception e) {
                            throw new GeneralException("Error generating PID",
                                    e);
                        }
                        logger.info("Generated new PID: {}", p);
                        obj.setPid(p);
                    } else {
                        logger.debug("Client wants to use existing PID.");
                    }
                }

                logger.debug("New object PID is {}", obj.getPid());

                // WRITE LOCK:
                // ensure no one else can modify the object now
                getWriteLock(obj.getPid());

                // CHECK REGISTRY:
                // ensure the object doesn't already exist
                if (objectExists(obj.getPid())) {
                    releaseWriteLock(obj.getPid());
                    throw new ObjectExistsException("The PID '" + obj.getPid() +
                            "' already exists in the registry; the object can't be re-created.");
                }

                // GET DIGITAL OBJECT WRITER:
                // get an object writer configured with the DEFAULT export
                // format
                logger.debug("Getting new writer with default export format: {}",
                        m_defaultExportFormat);
                logger.debug("Instantiating a SimpleDOWriter");
                w =
                        new SimpleDOWriter(context, this, m_translator,
                                m_defaultExportFormat,
                                m_storageCharacterEncoding, obj);

                // DEFAULT DATASTREAMS:
                populateDC(context, obj, w, nowUTC);

                // DATASTREAM VALIDATION
                ValidationUtility.validateReservedDatastreams(w);

                // REGISTRY:
                // at this point the object is valid, so make a record
                // of it in the digital object registry
                registerObject(obj);
                return w;
            } catch (IOException e) {

                if (w != null) {
                    releaseWriteLock(obj.getPid());
                }

                throw new GeneralException("Error reading/writing temporary "
                        + "ingest file", e);
            } catch (Exception e) {

                if (w != null) {
                    releaseWriteLock(obj.getPid());
                }

                if (e instanceof ServerException) {
                    ServerException se = (ServerException) e;
                    throw se;
                }
                throw new GeneralException("Ingest failed: " +
                        e.getClass().getName(), e);
            } finally {
                if (tempFile != null) {
                    logger.debug("Finally, removing temp file");
                    try {
View Full Code Here

            cje.addArgument(ARGUMENT_NAME_CHECKSUM, checksum);
            cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
            cje.addArgument(ARGUMENT_NAME_LAST_MODIFIED_DATE, lastModifiedDate);
            return (Date) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
View Full Code Here

            cje.addArgument(ARGUMENT_NAME_DS_ID, dsID);
            cje.addArgument(ARGUMENT_NAME_DS_STATE, dsState);
            cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
            return (Date) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.fcrepo.server.errors.GeneralException

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.