001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    
021    package org.apache.directory.server.ntp.messages;
022    
023    
024    /**
025     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
026     * @version $Rev: 547539 $, $Date: 2007-06-15 08:08:06 +0200 (Fri, 15 Jun 2007) $
027     */
028    public class NtpMessageModifier
029    {
030        private LeapIndicatorType leapIndicator;
031        private int versionNumber;
032        private ModeType mode;
033        private StratumType stratumType;
034        private byte pollInterval;
035        private byte precision;
036        private int rootDelay;
037        private int rootDispersion;
038    
039        private ReferenceIdentifier referenceIdentifier;
040    
041        private NtpTimeStamp referenceTimestamp;
042        private NtpTimeStamp originateTimestamp;
043        private NtpTimeStamp receiveTimestamp;
044        private NtpTimeStamp transmitTimestamp;
045    
046    
047        /**
048         * Returns the built {@link NtpMessage}.
049         *
050         * @return The {@link NtpMessage}.
051         */
052        public NtpMessage getNtpMessage()
053        {
054            return new NtpMessage( leapIndicator, versionNumber, mode, stratumType, pollInterval, precision, rootDelay,
055                rootDispersion, referenceIdentifier, referenceTimestamp, originateTimestamp, receiveTimestamp,
056                transmitTimestamp );
057        }
058    
059    
060        /**
061         * @param leapIndicator The Leap Indicator to set.
062         */
063        public void setLeapIndicator( LeapIndicatorType leapIndicator )
064        {
065            this.leapIndicator = leapIndicator;
066        }
067    
068    
069        /**
070         * @param mode The Mode to set.
071         */
072        public void setMode( ModeType mode )
073        {
074            this.mode = mode;
075        }
076    
077    
078        /**
079         * @param originateTimestamp The Originate Timestamp to set.
080         */
081        public void setOriginateTimestamp( NtpTimeStamp originateTimestamp )
082        {
083            this.originateTimestamp = originateTimestamp;
084        }
085    
086    
087        /**
088         * @param pollInterval The Poll Interval to set.
089         */
090        public void setPollInterval( byte pollInterval )
091        {
092            this.pollInterval = pollInterval;
093        }
094    
095    
096        /**
097         * @param precision The Precision to set.
098         */
099        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    }