View Javadoc

1   /*
2    * Copyright 2010 Fraunhofer Gesellschaft, Munich, Germany,
3    * for its Fraunhofer Institute for Computer Architecture and Software
4    * Technology (FIRST), Berlin, Germany. All rights reserved.
5    * http://www.first.fraunhofer.de/
6    */
7   
8   package net.kwfgrid.gworkflowdl.structure;
9   
10  
11  
12  /***
13   * interface for Tokens.
14   */
15  public interface Token {
16  
17      /***
18       * default initial parameters.
19       */
20      Boolean DEFAULT_CONTROL = true;
21  
22      /***
23       * Get the identifier of this Token. 
24       * Format according to xs:ID (derived from xs:String, form XML NCName).
25       * Has to start with a letter or "_", may contain letters, digits, ".", "-", or "_", must not contain "/", ":", " ".
26       */
27      public String getID();
28  
29      /***
30       * set Place ID.
31       * Format according to xs:ID (derived from xs:String, form XML NCName).
32       * Has to start with a letter or "_", may contain letters, digits, ".", "-", or "_", must not contain "/", ":", " ".
33       * @param id identifier to be set.
34       */
35      void setID(String id);
36  
37      /***
38       *
39       * @return tokens's properties
40       */
41      GenericProperties getProperties();
42  
43      /***
44       *
45       * @return token's data
46       */
47      Data getData();
48  
49      /***
50       * Get the control value of this token.
51       * @return the control value of this token or <code>null</code> if there is no control value.
52       */
53      Boolean getControl();
54  
55      Object clone();
56  
57      /***
58       * Lock this token. Locked tokens will not be regarded in the decision whether a transition is enabled or not.
59       * The lock has no XML representation in the GWorkflowDL and is not propagated to distributed instances.
60       * @param transition The transition that locked the token.
61       */
62      void lock(Transition transition);
63  
64      /***
65       * Unlock this token.
66       */
67      void unlock();
68  
69      /***
70       * Test if this token is locked.
71       * @return returns <code>true</code> if the token is locked, <code>false</code> otherwise.
72       */
73      boolean isLocked();
74  
75      /***
76       * Test if this token is locked by a specific transition
77       * @param transition
78       * @return returns <code>true</code> if the token has been locked by the specific transition, <code>false</code> otherwise.
79       */
80      boolean isLockedBy(Transition transition);
81  
82  }