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 package org.apache.directory.server.kerberos.shared.messages;
21
22
23 import javax.security.auth.kerberos.KerberosPrincipal;
24
25 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
26
27
28 /**
29 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
30 * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Di, 22 Mai 2007) $
31 */
32 public class ErrorMessageModifier
33 {
34 private KerberosTime clientTime; //optional
35 private Integer clientMicroSecond; //optional
36 private KerberosTime serverTime;
37 private int serverMicroSecond;
38 private int errorCode;
39 private KerberosPrincipal clientPrincipal; //optional
40 private KerberosPrincipal serverPrincipal;
41 private String explanatoryText; //optional
42 private byte[] explanatoryData; //optional
43
44
45 /**
46 * Returns the {@link ErrorMessage}.
47 *
48 * @return The {@link ErrorMessage}.
49 */
50 public ErrorMessage getErrorMessage()
51 {
52 return new ErrorMessage( clientTime, clientMicroSecond, serverTime, serverMicroSecond, errorCode,
53 clientPrincipal, serverPrincipal, explanatoryText, explanatoryData );
54 }
55
56
57 /**
58 * Sets the client {@link KerberosPrincipal}.
59 *
60 * @param principal
61 */
62 public void setClientPrincipal( KerberosPrincipal principal )
63 {
64 this.clientPrincipal = principal;
65 }
66
67
68 /**
69 * Sets the client {@link KerberosTime}.
70 *
71 * @param time
72 */
73 public void setClientTime( KerberosTime time )
74 {
75 this.clientTime = time;
76 }
77
78
79 /**
80 * Sets the client microsecond.
81 *
82 * @param clientMicroSecond
83 */
84 public void setClientMicroSecond( Integer clientMicroSecond )
85 {
86 this.clientMicroSecond = clientMicroSecond;
87 }
88
89
90 /**
91 * Sets the explanatory data.
92 *
93 * @param data
94 */
95 public void setExplanatoryData( byte[] data )
96 {
97 this.explanatoryData = data;
98 }
99
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 }