View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  
21  package org.apache.directory.server.ntp.messages;
22  
23  
24  /**
25   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
26   * @version $Rev: 547539 $, $Date: 2007-06-15 08:08:06 +0200 (Fr, 15 Jun 2007) $
27   */
28  public class NtpMessageModifier
29  {
30      private LeapIndicatorType leapIndicator;
31      private int versionNumber;
32      private ModeType mode;
33      private StratumType stratumType;
34      private byte pollInterval;
35      private byte precision;
36      private int rootDelay;
37      private int rootDispersion;
38  
39      private ReferenceIdentifier referenceIdentifier;
40  
41      private NtpTimeStamp referenceTimestamp;
42      private NtpTimeStamp originateTimestamp;
43      private NtpTimeStamp receiveTimestamp;
44      private NtpTimeStamp transmitTimestamp;
45  
46  
47      /**
48       * Returns the built {@link NtpMessage}.
49       *
50       * @return The {@link NtpMessage}.
51       */
52      public NtpMessage getNtpMessage()
53      {
54          return new NtpMessage( leapIndicator, versionNumber, mode, stratumType, pollInterval, precision, rootDelay,
55              rootDispersion, referenceIdentifier, referenceTimestamp, originateTimestamp, receiveTimestamp,
56              transmitTimestamp );
57      }
58  
59  
60      /**
61       * @param leapIndicator The Leap Indicator to set.
62       */
63      public void setLeapIndicator( LeapIndicatorType leapIndicator )
64      {
65          this.leapIndicator = leapIndicator;
66      }
67  
68  
69      /**
70       * @param mode The Mode to set.
71       */
72      public void setMode( ModeType mode )
73      {
74          this.mode = mode;
75      }
76  
77  
78      /**
79       * @param originateTimestamp The Originate Timestamp to set.
80       */
81      public void setOriginateTimestamp( NtpTimeStamp originateTimestamp )
82      {
83          this.originateTimestamp = originateTimestamp;
84      }
85  
86  
87      /**
88       * @param pollInterval The Poll Interval to set.
89       */
90      public void setPollInterval( byte pollInterval )
91      {
92          this.pollInterval = pollInterval;
93      }
94  
95  
96      /**
97       * @param precision The Precision to set.
98       */
99      public void setPrecision( byte precision )
100     {
101         this.precision = precision;
102     }
103 
104 
105     /**
106      * @param receiveTimestamp The Receive Timestamp to set.
107      */
108     public void setReceiveTimestamp( NtpTimeStamp receiveTimestamp )
109     {
110         this.receiveTimestamp = receiveTimestamp;
111     }
112 
113 
114     /**
115      * @param referenceIdentifier The Reference Identifier to set.
116      */
117     public void setReferenceIdentifier( ReferenceIdentifier referenceIdentifier )
118     {
119         this.referenceIdentifier = referenceIdentifier;
120     }
121 
122 
123     /**
124      * @param referenceTimestamp The Reference Timestamp to set.
125      */
126     public void setReferenceTimestamp( NtpTimeStamp referenceTimestamp )
127     {
128         this.referenceTimestamp = referenceTimestamp;
129     }
130 
131 
132     /**
133      * @param rootDelay The Root Delay to set.
134      */
135     public void setRootDelay( int rootDelay )
136     {
137         this.rootDelay = rootDelay;
138     }
139 
140 
141     /**
142      * @param rootDispersion The Root Dispersion to set.
143      */
144     public void setRootDispersion( int rootDispersion )
145     {
146         this.rootDispersion = rootDispersion;
147     }
148 
149 
150     /**
151      * @param stratumType The Stratum to set.
152      */
153     public void setStratum( StratumType stratumType )
154     {
155         this.stratumType = stratumType;
156     }
157 
158 
159     /**
160      * @param transmitTimestamp The Transmit Timestamp to set.
161      */
162     public void setTransmitTimestamp( NtpTimeStamp transmitTimestamp )
163     {
164         this.transmitTimestamp = transmitTimestamp;
165     }
166 
167 
168     /**
169      * @param versionNumber The Version Number to set.
170      */
171     public void setVersionNumber( int versionNumber )
172     {
173         this.versionNumber = versionNumber;
174     }
175 }