|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.opencms.file.genericSql.CmsDbAccess
|
+--com.opencms.file.mySql.CmsDbAccess
This is the generic access module to load and store resources from and into the database.
| Field Summary |
| Fields inherited from interface com.opencms.boot.I_CmsLogChannels |
C_FLEX_CACHE, C_FLEX_LOADER, C_LOGGING, C_MODULE_CRITICAL, C_MODULE_DEBUG, C_MODULE_INFO, C_OPENCMS_CACHE, C_OPENCMS_CRITICAL, C_OPENCMS_CRONSCHEDULER, C_OPENCMS_DEBUG, C_OPENCMS_ELEMENTCACHE, C_OPENCMS_INFO, C_OPENCMS_INIT, C_OPENCMS_POOL, C_OPENCMS_STATICEXPORT, C_OPENCMS_STREAMING, C_PREPROCESSOR_IS_LOGGING |
| Constructor Summary | |
CmsDbAccess(source.org.apache.java.util.Configurations config)
Instanciates the access-module and sets up all required modules and connections. |
|
| Method Summary | |
CmsUser |
addUser(String name,
String password,
String description,
String firstname,
String lastname,
String email,
long lastlogin,
long lastused,
int flags,
Hashtable additionalInfos,
CmsGroup defaultGroup,
String address,
String section,
int type)
Adds a user to the database. |
protected void |
clearFilesTable()
Deletes all files in CMS_FILES without fileHeader in CMS_RESOURCES |
CmsFile |
createFile(CmsUser user,
CmsProject project,
CmsProject onlineProject,
String filename,
int flags,
int parentId,
byte[] contents,
I_CmsResourceType resourceType)
Creates a new file with the given content and resourcetype. |
CmsGroup |
createGroup(String name,
String description,
int flags,
String parent)
Add a new group to the Cms. |
CmsTask |
createTask(int rootId,
int parentId,
int tasktype,
int ownerId,
int agentId,
int roleId,
String taskname,
Timestamp wakeuptime,
Timestamp timeout,
int priority)
Creates a new task. |
void |
deleteProjectProperties(CmsProject project)
Deletes all properties for a project. |
void |
destroy()
Destroys this access-module |
protected void |
fillDefaults()
Private method to init all default-resources |
protected int |
findAgent(int roleid)
Finds an agent for a given role (group). |
Vector |
getAllBackupProjects()
Returns all projects from the history. |
protected CmsQueries |
getQueries()
retrieve the correct instance of the queries holder. |
CmsFile |
readFile(int projectId,
int onlineProjectId,
String filename)
Reads a file from the Cms. |
CmsFile |
readFile(int projectId,
int onlineProjectId,
String filename,
boolean includeDeleted)
Reads a file from the Cms. |
Vector |
readProjectLogs(int projectid)
Reads log entries for a project with added unescaping of comment as as MySQL doesn't support Unicode strings. |
HashMap |
readProperties(int projectId,
CmsResource resource,
int resourceType)
Added unescaping of property values as MySQL doesn't support Unicode strings |
String |
readProperty(String meta,
int projectId,
CmsResource resource,
int resourceType)
Added unescaping of property values as MySQL doesn't support Unicode strings |
CmsTask |
readTask(int id)
Reads a task from the Cms with added escaping of Strings since MySQL dosen't support Unicode strings |
CmsTaskLog |
readTaskLog(int id)
Reads a log for a task with added unescaping of comment as as MySQL doesn't support Unicode strings. |
Vector |
readTaskLogs(int taskId)
Reads log entries for a task with added unescaping of comment as as MySQL doesn't support Unicode strings. |
Vector |
readTasks(CmsProject project,
CmsUser agent,
CmsUser owner,
CmsGroup role,
int tasktype,
String orderBy,
String sort)
Reads all tasks of a user in a project with added escaping of Strings since MySQL dosen't support Unicode strings. |
void |
writeProperty(String meta,
int projectId,
String value,
CmsResource resource,
int resourceType,
boolean addDefinition)
Writes a property for a file or folder with added escaping of property values as MySQL doesn't support Unicode strings |
CmsTask |
writeTask(CmsTask task)
Writes a task from the Cms with added escaping of Strings since MySQL dosen't support Unicode strings |
void |
writeTaskLog(int taskId,
int userid,
Timestamp starttime,
String comment,
int type)
Writes new log for a task with added escaping of comment as as MySQL doesn't support Unicode strings. |
void |
writeUser(CmsUser user)
Writes a user to the database. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CmsDbAccess(source.org.apache.java.util.Configurations config)
throws CmsException
config - The OpenCms configuration.
CmsException - Throws CmsException if something goes wrong.| Method Detail |
public CmsUser addUser(String name,
String password,
String description,
String firstname,
String lastname,
String email,
long lastlogin,
long lastused,
int flags,
Hashtable additionalInfos,
CmsGroup defaultGroup,
String address,
String section,
int type)
throws CmsException
addUser in class CmsDbAccessname - usernamepassword - user-passworddescription - user-descriptionfirstname - user-firstnamelastname - user-lastnameemail - user-emaillastlogin - user-lastloginlastused - user-lastusedflags - user-flagsadditionalInfos - user-additional-infosdefaultGroup - user-defaultGroupaddress - user-defauladdresssection - user-sectiontype - user-type
thorws - CmsException if something goes wrong.
CmsException
protected void clearFilesTable()
throws CmsException
clearFilesTable in class CmsDbAccessCmsException
public CmsFile createFile(CmsUser user,
CmsProject project,
CmsProject onlineProject,
String filename,
int flags,
int parentId,
byte[] contents,
I_CmsResourceType resourceType)
throws CmsException
createFile in class CmsDbAccessuser - The user who wants to create the file.project - The project in which the resource will be used.onlineProject - The online project of the OpenCms.filename - The complete name of the new file (including pathinformation).flags - The flags of this resource.parentId - The parentId of the resource.contents - The contents of the new file.resourceType - The resourceType of the new file.
CmsException - Throws CmsException if operation was not succesful
public CmsGroup createGroup(String name,
String description,
int flags,
String parent)
throws CmsException
createGroup in class CmsDbAccessname - The name of the new group.description - The description for the new group.flags - The flags for the new group.
CmsException - Throws CmsException if operation was not succesfull.
public void deleteProjectProperties(CmsProject project)
throws CmsException
deleteProjectProperties in class CmsDbAccessproject - The project to delete.
CmsException - Throws CmsException if operation was not succesful
public Vector getAllBackupProjects()
throws CmsException
getAllBackupProjects in class CmsDbAccessCmsException
public void destroy()
throws CmsException
destroy in class CmsDbAccessthrows - CmsException if something goes wrong.
CmsException
protected void fillDefaults()
throws CmsException
fillDefaults in class CmsDbAccessCmsException
protected int findAgent(int roleid)
throws CmsException
findAgent in class CmsDbAccessCmsException - Throws CmsException if something goes wrong.protected CmsQueries getQueries()
getQueries in class CmsDbAccess
public CmsFile readFile(int projectId,
int onlineProjectId,
String filename)
throws CmsException
readFile in class CmsDbAccessprojectId - The Id of the project in which the resource will be used.onlineProjectId - The online projectId of the OpenCms.filename - The complete name of the new file (including pathinformation).
CmsException - Throws CmsException if operation was not succesful
public CmsFile readFile(int projectId,
int onlineProjectId,
String filename,
boolean includeDeleted)
throws CmsException
readFile in class CmsDbAccessprojectId - The Id of the project in which the resource will be used.onlineProjectId - The online projectId of the OpenCms.filename - The complete name of the new file (including pathinformation).
CmsException - Throws CmsException if operation was not succesful
public CmsTask createTask(int rootId,
int parentId,
int tasktype,
int ownerId,
int agentId,
int roleId,
String taskname,
Timestamp wakeuptime,
Timestamp timeout,
int priority)
throws CmsException
MySQL 4 does not support the SQL from the generic driver, so that's why we have that special implementation here. This was tested with MySQL 4.0.10.
createTask in class CmsDbAccessrootId - id of the root task projectparentId - id of the parent tasktasktype - type of the taskownerId - id of the owneragentId - id of the agentroleId - id of the roletaskname - name of the taskwakeuptime - time when the task will be wake uptimeout - time when the task times outpriority - priority of the task
CmsException - if something goes wrong.
public CmsTask readTask(int id)
throws CmsException
readTask in class CmsDbAccessid - the id of the task to read
CmsException - if something goes wrong
public Vector readTasks(CmsProject project,
CmsUser agent,
CmsUser owner,
CmsGroup role,
int tasktype,
String orderBy,
String sort)
throws CmsException
readTasks in class CmsDbAccessproject - the Project in which the tasks are definedagent - the task agentowner - the task owner .tasktype - one of C_TASKS_ALL, C_TASKS_OPEN, C_TASKS_DONE, C_TASKS_NEWorderBy - selects filter how to order the taskssort - select to sort ascending or descending ("ASC" or "DESC")
CmsException - Throws CmsException if something goes wrong.
public CmsTask writeTask(CmsTask task)
throws CmsException
writeTask in class CmsDbAccesstask - The task that will be written.
CmsException - if something goes wrong
public void writeProperty(String meta,
int projectId,
String value,
CmsResource resource,
int resourceType,
boolean addDefinition)
throws CmsException
writeProperty in class CmsDbAccessmeta - The property-name of which the property has to be read.value - The value for the property to be set.resourceType - The Type of the resource.addDefinition - If true then the propertydefinition is added if it not exists
CmsException - Throws CmsException if operation was not succesful
public String readProperty(String meta,
int projectId,
CmsResource resource,
int resourceType)
throws CmsException
readProperty in class CmsDbAccessmeta - The property-name of which the property has to be read.resourceType - The Type of the resource.
CmsException - Throws CmsException if operation was not succesfulCmsDbAccess.readProperty(String, int, CmsResource, int)
public HashMap readProperties(int projectId,
CmsResource resource,
int resourceType)
throws CmsException
readProperties in class CmsDbAccessresource - the resource to read the properties fromresourceType - the type of the resource
CmsException - Throws CmsException if operation was not succesfulCmsDbAccess.readProperties(int, CmsResource, int)
public void writeTaskLog(int taskId,
int userid,
Timestamp starttime,
String comment,
int type)
throws CmsException
writeTaskLog in class CmsDbAccessstarttime - Time when the log is created.comment - Description for the log.type - Type of the log. 0 = Sytem log, 1 = User Log
CmsException - if something goes wrong
public CmsTaskLog readTaskLog(int id)
throws CmsException
readTaskLog in class CmsDbAccessid - The id for the tasklog .
CmsException - Throws CmsException if something goes wrong.
public Vector readTaskLogs(int taskId)
throws CmsException
readTaskLogs in class CmsDbAccessCmsException - Throws CmsException if something goes wrong.
public Vector readProjectLogs(int projectid)
throws CmsException
readProjectLogs in class CmsDbAccessCmsException - Throws CmsException if something goes wrong.
public void writeUser(CmsUser user)
throws CmsException
writeUser in class CmsDbAccessuser - the user to write
thorws - CmsException if something goes wrong.
CmsException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||