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    package org.apache.directory.server.kerberos.shared.messages;
021    
022    
023    import javax.security.auth.kerberos.KerberosPrincipal;
024    
025    import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
026    
027    
028    /**
029     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
030     * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
031     */
032    public class ErrorMessageModifier
033    {
034        private KerberosTime clientTime; //optional
035        private Integer clientMicroSecond; //optional
036        private KerberosTime serverTime;
037        private int serverMicroSecond;
038        private int errorCode;
039        private KerberosPrincipal clientPrincipal; //optional
040        private KerberosPrincipal serverPrincipal;
041        private String explanatoryText; //optional
042        private byte[] explanatoryData; //optional
043    
044    
045        /**
046         * Returns the {@link ErrorMessage}.
047         *
048         * @return The {@link ErrorMessage}.
049         */
050        public ErrorMessage getErrorMessage()
051        {
052            return new ErrorMessage( clientTime, clientMicroSecond, serverTime, serverMicroSecond, errorCode,
053                clientPrincipal, serverPrincipal, explanatoryText, explanatoryData );
054        }
055    
056    
057        /**
058         * Sets the client {@link KerberosPrincipal}.
059         *
060         * @param principal
061         */
062        public void setClientPrincipal( KerberosPrincipal principal )
063        {
064            this.clientPrincipal = principal;
065        }
066    
067    
068        /**
069         * Sets the client {@link KerberosTime}.
070         *
071         * @param time
072         */
073        public void setClientTime( KerberosTime time )
074        {
075            this.clientTime = time;
076        }
077    
078    
079        /**
080         * Sets the client microsecond.
081         *
082         * @param clientMicroSecond
083         */
084        public void setClientMicroSecond( Integer clientMicroSecond )
085        {
086            this.clientMicroSecond = clientMicroSecond;
087        }
088    
089    
090        /**
091         * Sets the explanatory data.
092         *
093         * @param data
094         */
095        public void setExplanatoryData( byte[] data )
096        {
097            this.explanatoryData = data;
098        }
099    
100    
101        /**
102         * Sets the error code.
103         *
104         * @param code
105         */
106        public void setErrorCode( int code )
107        {
108            this.errorCode = code;
109        }
110    
111    
112        /**
113         * Sets the explanatory text.
114         *
115         * @param text
116         */
117        public void setExplanatoryText( String text )
118        {
119            this.explanatoryText = text;
120        }
121    
122    
123        /**
124         * Sets the server {@link KerberosPrincipal}.
125         *
126         * @param principal
127         */
128        public void setServerPrincipal( KerberosPrincipal principal )
129        {
130            this.serverPrincipal = principal;
131        }
132    
133    
134        /**
135         * Sets the server {@link KerberosTime}.
136         *
137         * @param time
138         */
139        public void setServerTime( KerberosTime time )
140        {
141            this.serverTime = time;
142        }
143    
144    
145        /**
146         * Sets the server microsecond.
147         *
148         * @param serverMicroSecond
149         */
150        public void setServerMicroSecond( int serverMicroSecond )
151        {
152            this.serverMicroSecond = serverMicroSecond;
153        }
154    }