KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > db > I_CmsProjectDriver


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/db/I_CmsProjectDriver.java,v $
3  * Date : $Date: 2006/03/27 14:52:27 $
4  * Version: $Revision: 1.76 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.db;
33
34 import org.opencms.db.generic.CmsSqlManager;
35 import org.opencms.file.CmsDataAccessException;
36 import org.opencms.file.CmsFile;
37 import org.opencms.file.CmsFolder;
38 import org.opencms.file.CmsGroup;
39 import org.opencms.file.CmsProject;
40 import org.opencms.file.CmsResource;
41 import org.opencms.file.CmsUser;
42 import org.opencms.main.CmsException;
43 import org.opencms.report.I_CmsReport;
44 import org.opencms.util.CmsUUID;
45 import org.opencms.workflow.CmsTask;
46
47 import java.util.List JavaDoc;
48 import java.util.Set JavaDoc;
49
50 /**
51  * Definitions of all required project driver methods. <p>
52  *
53  * @author Thomas Weckert
54  * @author Michael Emmerich
55  *
56  * @version $Revision: 1.76 $
57  *
58  * @since 6.0.0
59  */

60 public interface I_CmsProjectDriver {
61
62     /** The type ID to identify project driver implementations. */
63     int DRIVER_TYPE_ID = 1;
64
65     /** The name of the temp file project. */
66     String JavaDoc TEMP_FILE_PROJECT_NAME = "tempFileProject";
67
68     /**
69      * Creates a new project.<p>
70      *
71      * @param dbc the current database context
72      * @param owner the owner of the project
73      * @param group the group for the project
74      * @param managergroup the managergroup for the project
75      * @param task the base workflow task for the project
76      * @param name the name of the project to create
77      * @param description the description for the project
78      * @param flags the flags for the project
79      * @param type the type for the project
80      * @param reservedParam reserved optional parameter, should be <code>null</code> on standard OpenCms installations
81      *
82      * @return the created <code>{@link CmsProject}</code> instance
83      *
84      * @throws CmsDataAccessException if something goes wrong
85      */

86     CmsProject createProject(
87         CmsDbContext dbc,
88         CmsUser owner,
89         CmsGroup group,
90         CmsGroup managergroup,
91         CmsTask task,
92         String JavaDoc name,
93         String JavaDoc description,
94         int flags,
95         int type,
96         Object JavaDoc reservedParam) throws CmsDataAccessException;
97
98     /**
99      * Creates a new projectResource from a given CmsResource object.<p>
100      *
101      * @param dbc the current database context
102      * @param projectId The project in which the resource will be used
103      * @param resourceName The resource to be written to the Cms
104      * @param reservedParam reserved optional parameter, should be null on standard OpenCms installations
105      *
106      * @throws CmsDataAccessException if something goes wrong
107      */

108     void createProjectResource(CmsDbContext dbc, int projectId, String JavaDoc resourceName, Object JavaDoc reservedParam)
109     throws CmsDataAccessException;
110
111     /**
112      * Deletes all entries in the published resource table.<p>
113      *
114      * @param dbc the current database context
115      * @param currentProject the current project
116      * @param linkType the type of resource deleted (0= non-paramter, 1=parameter)
117      *
118      * @throws CmsDataAccessException if something goes wrong
119      */

120     void deleteAllStaticExportPublishedResources(CmsDbContext dbc, CmsProject currentProject, int linkType)
121     throws CmsDataAccessException;
122
123     /**
124      * Deletes a project from the cms.<p>
125      *
126      * Therefore it deletes all files, resources and properties.
127      *
128      * @param dbc the current database context
129      * @param project the project to delete
130      * @throws CmsDataAccessException if something goes wrong
131      */

132     void deleteProject(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException;
133
134     /**
135      * Delete a projectResource from an given CmsResource object.<p>
136      *
137      * @param dbc the current database context
138      * @param projectId id of the project in which the resource is used
139      * @param resourceName name of the resource to be deleted from the Cms
140      *
141      * @throws CmsDataAccessException if something goes wrong
142      */

143     void deleteProjectResource(CmsDbContext dbc, int projectId, String JavaDoc resourceName) throws CmsDataAccessException;
144
145     /**
146      * Deletes a specified project.<p>
147      *
148      * @param dbc the current database context
149      * @param project the project to be deleted
150      *
151      * @throws CmsDataAccessException if operation was not succesful
152      */

153     void deleteProjectResources(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException;
154
155     /**
156      * Deletes all publish history entries with backup tag IDs >=0 and < the specified max. backup tag ID.<p>
157      *
158      * @param dbc the current database context
159      * @param projectId the ID of the current project
160      * @param maxBackupTagId entries with backup tag IDs >=0 and < this max. backup tag ID get deleted
161      *
162      * @throws CmsDataAccessException if something goes wrong
163      */

164     void deletePublishHistory(CmsDbContext dbc, int projectId, int maxBackupTagId) throws CmsDataAccessException;
165
166     /**
167      * Deletes a publish history entry with backup tag IDs >=0 and < the specified max. backup tag ID.<p>
168      *
169      * @param dbc the current database context
170      * @param projectId the ID of the current project
171      * @param publishHistoryId the id of the history to delete the entry from
172      * @param publishResource the entry to delete
173      *
174      * @throws CmsDataAccessException if something goes wrong
175      */

176     void deletePublishHistoryEntry(
177         CmsDbContext dbc,
178         int projectId,
179         CmsUUID publishHistoryId,
180         CmsPublishedResource publishResource) throws CmsDataAccessException;
181
182     /**
183      * Deletes an entry in the published resource table.<p>
184      *
185      * @param dbc the current database context
186      * @param currentProject the current project
187      * @param resourceName The name of the resource to be deleted in the static export
188      * @param linkType the type of resource deleted (0= non-paramter, 1=parameter)
189      * @param linkParameter the parameters of the resource
190      *
191      * @throws CmsDataAccessException if something goes wrong
192      */

193     void deleteStaticExportPublishedResource(
194         CmsDbContext dbc,
195         CmsProject currentProject,
196         String JavaDoc resourceName,
197         int linkType,
198         String JavaDoc linkParameter) throws CmsDataAccessException;
199
200     /**
201      * Destroys this driver.<p>
202      *
203      * @throws Throwable if something goes wrong
204      */

205     void destroy() throws Throwable JavaDoc;
206
207     /**
208      * Fills the OpenCms database tables with default values.<p>
209      *
210      * @param dbc the current database context
211      *
212      * @throws CmsDataAccessException if something goes wrong
213      */

214     void fillDefaults(CmsDbContext dbc) throws CmsDataAccessException;
215
216     /**
217      * Returns the SqlManager of this driver.<p>
218      *
219      * @return the SqlManager of this driver
220      */

221     CmsSqlManager getSqlManager();
222
223     /**
224      * Initializes the SQL manager for this driver.<p>
225      *
226      * To obtain JDBC connections from different pools, further
227      * {online|offline|backup} pool Urls have to be specified.<p>
228      *
229      * @param classname the classname of the SQL manager
230      *
231      * @return the SQL manager for this driver
232      */

233     org.opencms.db.generic.CmsSqlManager initSqlManager(String JavaDoc classname);
234
235     /**
236      * Publishes a deleted folder.<p>
237      *
238      * @param dbc the current database context
239      * @param report the report to log the output to
240      * @param m the number of the folder to publish
241      * @param n the number of all folders to publish
242      * @param onlineProject the online project
243      * @param offlineFolder the offline folder to publish
244      * @param backupEnabled flag if backup is enabled
245      * @param publishDate the publishing date
246      * @param publishHistoryId the publish history id
247      * @param backupTagId the backup tag id
248      * @param maxVersions the maxmum number of backup versions for each resource
249      *
250      * @throws CmsDataAccessException if something goes wrong
251      */

252     void publishDeletedFolder(
253         CmsDbContext dbc,
254         I_CmsReport report,
255         int m,
256         int n,
257         CmsProject onlineProject,
258         CmsFolder offlineFolder,
259         boolean backupEnabled,
260         long publishDate,
261         CmsUUID publishHistoryId,
262         int backupTagId,
263         int maxVersions) throws CmsDataAccessException;
264
265     /**
266      * Publishes a new, changed or deleted file.<p>
267      *
268      * @param dbc the current database context
269      * @param report the report to log the output to
270      * @param m the number of the file to publish
271      * @param n the number of all files to publish
272      * @param onlineProject the online project
273      * @param offlineResource the offline file to publish
274      * @param publishedContentIds contains the UUIDs of already published content records
275      * @param backupEnabled flag if backup is enabled
276      * @param publishDate the publishing date
277      * @param publishHistoryId the publish history id
278      * @param backupTagId the backup tag id
279      * @param maxVersions the maxmum number of backup versions for each resource
280      *
281      * @throws CmsDataAccessException if something goes wrong
282      */

283     void publishFile(
284         CmsDbContext dbc,
285         I_CmsReport report,
286         int m,
287         int n,
288         CmsProject onlineProject,
289         CmsResource offlineResource,
290         Set JavaDoc publishedContentIds,
291         boolean backupEnabled,
292         long publishDate,
293         CmsUUID publishHistoryId,
294         int backupTagId,
295         int maxVersions) throws CmsDataAccessException;
296
297     /**
298      * Publishes the content record of a file.<p>
299      *
300      * The content record is only published unless it's UUID is not contained in publishedContentIds.
301      * The calling method has to take care about whether an existing content record has to be deleted
302      * before or not.<p>
303      *
304      * The intention of this method is to get overloaded in a project driver
305      * for a specific DB server to shift the binary content from the offline into the online table
306      * in a more sophisticated way than in the generic ANSI-SQL implementation of this interface.
307      *
308      * @param dbc the current database context
309      * @param offlineProject the offline project to read data
310      * @param onlineProject the online project to write data
311      * @param offlineFileHeader the offline header of the file of which the content gets published
312      * @param publishedResourceIds a Set with the UUIDs of the already published content records
313      *
314      * @return the published file (online)
315      * @throws CmsDataAccessException if something goes wrong
316      */

317     CmsFile publishFileContent(
318         CmsDbContext dbc,
319         CmsProject offlineProject,
320         CmsProject onlineProject,
321         CmsResource offlineFileHeader,
322         Set JavaDoc publishedResourceIds) throws CmsDataAccessException;
323
324     /**
325      * Publishes a new or changed folder.<p>
326      *
327      * @param dbc the current database context
328      * @param report the report to log the output to
329      * @param m the number of the folder to publish
330      * @param n the number of all folders to publish
331      * @param onlineProject the online project
332      * @param currentFolder the offline folder to publish
333      * @param backupEnabled flag if backup is enabled
334      * @param publishDate the publishing date
335      * @param publishHistoryId the publish history id
336      * @param backupTagId the backup tag id
337      * @param maxVersions the maxmum number of backup versions for each resource
338      *
339      * @throws CmsDataAccessException if something goes wrong
340      */

341     void publishFolder(
342         CmsDbContext dbc,
343         I_CmsReport report,
344         int m,
345         int n,
346         CmsProject onlineProject,
347         CmsFolder currentFolder,
348         boolean backupEnabled,
349         long publishDate,
350         CmsUUID publishHistoryId,
351         int backupTagId,
352         int maxVersions) throws CmsDataAccessException;
353
354     /**
355      * Publishes a specified project to the online project.<p>
356      *
357      * @param dbc the current database context
358      * @param report an I_CmsReport instance to print output messages
359      * @param onlineProject the online project
360      * @param publishList a Cms publish list
361      * @param backupEnabled true if published resources should be written to the Cms backup
362      * @param backupTagId the backup tag ID
363      * @param maxVersions maximum number of backup versions
364      *
365      * @throws CmsException if something goes wrong
366      */

367     void publishProject(
368         CmsDbContext dbc,
369         I_CmsReport report,
370         CmsProject onlineProject,
371         CmsPublishList publishList,
372         boolean backupEnabled,
373         int backupTagId,
374         int maxVersions) throws CmsException;
375
376     /**
377      * Reads a project given the projects id.<p>
378      *
379      * @param dbc the current database context
380      * @param id the id of the project
381      *
382      * @return the project read
383      *
384      * @throws CmsDataAccessException if something goes wrong
385      */

386     CmsProject readProject(CmsDbContext dbc, int id) throws CmsDataAccessException;
387
388     /**
389      * Reads a project.<p>
390      *
391      * @param dbc the current database context
392      * @param name the name of the project
393      *
394      * @return the project with the given name
395      * @throws CmsDataAccessException if something goes wrong
396      */

397     CmsProject readProject(CmsDbContext dbc, String JavaDoc name) throws CmsDataAccessException;
398
399     /**
400      * Reads the project resource path for a given project and resource path,
401      * to validate if a resource path for a given project already exists.<p>
402      *
403      * @param dbc the current database context
404      * @param projectId the ID of the project for which the resource path is read
405      * @param resourcename the project's resource path
406      * @param reservedParam reserved optional parameter, should be null on standard OpenCms installations
407      *
408      * @return String the project's resource path
409      * @throws CmsDataAccessException if something goes wrong
410      */

411     String JavaDoc readProjectResource(CmsDbContext dbc, int projectId, String JavaDoc resourcename, Object JavaDoc reservedParam)
412     throws CmsDataAccessException;
413
414     /**
415      * Reads the project resources for a specified project.<p>
416      *
417      * @param dbc the current database context
418      * @param project the project for which the resource path is read
419      *
420      * @return a list of all project resource paths
421      *
422      * @throws CmsDataAccessException if something goes wrong
423      */

424     List JavaDoc readProjectResources(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException;
425
426     /**
427      * Returns all projects with the given state.<p>
428      *
429      * @param dbc the current database context
430      * @param state the requested project state
431      *
432      * @return a list of objects of type <code>{@link CmsProject}</code>
433      *
434      * @throws CmsDataAccessException if something goes wrong
435      */

436     List JavaDoc readProjects(CmsDbContext dbc, int state) throws CmsDataAccessException;
437
438     /**
439      * Returns all projects, which are accessible by a group.<p>
440      *
441      * @param dbc the current database context
442      * @param group the requesting group
443      *
444      * @return a Vector of projects
445      * @throws CmsDataAccessException if something goes wrong
446      */

447     List JavaDoc readProjectsForGroup(CmsDbContext dbc, CmsGroup group) throws CmsDataAccessException;
448
449     /**
450      * Returns all projects, which are manageable by a group.<p>
451      *
452      * @param dbc the current database context
453      * @param group The requesting group
454      * @return a Vector of projects
455      *
456      * @throws CmsDataAccessException if something goes wrong
457      */

458     List JavaDoc readProjectsForManagerGroup(CmsDbContext dbc, CmsGroup group) throws CmsDataAccessException;
459
460     /**
461      * Reads all projects which are owned by a specified user.<p>
462      *
463      * @param dbc the current database context
464      * @param user the user
465      *
466      * @return a list of objects of type <code>{@link CmsProject}</code>
467      *
468      * @throws CmsDataAccessException if something goes wrong
469      */

470     List JavaDoc readProjectsForUser(CmsDbContext dbc, CmsUser user) throws CmsDataAccessException;
471
472     /**
473      * Reads all resources that build the "view" of a project.<p>
474      *
475      * @param dbc the current database context
476      * @param project the id of the project in which the resource will be used
477      * @param filter the filter for the resources to read
478      *
479      * @return a List of resources
480      *
481      * @throws CmsDataAccessException if something goes wrong
482      */

483     List JavaDoc readProjectView(CmsDbContext dbc, int project, String JavaDoc filter) throws CmsDataAccessException;
484
485     /**
486      * Reads the resources that were published during a publish process for a given publish history ID.<p>
487      *
488      * @param dbc the current database context
489      * @param projectId the ID of the current project
490      * @param publishHistoryId unique int ID to identify the publish process in the publish history
491      *
492      * @return a list of <code>{@link org.opencms.db.CmsPublishedResource}</code> objects
493      *
494      * @throws CmsDataAccessException if something goes wrong
495      */

496     List JavaDoc readPublishedResources(CmsDbContext dbc, int projectId, CmsUUID publishHistoryId)
497     throws CmsDataAccessException;
498
499     /**
500      * Returns the parameters of a resource in the table of all published template resources.<p>
501      *
502      * @param dbc the current database context
503      * @param currentProject the current project
504      * @param rfsName the rfs name of the resource
505      *
506      * @return the paramter string of the requested resource
507      *
508      * @throws CmsDataAccessException if something goes wrong
509      */

510     String JavaDoc readStaticExportPublishedResourceParameters(CmsDbContext dbc, CmsProject currentProject, String JavaDoc rfsName)
511     throws CmsDataAccessException;
512
513     /**
514      * Returns a list of all template resources which must be processed during a static export.<p>
515      *
516      * @param dbc the current database context
517      * @param currentProject the current project
518      * @param parameterResources flag for reading resources with parameters (1) or without (0)
519      * @param timestamp the timestamp information
520      *
521      * @return a list of template resources as <code>{@link String}</code> objects
522      *
523      * @throws CmsDataAccessException if something goes wrong
524      */

525     List JavaDoc readStaticExportResources(CmsDbContext dbc, CmsProject currentProject, int parameterResources, long timestamp)
526     throws CmsDataAccessException;
527
528     /**
529      * Removes the project id from all resources within a project.<p>
530      *
531      * This must be done when a project will deleted
532      *
533      * @param dbc the current database context
534      * @param project the project to delete
535      * @throws CmsDataAccessException if something goes wrong
536      */

537     void unmarkProjectResources(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException;
538
539     /**
540      * Writes an already existing project.<p>
541      *
542      * The project id has to be a valid OpenCms project id.<br>
543      *
544      * The project with the given id will be completely overriden
545      * by the given data.<p>
546      *
547      * @param dbc the current database context
548      * @param project the project that should be written
549      *
550      * @throws CmsDataAccessException if operation was not successful
551      */

552     void writeProject(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException;
553
554     /**
555      * Inserts an entry in the publish history for a published VFS resource.<p>
556      *
557      * @param dbc the current database context
558      * @param currentProject the current project
559      * @param publishId the ID of the current publishing process
560      * @param resource the state of the resource *before* it was published
561      *
562      * @throws CmsDataAccessException if something goes wrong
563      */

564     void writePublishHistory(
565         CmsDbContext dbc,
566         CmsProject currentProject,
567         CmsUUID publishId,
568         CmsPublishedResource resource) throws CmsDataAccessException;
569
570     /**
571      * Inserts an entry in the published resource table.<p>
572      *
573      * This is done during static export.<p>
574      *
575      * @param dbc the current database context
576      * @param currentProject the current project
577      * @param resourceName The name of the resource to be added to the static export
578      * @param linkType the type of resource exported (0= non-paramter, 1=parameter)
579      * @param linkParameter the parameters added to the resource
580      * @param timestamp a timestamp for writing the data into the db
581      *
582      * @throws CmsDataAccessException if something goes wrong
583      */

584     void writeStaticExportPublishedResource(
585         CmsDbContext dbc,
586         CmsProject currentProject,
587         String JavaDoc resourceName,
588         int linkType,
589         String JavaDoc linkParameter,
590         long timestamp) throws CmsDataAccessException;
591
592 }
Popular Tags