📄 cmsdrivermanager.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src/org/opencms/db/CmsDriverManager.java,v $
* Date : $Date: 2006/05/12 16:05:48 $
* Version: $Revision: 1.573 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.db;
import org.opencms.configuration.CmsConfigurationManager;
import org.opencms.configuration.CmsSystemConfiguration;
import org.opencms.file.CmsBackupProject;
import org.opencms.file.CmsBackupResource;
import org.opencms.file.CmsDataAccessException;
import org.opencms.file.CmsFile;
import org.opencms.file.CmsFolder;
import org.opencms.file.CmsGroup;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsProject;
import org.opencms.file.CmsProperty;
import org.opencms.file.CmsPropertyDefinition;
import org.opencms.file.CmsRequestContext;
import org.opencms.file.CmsResource;
import org.opencms.file.CmsResourceFilter;
import org.opencms.file.CmsUser;
import org.opencms.file.CmsVfsException;
import org.opencms.file.CmsVfsResourceAlreadyExistsException;
import org.opencms.file.CmsVfsResourceNotFoundException;
import org.opencms.file.types.CmsResourceTypeFolder;
import org.opencms.file.types.CmsResourceTypeJsp;
import org.opencms.file.types.I_CmsResourceType;
import org.opencms.flex.CmsFlexRequestContextInfo;
import org.opencms.i18n.CmsLocaleManager;
import org.opencms.i18n.CmsMessageContainer;
import org.opencms.lock.CmsLock;
import org.opencms.lock.CmsLockException;
import org.opencms.lock.CmsLockManager;
import org.opencms.main.CmsEvent;
import org.opencms.main.CmsException;
import org.opencms.main.CmsIllegalArgumentException;
import org.opencms.main.CmsIllegalStateException;
import org.opencms.main.CmsInitException;
import org.opencms.main.CmsLog;
import org.opencms.main.I_CmsEventListener;
import org.opencms.main.OpenCms;
import org.opencms.module.CmsModule;
import org.opencms.report.CmsLogReport;
import org.opencms.report.I_CmsReport;
import org.opencms.security.CmsAccessControlEntry;
import org.opencms.security.CmsAccessControlList;
import org.opencms.security.CmsAuthentificationException;
import org.opencms.security.CmsPasswordEncryptionException;
import org.opencms.security.CmsPermissionSet;
import org.opencms.security.CmsPermissionSetCustom;
import org.opencms.security.CmsRole;
import org.opencms.security.CmsSecurityException;
import org.opencms.security.I_CmsPrincipal;
import org.opencms.util.CmsFileUtil;
import org.opencms.util.CmsStringUtil;
import org.opencms.util.CmsUUID;
import org.opencms.validation.CmsXmlDocumentLinkValidator;
import org.opencms.workflow.CmsTask;
import org.opencms.workflow.CmsTaskLog;
import org.opencms.workflow.CmsTaskService;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import java.util.Vector;
import org.apache.commons.collections.ExtendedProperties;
import org.apache.commons.collections.map.LRUMap;
import org.apache.commons.dbcp.PoolingDriver;
import org.apache.commons.logging.Log;
import org.apache.commons.pool.ObjectPool;
/**
* The OpenCms driver manager.<p>
*
* @author Alexander Kandzior
* @author Thomas Weckert
* @author Carsten Weinholz
* @author Michael Emmerich
* @author Michael Moossen
*
* @since 6.0.0
*/
public final class CmsDriverManager implements I_CmsEventListener {
/**
* Provides a method to build cache keys for groups and users that depend either on
* a name string or an id.<p>
*
* @author Alexander Kandzior
*/
private class CacheId extends Object {
/**
* Name of the object.
*/
public String m_name;
/**
* Id of the object.
*/
public CmsUUID m_uuid;
/**
* Creates a new CacheId for a CmsGroup.<p>
*
* @param group the group to create a cache id from
*/
public CacheId(CmsGroup group) {
m_name = group.getName();
m_uuid = group.getId();
}
/**
* Creates a new CacheId for a CmsResource.<p>
*
* @param resource the resource to create a cache id from
*/
public CacheId(CmsResource resource) {
m_name = resource.getName();
m_uuid = resource.getResourceId();
}
/**
* Creates a new CacheId for a CmsUser.<p>
*
* @param user the user to create a cache id from
*/
public CacheId(CmsUser user) {
m_name = user.getName() + user.getType();
m_uuid = user.getId();
}
/**
* Creates a new CacheId for a CmsUUID.<p>
*
* @param uuid the uuid to create a cache id from
*/
public CacheId(CmsUUID uuid) {
m_uuid = uuid;
}
/**
* Creates a new CacheId for a String.<p>
*
* @param str the string to create a cache id from
*/
public CacheId(String str) {
m_name = str;
}
/**
* Creates a new CacheId for a String and CmsUUID.<p>
*
* @param name the string to create a cache id from
* @param uuid the uuid to create a cache id from
*/
public CacheId(String name, CmsUUID uuid) {
m_name = name;
m_uuid = uuid;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof CacheId)) {
return false;
}
CacheId other = (CacheId)obj;
boolean result;
if (m_uuid != null) {
result = m_uuid.equals(other.m_uuid);
if (result) {
return true;
}
}
if (m_name != null) {
result = m_name.equals(other.m_name);
if (result) {
return true;
}
}
return false;
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
if (m_uuid == null) {
return 509;
} else {
return m_uuid.hashCode();
}
}
}
/** Cache key for all properties. */
public static final String CACHE_ALL_PROPERTIES = "_CAP_";
/** "driver.backup" string in the configuration-file. */
public static final String CONFIGURATION_BACKUP = "driver.backup";
/** "cache" string in the configuration-file. */
public static final String CONFIGURATION_CACHE = "cache";
/** "db" string in the configuration-file. */
public static final String CONFIGURATION_DB = "db";
/** "driver.project" string in the configuration-file. */
public static final String CONFIGURATION_PROJECT = "driver.project";
/** "driver.user" string in the configuration-file. */
public static final String CONFIGURATION_USER = "driver.user";
/** "driver.vfs" string in the configuration-file. */
public static final String CONFIGURATION_VFS = "driver.vfs";
/** "driver.workflow" string in the configuration-file. */
public static final String CONFIGURATION_WORKFLOW = "driver.workflow";
/** The vfs path of the loast and found folder. */
public static final String LOST_AND_FOUND_FOLDER = "/system/lost-found";
/** The maximum length of a VFS resource path. */
public static final int MAX_VFS_RESOURCE_PATH_LENGTH = 512;
/** Key for indicating no changes. */
public static final int NOTHING_CHANGED = 0;
/** Indicates to ignore the resource path when matching resources. */
public static final String READ_IGNORE_PARENT = null;
/** Indicates to ignore the resource state when matching resources. */
public static final int READ_IGNORE_STATE = -1;
/** Indicates to ignore the time value. */
public static final long READ_IGNORE_TIME = 0L;
/** Indicates to ignore the resource type when matching resources. */
public static final int READ_IGNORE_TYPE = -1;
/** Indicates to match resources NOT having the given state. */
public static final int READMODE_EXCLUDE_STATE = 8;
/** Indicates to match immediate children only. */
public static final int READMODE_EXCLUDE_TREE = 1;
/** Indicates to match resources NOT having the given type. */
public static final int READMODE_EXCLUDE_TYPE = 4;
/** Mode for reading project resources from the db. */
public static final int READMODE_IGNORESTATE = 0;
/** Indicates to match resources in given project only. */
public static final int READMODE_INCLUDE_PROJECT = 2;
/** Indicates to match all successors. */
public static final int READMODE_INCLUDE_TREE = 0;
/** Mode for reading project resources from the db. */
public static final int READMODE_MATCHSTATE = 1;
/** Indicates if only file resources should be read. */
public static final int READMODE_ONLY_FILES = 128;
/** Indicates if only folder resources should be read. */
public static final int READMODE_ONLY_FOLDERS = 64;
/** Mode for reading project resources from the db. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -