View Javadoc

1   package org.lsst.ccs.config;
2   
3   import org.lsst.gruth.jutils.ComponentNode;
4   
5   import javax.persistence.EmbeddedId;
6   import javax.persistence.Entity;
7   import javax.persistence.Lob;
8   import java.io.Serializable;
9   
10  /**
11   * objects of this class represent a complete set of data with modified configuration parameters that can be used to start
12   * a subsystem.
13   */
14  @Entity
15  public class PreparedConfiguration implements Serializable {
16      private static final long serialVersionUID = -6386284584439938312L;
17      @EmbeddedId
18      private NamesAndTag nameAndTag = new NamesAndTag() ;
19      private boolean fromProfile ;
20      private String user ;
21      @Lob // tinyLOb!
22      private ComponentNode configuredData ;
23  
24      //TODO: add deployment descriptors
25      /////////////////////////////////// CONSTRUCTORS
26  
27      PreparedConfiguration() {
28      }
29  
30      public PreparedConfiguration(String namedReference, String tag, String subsystemName, String user, boolean fromProfile,
31                                   ComponentNode configuredData) {
32          this.nameAndTag.setConfigName(namedReference);
33          this.nameAndTag.setTag(tag);
34          this.nameAndTag.setSubsystemName(subsystemName);
35          this.user = user ;
36          this.fromProfile = fromProfile;
37          this.configuredData = configuredData;
38      }
39  
40      public PreparedConfiguration(ConfigProfile profile) {
41          this.nameAndTag.setConfigName(profile.getName());
42          this.nameAndTag.setTag(profile.getTag());
43          this.nameAndTag.setSubsystemName(profile.getSubsystemDescription().getSubsystemName());
44          this.user = profile.getUserName() ;
45          this.fromProfile = true;
46          ComponentNode configuredData = profile.getModifiedConfigurationData();
47          this.configuredData = configuredData;
48  
49      }
50  
51      //////////////////////////////// ACCESSORS/MUTATORS
52  
53      public boolean isFromProfile() {
54          return fromProfile;
55      }
56  
57       void setFromProfile(boolean fromProfile) {
58          this.fromProfile = fromProfile;
59      }
60  
61  
62      public ComponentNode getConfiguredData() {
63          return configuredData;
64      }
65  
66       void setConfiguredData(ComponentNode configuredData) {
67          this.configuredData = configuredData;
68      }
69  
70      public String getSubsystemName() {
71          return nameAndTag.getSubsystemName();
72      }
73  
74  
75      public NamesAndTag getNameAndTag() {
76          return nameAndTag;
77      }
78  
79      void setNameAndTag(NamesAndTag nameAndTag) {
80          this.nameAndTag = nameAndTag;
81      }
82  
83      public String getUser() {
84          return user;
85      }
86  
87      public void setUser(String user) {
88          this.user = user;
89      }
90  
91      public String getConfigName() {
92          return nameAndTag.getConfigName() ;
93      }
94  
95      public String getTag() {
96          return nameAndTag.getTag() ;
97      }
98  }