@Override public void postInitModule() throws ModuleInitializationException { try { } catch (Exception e) { throw new ModuleInitializationException(e.getMessage(), "org.fcrepo.server.validation.DOObjectValidatorModule"); } }
/** * While the server is reading a Journal to recover its state, block any * attempt to use the Management API. * * @throws ServerException */ private ServerException rejectCallsFromOutsideWhileInRecoveryMode() { return new InvalidStateException("Server is in Journal Recovery mode."); }
public LowlevelStorageException(boolean serverCaused, String bundleName, String code, String[] values, String[] details, Throwable cause) { super(null, code, null, null, cause); if (serverCaused) { setWasServer(); } }
@Override public void shutdownModule() throws ModuleShutdownException { if(enabled()) { try { close(); } catch (MessagingException e) { throw new ModuleShutdownException(e.getMessage(), getRole(), e); } } }
private void ensureSingleUpdate(Statement statement) throws ObjectNotInLowlevelStorageException, LowlevelStorageInconsistencyException, LowlevelStorageException { try{ int updateCount = statement.getUpdateCount(); if (updateCount == 0) { throw new ObjectNotInLowlevelStorageException("Object not found in low-level storage: -no- rows updated in db registry"); } if (updateCount > 1) { throw new LowlevelStorageInconsistencyException("-multiple- rows updated in db registry"); } } catch (SQLException e1) { throw new LowlevelStorageException(true, "sql failurex (exec)", e1); } }
@Override public void remove(String pid) throws ObjectNotInLowlevelStorageException, LowlevelStorageInconsistencyException, LowlevelStorageException { try { executeUpdate(deleteByIdQuery, pid); } catch (ObjectNotInLowlevelStorageException e1) { throw new ObjectNotInLowlevelStorageException("[" + pid + "] not in db registry to delete", e1); } catch (LowlevelStorageInconsistencyException e2) { throw new LowlevelStorageInconsistencyException("[" + pid + "] deleted from db registry -multiple- times", e2); } }
@Override public String getMessage() { Throwable e = getCause(); String temp = super.getMessage(); if (e != null) { temp += "\t" + e.getMessage(); } return temp; }
@Override public void postInitModule() throws ModuleInitializationException { try { m_llstore = new DefaultLowlevelStorage(getModuleParameters()); } catch (LowlevelStorageException e) { throw new ModuleInitializationException(e.getMessage(), getRole()); } }
protected DigitalObject doDeserializeOrFail(DigitalObject obj) { DigitalObject result = null; try { result = doDeserialize(obj); } catch (ObjectIntegrityException e) { e.printStackTrace(); fail("Deserializer threw ObjectIntegrityException"); } catch (StreamIOException e) { e.printStackTrace(); fail("Deserializer threw StreamIOException"); } return result; }
/** * Gets any detail messages, preferring the provided locale. * * @return The detail messages, with {num}-indexed placeholders populated, * if needed. */ public String[] getDetails(Locale locale) { if (m_details == null || m_details.length == 0) { return s_emptyStringArray; } String[] ret = new String[m_details.length]; for (int i = 0; i < m_details.length; i++) { ret[i] = getLocalizedOrCode(m_bundleName, locale, m_code, null); } return ret; }
/** * Performs shutdown tasks for the server itself. This should be written so * that system resources are always freed, regardless of whether there is an * error. If an error occurs, it should be thrown as a * <code>ServerShutdownException</code> after attempts to free every * resource have been made. * * @throws ServerShutdownException * If a severe server shutdown-related error occurred. */ @SuppressWarnings("unused") protected void shutdownServer() throws ServerShutdownException { if (1 == 2) { throw new ServerShutdownException(null); } }
@Override public void shutdownModule() throws ModuleShutdownException { if(enabled()) { try { close(); } catch (MessagingException e) { throw new ModuleShutdownException(e.getMessage(), getRole(), e); } } }
private void ensureSingleUpdate(Statement statement) throws ObjectNotInLowlevelStorageException, LowlevelStorageInconsistencyException, LowlevelStorageException { try{ int updateCount = statement.getUpdateCount(); if (updateCount == 0) { throw new ObjectNotInLowlevelStorageException("Object not found in low-level storage: -no- rows updated in db registry"); } if (updateCount > 1) { throw new LowlevelStorageInconsistencyException("-multiple- rows updated in db registry"); } } catch (SQLException e1) { throw new LowlevelStorageException(true, "sql failurex (exec)", e1); } }
@Override public void remove(String pid) throws ObjectNotInLowlevelStorageException, LowlevelStorageInconsistencyException, LowlevelStorageException { try { executeUpdate(deleteByIdQuery, pid); } catch (ObjectNotInLowlevelStorageException e1) { throw new ObjectNotInLowlevelStorageException("[" + pid + "] not in db registry to delete", e1); } catch (LowlevelStorageInconsistencyException e2) { throw new LowlevelStorageInconsistencyException("[" + pid + "] deleted from db registry -multiple- times", e2); } }
@Override public String getMessage() { Throwable e = getCause(); String temp = super.getMessage(); if (e != null) { temp += "\t" + e.getMessage(); } return temp; }
/** * While the server is reading a Journal to recover its state, block any * attempt to use the Management API. * * @throws ServerException */ private ServerException rejectCallsFromOutsideWhileInRecoveryMode() { return new InvalidStateException("Server is in Journal Recovery mode."); }
@Override public void postInitModule() throws ModuleInitializationException { try { } catch (Exception e) { throw new ModuleInitializationException(e.getMessage(), "org.fcrepo.server.validation.DOObjectValidatorModule"); } }
public LowlevelStorageException(boolean serverCaused, String bundleName, String code, String[] values, String[] details, Throwable cause) { super(null, code, null, null, cause); if (serverCaused) { setWasServer(); } }
/** * If a modifying operation is attempted while we are in Read-Only mode, * throw an exception to prevent it. In Normal mode, do nothing. * * @throws ServerException * to prevent a modifying operation in Read-Only mode. */ public static void enforceCurrentMode() throws ServerException { switch (currentMode) { case READ_ONLY: throw new InvalidStateException("Server is in Read-Only mode, pursuant to a Journaling error."); default: } }
/** * If a modifying operation is attempted while we are in Read-Only mode, * throw an exception to prevent it. In Normal mode, do nothing. * * @throws ServerException * to prevent a modifying operation in Read-Only mode. */ public static void enforceCurrentMode() throws ServerException { switch (currentMode) { case READ_ONLY: throw new InvalidStateException("Server is in Read-Only mode, pursuant to a Journaling error."); default: } }