001: package org.enhydra.shark.api.internal.instancepersistence;
002:
003: import java.util.List;
004:
005: import org.enhydra.shark.api.client.wfmc.wapi.WMSessionHandle;
006: import org.enhydra.shark.api.internal.working.CallbackUtilities;
007:
008: /**
009: * Interface that has to be implemented for each persistent layer that is supposed to be
010: * used.
011: *
012: * @author Sasa Bojanic
013: * @version 1.0
014: */
015: public interface PersistentManagerInterface {
016:
017: /**
018: * Method configure is called at Shark start up, to configure implementation of
019: * PersistentManagerInterface.
020: *
021: * @param cus an instance of CallbackUtilities used to get properties for configuring
022: * Persistent Manager in Shark.
023: * @exception Exception Thrown if configuring doesn't succeed.
024: */
025: void configure(CallbackUtilities cus) throws Exception;
026:
027: /**
028: * Method shutdownDatabase.
029: *
030: * @exception PersistenceException on error.
031: */
032: public void shutdownDatabase(WMSessionHandle shandle)
033: throws PersistenceException;
034:
035: /**
036: * Method persist stores the process manager data into repository (usually database).
037: *
038: * @param pm ProcessMgrPersistenceInterface contiaing the data.
039: * @exception PersistenceException on error while writing.
040: */
041: public void persist(WMSessionHandle shandle,
042: ProcessMgrPersistenceObject pm, boolean isInitialPersistence)
043: throws PersistenceException;
044:
045: /**
046: * Method persist stores the process data into repository (usually database).
047: *
048: * @param pr ProcessPersistenceInterface containing the data.
049: * @exception PersistenceException on error.
050: */
051: public void persist(WMSessionHandle shandle,
052: ProcessPersistenceObject pr, boolean isInitialPersistence)
053: throws PersistenceException;
054:
055: /**
056: * Method persist stores the activity data into repository (usually database).
057: *
058: * @param act ActivityPersistenceInterface contianing the data.
059: * @exception PersistenceException on error
060: */
061: public void persist(WMSessionHandle shandle,
062: ActivityPersistenceObject act, boolean isInitialPersistence)
063: throws PersistenceException;
064:
065: /**
066: * Method persist stores the resource data into repository (usually database).
067: *
068: * @param res ResourcePersistenceInterface.
069: * @exception PersistenceException on error.
070: */
071: public void persist(WMSessionHandle shandle,
072: ResourcePersistenceObject res, boolean isInitialPersistence)
073: throws PersistenceException;
074:
075: /**
076: * Method persist stores the assignment data into repository (usually database).
077: *
078: * @param ass AssignmentPersistenceInterface containing the data.
079: * @exception PersistenceException on error.
080: */
081: public void persist(WMSessionHandle shandle,
082: AssignmentPersistenceObject ass,
083: boolean isInitialPersistence) throws PersistenceException;
084:
085: /**
086: * Method persist updates the assignment data into repository (usually database).
087: *
088: * @param ass AssignmentPersistenceInterface containing the data.
089: * @param oldResUname previous resource username.
090: * @exception PersistenceException on error.
091: */
092: public void persist(WMSessionHandle shandle,
093: AssignmentPersistenceObject ass, String oldResUname)
094: throws PersistenceException;
095:
096: /**
097: * Method persist stores the process relevant data into repository (usually database).
098: *
099: * @param var ProcessVariablePersistenceInterface.
100: * @exception PersistenceException on error.
101: */
102: public void persist(WMSessionHandle shandle,
103: ProcessVariablePersistenceObject var,
104: boolean isInitialPersistence) throws PersistenceException;
105:
106: /**
107: * Method persist stores the activity variable into repository (usually database).
108: *
109: * @param var ActivityVariablePersistenceInterface.
110: * @exception PersistenceException on error.
111: */
112: public void persist(WMSessionHandle shandle,
113: ActivityVariablePersistenceObject var,
114: boolean isInitialPersistence) throws PersistenceException;
115:
116: /**
117: * Method persist stores the AND join data into repository (usually database).
118: *
119: * @param aje AndJoinEntryInterface
120: * @exception PersistenceException on error.
121: */
122: public void persist(WMSessionHandle shandle,
123: AndJoinEntryPersitenceObject aje)
124: throws PersistenceException;
125:
126: /**
127: * Method persist stores the Deadline data into repository (usually database).
128: *
129: * @param dpe a DeadlinePersistenceInterface
130: * @exception PersistenceException on error.
131: */
132: public void persist(WMSessionHandle shandle,
133: DeadlinePersistenceObject dpe, boolean isInitialPersistence)
134: throws PersistenceException;
135:
136: /**
137: * Method restoreProcessMgr restores process manager from the repository.
138: *
139: * @param mgrName name of the manager to restore
140: * @return a ProcessMgrPersistenceInterface
141: * @exception PersistenceException on error.
142: */
143: public ProcessMgrPersistenceObject restoreProcessMgr(
144: WMSessionHandle shandle, String mgrName)
145: throws PersistenceException;
146:
147: /**
148: * Method restoreProcess restores process from the repository.
149: *
150: * @param procId id of a process to restore
151: * @return a ProcessPersistenceInterface
152: * @exception PersistenceException on error.
153: */
154: public ProcessPersistenceObject restoreProcess(
155: WMSessionHandle shandle, String procId)
156: throws PersistenceException;
157:
158: /**
159: * Method restoreActivity restores activity from the repository.
160: *
161: * @param actId id of activity to restore
162: * @return an ActivityPersistenceInterface
163: * @exception PersistenceException on error.
164: */
165: public ActivityPersistenceObject restoreActivity(
166: WMSessionHandle shandle, String procId, String actId)
167: throws PersistenceException;
168:
169: /**
170: * Method restoreResource restores resource from the repository.
171: *
172: * @param resUsername username of the resource to restore
173: * @return a ResourcePersistenceInterface
174: * @exception PersistenceException on error.
175: */
176: public ResourcePersistenceObject restoreResource(
177: WMSessionHandle shandle, String resUsername)
178: throws PersistenceException;
179:
180: /**
181: * Method restoreAssignment restores assignment from the repository.
182: *
183: * @param actId id of activity linked to assignment
184: * @param resUsername username of the resource linked to assignment
185: * @return an AssignmentPersistenceInterface
186: * @exception PersistenceException on error.
187: */
188: public AssignmentPersistenceObject restoreAssignment(
189: WMSessionHandle shandle, String procId, String actId,
190: String resUsername) throws PersistenceException;
191:
192: /**
193: * Method restore retrieves process variable from the repository using supplied
194: * transaction.
195: *
196: * @param var ProcessVariablePersistenceInterface must contain both process id and
197: * variable definition id
198: * @return true on success, false otherwise
199: * @exception PersistenceException on error.
200: */
201: public boolean restore(WMSessionHandle shandle,
202: ProcessVariablePersistenceObject var)
203: throws PersistenceException;
204:
205: /**
206: * Method restore retrieves activity variable from the repository.
207: *
208: * @param var ActivityVariablePersistenceInterface must contain both activity id and
209: * variable definition id
210: * @return true on success, false otherwise
211: * @exception PersistenceException on error.
212: */
213: public boolean restore(WMSessionHandle shandle,
214: ActivityVariablePersistenceObject var)
215: throws PersistenceException;
216:
217: /**
218: * Method deleteProcessMgr
219: *
220: * @param mgrName a String
221: * @exception PersistenceException on error.
222: */
223: public void deleteProcessMgr(WMSessionHandle shandle, String mgrName)
224: throws PersistenceException;
225:
226: /**
227: * Method deleteProcess
228: *
229: * @param procId a String
230: * @exception PersistenceException on error.
231: */
232: public List deleteProcess(WMSessionHandle shandle, String procId,
233: boolean administrative) throws PersistenceException;
234:
235: /**
236: * Method deleteActivity
237: *
238: * @param actId a String
239: * @exception PersistenceException on error.
240: */
241: public void deleteActivity(WMSessionHandle shandle, String procId,
242: String actId) throws PersistenceException;
243:
244: /**
245: * Method deleteResource
246: *
247: * @param resUsername a String
248: * @exception PersistenceException on error.
249: */
250: public void deleteResource(WMSessionHandle shandle,
251: String resUsername) throws PersistenceException;
252:
253: /**
254: * Method deleteAssignment
255: *
256: * @param actId a String
257: * @param resUsername a String
258: * @exception PersistenceException on error.
259: */
260: public void deleteAssignment(WMSessionHandle shandle,
261: String procId, String actId, String resUsername)
262: throws PersistenceException;
263:
264: /**
265: * Method deleteAndJoinEntries
266: *
267: * @param procId a String
268: * @param blockActId a String
269: * @param aDefId a String
270: * @exception PersistenceException on error.
271: */
272: public void deleteAndJoinEntries(WMSessionHandle shandle,
273: String procId, String blockActId, String aDefId)
274: throws PersistenceException;
275:
276: /**
277: * Deletes all deadlines for all activities of given process.
278: *
279: * @param procId a String
280: * @throws PersistenceException
281: */
282: public void deleteDeadlines(WMSessionHandle shandle, String procId)
283: throws PersistenceException;
284:
285: /**
286: * Method delete all deadlines for a given activity.
287: *
288: * @param procId a String
289: * @param actId a String
290: * @throws PersistenceException
291: */
292: public void deleteDeadlines(WMSessionHandle shandle, String procId,
293: String actId) throws PersistenceException;
294:
295: /**
296: * Method delete
297: *
298: * @param var a ProcessVariablePersistenceInterface
299: * @exception PersistenceException on error.
300: */
301: public void delete(WMSessionHandle shandle,
302: ProcessVariablePersistenceObject var)
303: throws PersistenceException;
304:
305: /**
306: * Method delete
307: *
308: * @param var an ActivityVariablePersistenceInterface
309: * @exception PersistenceException on error.
310: */
311: public void delete(WMSessionHandle shandle,
312: ActivityVariablePersistenceObject var)
313: throws PersistenceException;
314:
315: // Methods for various querying
316:
317: /**
318: * Method getAllProcessMgrs
319: *
320: * @return a List
321: * @exception PersistenceException on error.
322: */
323: public List getAllProcessMgrs(WMSessionHandle shandle)
324: throws PersistenceException;
325:
326: /**
327: * Method getAllResources
328: *
329: * @return a List
330: * @exception PersistenceException on error.
331: */
332: public List getAllResources(WMSessionHandle shandle)
333: throws PersistenceException;
334:
335: /**
336: * Method getAllAssignments
337: *
338: * @return a List
339: * @exception PersistenceException on error.
340: */
341: public List getAllAssignments(WMSessionHandle shandle)
342: throws PersistenceException;
343:
344: /**
345: * Method getAllProcesses
346: *
347: * @return a List
348: * @exception PersistenceException on error.
349: */
350: public List getAllProcesses(WMSessionHandle shandle)
351: throws PersistenceException;
352:
353: /**
354: * Method getAllActivities
355: *
356: * @return a List
357: * @exception PersistenceException on error.
358: */
359: public List getAllActivities(WMSessionHandle shandle)
360: throws PersistenceException;
361:
362: /**
363: * Method getAllProcessesForMgr
364: *
365: * @param mgrName a String
366: * @return a List
367: * @exception PersistenceException on error.
368: */
369: public List getAllProcessesForMgr(WMSessionHandle shandle,
370: String mgrName) throws PersistenceException;
371:
372: /**
373: * Returns a list of processes which state is open.running.
374: *
375: * @return a List
376: * @exception PersistenceException on error.
377: */
378: public List getAllRunningProcesses(WMSessionHandle shandle)
379: throws PersistenceException;
380:
381: /**
382: * Returns a list of processes which state starts with closed.
383: *
384: * @return a List
385: * @exception PersistenceException on error.
386: */
387: public List getAllFinishedProcesses(WMSessionHandle shandle)
388: throws PersistenceException;
389:
390: /**
391: * Method getAllActivitiesForProcess
392: *
393: * @param procId a String
394: * @return a List
395: * @exception PersistenceException on error.
396: */
397: public List getAllActivitiesForProcess(WMSessionHandle shandle,
398: String procId) throws PersistenceException;
399:
400: public List getActivitiesForProcess(WMSessionHandle shandle,
401: String procId, String actState) throws PersistenceException;
402:
403: /**
404: * Method getAllActivitiesForProcess
405: *
406: * @param procId a String
407: * @return a List
408: * @exception PersistenceException on error.
409: */
410: public List getAllFinishedActivitiesForProcess(
411: WMSessionHandle shandle, String procId)
412: throws PersistenceException;
413:
414: /**
415: * Method getAllActiveActivitiesForProcess
416: *
417: * @param procId a String
418: * @return a List
419: * @exception PersistenceException on error.
420: */
421: public List getAllActiveActivitiesForProcess(
422: WMSessionHandle shandle, String procId)
423: throws PersistenceException;
424:
425: /**
426: * Method getAllAssignmentsForResource
427: *
428: * @param resUsername a String
429: * @return a List
430: * @exception PersistenceException on error.
431: */
432: public List getAllAssignmentsForResource(WMSessionHandle shandle,
433: String resUsername) throws PersistenceException;
434:
435: /**
436: * Method getAllValidAssignmentsForResource
437: *
438: * @param resUsername a String
439: * @return a List
440: * @exception PersistenceException on error.
441: */
442: public List getAllValidAssignmentsForResource(
443: WMSessionHandle shandle, String resUsername)
444: throws PersistenceException;
445:
446: /**
447: * Method getAllAssignmentsForActivity
448: *
449: * @param actId a String
450: * @return a List
451: * @exception PersistenceException on error.
452: */
453: public List getAllAssignmentsForActivity(WMSessionHandle shandle,
454: String procId, String actId) throws PersistenceException;
455:
456: /**
457: * Method getAllValidAssignmentsForActivity
458: *
459: * @param actId a String
460: * @return a List
461: * @exception PersistenceException on error.
462: */
463: public List getAllValidAssignmentsForActivity(
464: WMSessionHandle shandle, String procId, String actId)
465: throws PersistenceException;
466:
467: /**
468: * Method getAllVariablesForProcess
469: *
470: * @param procId a String
471: * @return a List
472: * @exception PersistenceException on error.
473: */
474: public List getAllVariablesForProcess(WMSessionHandle shandle,
475: String procId) throws PersistenceException;
476:
477: /**
478: * Method getProcessVariables
479: *
480: * @param procId a String
481: * @return a List
482: * @exception PersistenceException on error.
483: */
484: public List getProcessVariables(WMSessionHandle shandle,
485: String procId, List variableIds)
486: throws PersistenceException;
487:
488: /**
489: * Method getAllVariablesForActivity
490: *
491: * @param actId a String
492: * @return a List
493: * @exception PersistenceException on error.
494: */
495: public List getAllVariablesForActivity(WMSessionHandle shandle,
496: String procId, String actId) throws PersistenceException;
497:
498: /**
499: * Method getActivityVariables
500: *
501: * @param actId a String
502: * @return a List
503: * @exception PersistenceException on error.
504: */
505: public List getActivityVariables(WMSessionHandle shandle,
506: String procId, String actId, List variableIds)
507: throws PersistenceException;
508:
509: /**
510: * Method getResourceRequestersProcessIds
511: *
512: * @param resUsername a String
513: * @return a List
514: * @exception PersistenceException on error.
515: */
516: public List getResourceRequestersProcessIds(
517: WMSessionHandle shandle, String resUsername)
518: throws PersistenceException;
519:
520: /**
521: * Method getAndJoinEntries
522: *
523: * @param procId a String
524: * @param blockActId a String
525: * @param aDefId a String
526: * @return a List
527: * @exception PersistenceException on error.
528: */
529: public List getAndJoinEntries(WMSessionHandle shandle,
530: String procId, String blockActId, String aDefId)
531: throws PersistenceException;
532:
533: /**
534: * Method howManyAndJoinEntries
535: *
536: * @param procId a String
537: * @param blockActId a String
538: * @param aDefId a String
539: * @return an int
540: * @exception PersistenceException on error.
541: */
542: public int howManyAndJoinEntries(WMSessionHandle shandle,
543: String procId, String blockActId, String aDefId)
544: throws PersistenceException;
545:
546: /**
547: * Returns deadlines of all activities of given process.
548: *
549: * @param procId a String
550: * @return a List
551: * @throws PersistenceException
552: */
553: public List getAllDeadlinesForProcess(WMSessionHandle shandle,
554: String procId) throws PersistenceException;
555:
556: /**
557: * Returns deadlines of all activities of given process which time limit is broken.
558: *
559: * @param procId a String
560: * @return a List
561: * @throws PersistenceException
562: */
563: public List getAllDeadlinesForProcess(WMSessionHandle shandle,
564: String procId, long timeLimitBoundary)
565: throws PersistenceException;
566:
567: /**
568: * Returns process ids for which deadline time limit is broken on any running activity .
569: */
570: public List getAllIdsForProcessesWithExpiriedDeadlines(
571: WMSessionHandle shandle, long timeLimitBoundary)
572: throws PersistenceException;
573:
574: /**
575: * Returns all deadlines of a given activity.
576: *
577: * @param procId a String
578: * @param actId a String
579: * @return a List
580: * @throws PersistenceException
581: */
582: public List getAllDeadlinesForActivity(WMSessionHandle shandle,
583: String procId, String actId) throws PersistenceException;
584:
585: /**
586: * Returns all deadlines of a given activity which time limit is broken.
587: *
588: * @param procId a String
589: * @param actId a String
590: * @return a List
591: * @throws PersistenceException
592: */
593: public List getAllDeadlinesForActivity(WMSessionHandle shandle,
594: String procId, String actId, long timeLimitBoundary)
595: throws PersistenceException;
596:
597: /**
598: * Method getExecuteCount
599: *
600: * @param procId a String
601: * @param aDefId a String
602: * @return an int
603: * @exception PersistenceException
604: */
605: public int getExecuteCount(WMSessionHandle shandle, String procId,
606: String aDefId) throws PersistenceException;
607:
608: /**
609: * @param sqlWhere
610: * @return list of process manager objects complying to sqlWhere clause
611: * @throws PersistenceException
612: */
613: public List getProcessMgrsWhere(WMSessionHandle shandle,
614: String sqlWhere, int startAt, int limit)
615: throws PersistenceException;
616:
617: /**
618: * @param sqlWhere
619: * @return list of process objects complying to sqlWhere clause
620: * @throws PersistenceException
621: */
622: List getProcessesWhere(WMSessionHandle shandle, String sqlWhere,
623: int startAt, int limit) throws PersistenceException;
624:
625: /**
626: * @param sqlWhere
627: * @return list of activity objects complying to sqlWhere clause
628: * @throws PersistenceException
629: */
630: List getActivitiesWhere(WMSessionHandle shandle, String sqlWhere,
631: int startAt, int limit) throws PersistenceException;
632:
633: /**
634: * @param sqlWhere
635: * @return list of assignment objects complying to sqlWhere clause
636: */
637: List getAssignmentsWhere(WMSessionHandle shandle, String sqlWhere,
638: int startAt, int limit) throws PersistenceException;
639:
640: /**
641: * @param sqlWhere
642: * @return list of resource objects complying to sqlWhere clause
643: * @throws PersistenceException
644: */
645: List getResourcesWhere(WMSessionHandle shandle, String sqlWhere,
646: int startAt, int limit) throws PersistenceException;
647:
648: void synchronizeProcess(WMSessionHandle shandle, String procId)
649: throws PersistenceException;
650:
651: // /**
652: // * Method createProcessMgr
653: // *
654: // * @return a ProcessMgrPersistenceInterface
655: // */
656: // public ProcessMgrPersistenceInterface createProcessMgr();
657: //
658: // /**
659: // * Method createProcess
660: // *
661: // * @return a ProcessPersistenceInterface
662: // */
663: // public ProcessPersistenceInterface createProcess();
664: //
665: // /**
666: // * Method createActivity
667: // *
668: // * @return an ActivityPersistenceInterface
669: // */
670: // public ActivityPersistenceInterface createActivity();
671: //
672: // /**
673: // * Method createAssignment
674: // *
675: // * @return an AssignmentPersistenceInterface
676: // */
677: // public AssignmentPersistenceInterface createAssignment();
678: //
679: // /**
680: // * Method createResource
681: // *
682: // * @return a ResourcePersistenceInterface
683: // */
684: // public ResourcePersistenceInterface createResource();
685: //
686: // /**
687: // * Method createProcessVariable
688: // *
689: // * @return a ProcessVariablePersistenceInterface
690: // */
691: // public ProcessVariablePersistenceInterface createProcessVariable();
692: //
693: // /**
694: // * Method createActivityVariable
695: // *
696: // * @return an ActivityVariablePersistenceInterface
697: // */
698: // public ActivityVariablePersistenceInterface createActivityVariable();
699: //
700: // /**
701: // * Method createAndJoinEntry
702: // *
703: // * @return an AndJoinEntryInterface
704: // */
705: // public AndJoinEntryInterface createAndJoinEntry();
706: //
707: // /**
708: // * Method createDeadline
709: // *
710: // * @return a DeadlinePersistenceInterface
711: // */
712: // public DeadlinePersistenceInterface createDeadline();
713:
714: /**
715: * Method getNextId
716: *
717: * @param idName a String
718: * @return a String
719: * @exception PersistenceException on error.
720: */
721: public String getNextId(String idName) throws PersistenceException;
722:
723: }
|