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   */
27  public class NtpMessageModifier
28  {
29      private LeapIndicatorType leapIndicator;
30      private int versionNumber;
31      private ModeType mode;
32      private StratumType stratumType;
33      private byte pollInterval;
34      private byte precision;
35      private int rootDelay;
36      private int rootDispersion;
37  
38      private ReferenceIdentifier referenceIdentifier;
39  
40      private NtpTimeStamp referenceTimestamp;
41      private NtpTimeStamp originateTimestamp;
42      private NtpTimeStamp receiveTimestamp;
43      private NtpTimeStamp transmitTimestamp;
44  
45  
46      /**
47       * Returns the built {@link NtpMessage}.
48       *
49       * @return The {@link NtpMessage}.
50       */
51      public NtpMessage getNtpMessage()
52      {
53          return new NtpMessage( leapIndicator, versionNumber, mode, stratumType, pollInterval, precision, rootDelay,
54              rootDispersion, referenceIdentifier, referenceTimestamp, originateTimestamp, receiveTimestamp,
55              transmitTimestamp );
56      }
57  
58  
59      /**
60       * @param leapIndicator The Leap Indicator to set.
61       */
62      public void setLeapIndicator( LeapIndicatorType leapIndicator )
63      {
64          this.leapIndicator = leapIndicator;
65      }
66  
67  
68      /**
69       * @param mode The Mode to set.
70       */
71      public void setMode( ModeType mode )
72      {
73          this.mode = mode;
74      }
75  
76  
77      /**
78       * @param originateTimestamp The Originate Timestamp to set.
79       */
80      public void setOriginateTimestamp( NtpTimeStamp originateTimestamp )
81      {
82          this.originateTimestamp = originateTimestamp;
83      }
84  
85  
86      /**
87       * @param pollInterval The Poll Interval to set.
88       */
89      public void setPollInterval( byte pollInterval )
90      {
91          this.pollInterval = pollInterval;
92      }
93  
94  
95      /**
96       * @param precision The Precision to set.
97       */
98      public void setPrecision( byte precision )
99      {
100         this.precision = precision;
101     }
102 
103 
104     /**
105      * @param receiveTimestamp The Receive Timestamp to set.
106      */
107     public void setReceiveTimestamp( NtpTimeStamp receiveTimestamp )
108     {
109         this.receiveTimestamp = receiveTimestamp;
110     }
111 
112 
113     /**
114      * @param referenceIdentifier The Reference Identifier to set.
115      */
116     public void setReferenceIdentifier( ReferenceIdentifier referenceIdentifier )
117     {
118         this.referenceIdentifier = referenceIdentifier;
119     }
120 
121 
122     /**
123      * @param referenceTimestamp The Reference Timestamp to set.
124      */
125     public void setReferenceTimestamp( NtpTimeStamp referenceTimestamp )
126     {
127         this.referenceTimestamp = referenceTimestamp;
128     }
129 
130 
131     /**
132      * @param rootDelay The Root Delay to set.
133      */
134     public void setRootDelay( int rootDelay )
135     {
136         this.rootDelay = rootDelay;
137     }
138 
139 
140     /**
141      * @param rootDispersion The Root Dispersion to set.
142      */
143     public void setRootDispersion( int rootDispersion )
144     {
145         this.rootDispersion = rootDispersion;
146     }
147 
148 
149     /**
150      * @param stratumType The Stratum to set.
151      */
152     public void setStratum( StratumType stratumType )
153     {
154         this.stratumType = stratumType;
155     }
156 
157 
158     /**
159      * @param transmitTimestamp The Transmit Timestamp to set.
160      */
161     public void setTransmitTimestamp( NtpTimeStamp transmitTimestamp )
162     {
163         this.transmitTimestamp = transmitTimestamp;
164     }
165 
166 
167     /**
168      * @param versionNumber The Version Number to set.
169      */
170     public void setVersionNumber( int versionNumber )
171     {
172         this.versionNumber = versionNumber;
173     }
174 }