View Javadoc

1   package org.lsst.ccs.config;
2   
3   import java.util.Collection;
4   import java.util.List;
5   
6   /**
7    * defines the basic methods implemented by a Data Access Object.
8    * Note that many org.lsst.gruth.types are package protected so implementors whould be in the same package.
9    * @author bamade
10   */
11  // Date: 13/04/12
12  
13  public interface DBInterface {
14      /**
15       * starts a transaction
16       */
17      public void begin() ;
18  
19      /**
20       * end a transaction
21       */
22      public void end() ;
23  
24      /**
25       * failure: must close transaction
26       */
27      public void fail() ;
28  
29      /**
30       * same as fail but a Throwable can be used to log.
31       * @param th
32       */
33      public void fail(Throwable th) ;
34  
35  
36      /**
37       * saves the argument: which must now becomes immutable and be numbered (with an ID)
38       * @param newDescription
39       */
40      public void saveSubsystemDescription (ASubsystemDescription newDescription) ;
41  
42      /**
43       * saves the argument
44       * @param ghosts
45       */
46      public void saveGhostDescriptions (GhostSubsystemDescription ghosts);
47  
48      /**
49       *  gets a SubsystemDescription in the corresponding active object table.
50       * @param name
51       * @param tag
52       * @return null if not found
53       */
54      public ASubsystemDescription getActiveSubsystemDescription(String name, String tag) ;
55  
56      /**
57       * gets a subsystem descirption by it"s id
58       * @param id
59       * @return
60       */
61      public ASubsystemDescription getActiveSubsystemDescription(long id) ;
62  
63      /**
64       * returns ghost with corresponding id
65       * @param id
66       * @return null if not found
67       */
68      public GhostSubsystemDescription getGhostDescription(long id) ;
69  
70      /**
71       * deletes an active description
72       * @param oldDescription
73       */
74      public void deleteActiveSubsystemDescription(ASubsystemDescription oldDescription) ;
75  
76      /**
77       * saves the new argument: ID is modified and argument becomes immutable.
78       * @param newProfile
79       */
80      public void saveConfigProfile(AConfigProfile newProfile) ;
81      // marks the Ghost's end date
82  
83      /**
84       * saves argument
85       * @param deprecatedProfile
86       */
87      public void savePastProfile(PastConfigProfile deprecatedProfile) ;
88  
89      /**
90       * get configProfile with name and tag
91       * @param name
92       * @param tag
93       * @return null if not found
94       */
95      public AConfigProfile getActiveConfigProfile(String name, String tag) ;
96  
97      /**
98       * delectes the active profile from DB
99       * @param oldProfile
100      */
101     public void deleteActiveConfigProfile(AConfigProfile oldProfile) ;
102 
103     /**
104      * registers a modified  parameter
105      * @param config
106      */
107     public void modifyParmConfig(AParameterConfiguration config) ;
108 
109     /**
110      * gets the active configProfiles that references an active SubsystemDescription
111      * @param description
112      * @return
113      */
114     public Collection<AConfigProfile> getActiveProfilesForSubsystem(ASubsystemDescription description) ;
115 
116     /**
117      * get the deprecated ConfigProfile that referenced a subsystemDescription (active or deprecated)
118      * @param description
119      * @return
120      */
121     public Collection<PastConfigProfile> getProfilesForSubsystem(GhostSubsystemDescription description) ;
122 
123     /**
124      * saves a run history
125      * @param runHistory
126      */
127     public void saveRun(RunHistory runHistory) ;
128 
129     /**
130      * saves a preparedConfiguration
131      * @param preparedConfiguration
132      */
133     public void savePreparedConfiguration(PreparedConfiguration preparedConfiguration) ;
134 
135     /**
136      * returns a prepared Configuration
137      * @param subsystemName
138      * @param configName
139      * @param tag
140      * @return null if not found
141      */
142     public PreparedConfiguration getPreparedConfiguration(String subsystemName, String configName, String tag) ;
143 
144     /**
145      * saves a machine configuration
146      * @param machineConfiguration
147      */
148     public void saveMachineConfiguration(MachineConfiguration machineConfiguration) ;
149 
150     /**
151      * get a machine configuration..
152      * @param macAddress
153      * @return null if not found
154      */
155     public MachineConfiguration getMachineConfiguration(String macAddress) ;
156 
157     /**
158      * execut simple request (read only: select of From)
159      * @param hqlString
160      * @return
161      */
162     public List<?> simpleHQLRequest(String hqlString) ;
163 
164     /**
165      * claose all
166      */
167     public void close() ;
168 }