/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsLockException(container, cause); } }
/** * Clears the resource lock.<p> * * @throws CmsException in case reading the resource fails */ private void clearLock() throws CmsException { if ((m_lockActionRecord != null) && (m_lockActionRecord.getChange() == LockChange.locked)) { CmsResource updatedRes = m_cms.readResource(m_resource.getStructureId(), CmsResourceFilter.ALL); try { m_cms.unlockResource(updatedRes); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e); } m_lockActionRecord = null; } }
CmsMessageContainer messageContainer; if (e instanceof CmsLockException) { messageContainer = ((CmsLockException)e).getMessageContainer(); } else { messageContainer = Messages.get().container(
/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsLockException(container, cause); } }
/** * Undeletes the selected files * * @return the ids of the modified resources * * @throws CmsException if something goes wrong */ protected List<CmsUUID> undelete() throws CmsException { List<CmsUUID> modifiedResources = new ArrayList<CmsUUID>(); CmsObject cms = m_context.getCms(); for (CmsResource resource : m_context.getResources()) { CmsLockActionRecord actionRecord = null; try { actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource); cms.undeleteResource(cms.getSitePath(resource), true); modifiedResources.add(resource.getStructureId()); } finally { if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) { try { cms.unlockResource(resource); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e); } } } } return modifiedResources; }
/** * Checks if the given resource contains a resource that has a system lock.<p> * * @param dbc the current database context * @param resource the resource to check * * @throws CmsException in case there is a system lock contained in the given resource */ protected void checkSystemLocks(CmsDbContext dbc, CmsResource resource) throws CmsException { if (m_lockManager.hasSystemLocks(dbc, resource)) { throw new CmsLockException( Messages.get().container( Messages.ERR_RESOURCE_SYSTEM_LOCKED_1, dbc.removeSiteRoot(resource.getRootPath()))); } }
m_context.getCms().unlockResource(resource); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e);
/** * Checks if the given resource contains a resource that has a system lock.<p> * * @param dbc the current database context * @param resource the resource to check * * @throws CmsException in case there is a system lock contained in the given resource */ protected void checkSystemLocks(CmsDbContext dbc, CmsResource resource) throws CmsException { if (m_lockManager.hasSystemLocks(dbc, resource)) { throw new CmsLockException(Messages.get().container( Messages.ERR_RESOURCE_SYSTEM_LOCKED_1, dbc.removeSiteRoot(resource.getRootPath()))); } }
LOG.warn(e.getLocalizedMessage(), e); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e);
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }
m_context.getCms().unlockResource(cms.readResource(resource.getStructureId())); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e);
/** * Removes a resource after it has been deleted by the driver manager.<p> * * @param dbc the current database context * @param resourceName the root path of the deleted resource * @throws CmsException if something goes wrong */ public void removeDeletedResource(CmsDbContext dbc, String resourceName) throws CmsException { try { m_driverManager.getVfsDriver().readResource(dbc, dbc.currentProject().getUuid(), resourceName, false); throw new CmsLockException(Messages.get().container( Messages.ERR_REMOVING_UNDELETED_RESOURCE_1, dbc.getRequestContext().removeSiteRoot(resourceName))); } catch (CmsVfsResourceNotFoundException e) { // ok, ignore } unlockResource(resourceName, true); unlockResource(resourceName, false); }
cms.unlockResource(resource); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e);
/** * Removes a resource after it has been deleted by the driver manager.<p> * * @param dbc the current database context * @param resourceName the root path of the deleted resource * @throws CmsException if something goes wrong */ public void removeDeletedResource(CmsDbContext dbc, String resourceName) throws CmsException { try { m_driverManager.getVfsDriver(dbc).readResource(dbc, dbc.currentProject().getUuid(), resourceName, false); throw new CmsLockException( Messages.get().container( Messages.ERR_REMOVING_UNDELETED_RESOURCE_1, dbc.getRequestContext().removeSiteRoot(resourceName))); } catch (CmsVfsResourceNotFoundException e) { // ok, ignore } unlockResource(resourceName, true); unlockResource(resourceName, false); }
cms.unlockResource(resource); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e);
throw new CmsLockException( Messages.get().container(Messages.ERR_RESOURCE_UNLOCK_1, dbc.removeSiteRoot(resourcename))); throw new CmsLockException( Messages.get().container(Messages.ERR_UNLOCK_LOCK_INHERITED_1, dbc.removeSiteRoot(resourcename)));
cms.unlockResource(updatedRes); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e);
throw new CmsLockException(Messages.get().container( Messages.ERR_RESOURCE_UNLOCK_1, dbc.removeSiteRoot(resourcename))); throw new CmsLockException(Messages.get().container( Messages.ERR_UNLOCK_LOCK_INHERITED_1, dbc.removeSiteRoot(resourcename)));
} catch (CmsLockException e) { LOG.info(e.getLocalizedMessage(), e);
throw new CmsLockException(Messages.get().container(Messages.ERR_INVALID_LOCK_TYPE_1, type.toString()));