View Javadoc

1   package org.lsst.ccs.bus;
2   
3   import org.lsst.ccs.utilities.tracers.Tracer;
4   
5   import java.io.Serializable;
6   
7   /**
8    * Generic abstract bus message class
9    * 
10   * Concrete implementations (command, status, logevent) will be sent on the
11   * appropriate bus.
12   * 
13   * 
14   * @author aubourg
15   * 
16   */
17  
18  public abstract class BusMessage implements Serializable, BusPayload {
19      static {
20          assert Tracer.version("$Rev$", BusMessage.class, "org-lsst-ccs-buses-definition") ;
21      }
22  
23      private static final long serialVersionUID = 5876509633029221141L;
24  	// @NotNull
25  	protected String origin;
26  	// @Nullable
27  	protected String summary;
28  
29  	//TODO : ??? 
30  	protected DetailLevel detailLevel = DetailLevel.INFO;
31  	protected PriorityLevel priorityLevel = PriorityLevel.INFO;
32  
33  	protected BusMessage(String origin) {
34  		this.origin = origin;
35  	}
36  	// use sparingly
37  	protected BusMessage() {
38  	}
39  
40  
41  	protected long timeStamp = System.currentTimeMillis();
42  
43  	public abstract String getMessageType();
44  	/**
45  	 * the origin subsystem
46  	 */
47  	public String getOrigin() {
48  		return origin;
49  	}
50  
51  	public void setOrigin(String origin) {
52  		this.origin = origin;
53  	}
54  
55  
56  	/**
57  	 * timestamp, in milliseconds since 1970
58  	 */
59  	public long getTimeStamp() {
60  		return timeStamp;
61  	}
62  
63  	public void setTimeStamp(long timeStamp) {
64  		this.timeStamp = timeStamp;
65  	}
66  
67  
68  	/**
69  	 * a summary string
70  	 * 
71  	 * @return
72  	 */
73  	public String getSummary() {
74  		return summary;
75  	}
76  
77  	public void setSummary(String summary) {
78  		this.summary = summary;
79  	}
80  
81  
82  	public DetailLevel getDetailLevel() {
83  		return detailLevel;
84  	}
85  
86  	/**
87  	 * Sets the detail level.
88  	 * 
89  	 * Will impact for instance the retention duration of the message
90  	 */
91  
92  	public void setDetailLevel(DetailLevel detailLevel) {
93  		this.detailLevel = detailLevel;
94  	}
95  
96  
97  	public PriorityLevel getPriorityLevel() {
98  		return priorityLevel;
99  	}
100 
101 	/**
102 	 * Sets the priority level.
103 	 * 
104 	 * Will be translated into a transport layer priority
105 	 */
106 
107 	public void setPriorityLevel(PriorityLevel priorityLevel) {
108 		this.priorityLevel = priorityLevel;
109 	}
110 
111 }