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  package org.apache.directory.shared.kerberos.codec.ticket;
21  
22  
23  import java.nio.ByteBuffer;
24  
25  import org.apache.directory.api.asn1.ber.AbstractContainer;
26  import org.apache.directory.shared.kerberos.messages.Ticket;
27  
28  
29  /**
30   * The Ticket container stores the ticket decoded by the Asn1Decoder.
31   * When dealing with an incoding PDU, we will obtain a KerberosMessage in the
32   * container.
33   * 
34   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35   */
36  public class TicketContainer extends AbstractContainer
37  {
38      /** The ticket */
39      private Ticket ticket;
40  
41  
42      /**
43       * Creates a new TicketContainer object. We will store one grammars,
44       * it's enough ...
45       * @param stream The stream containing the data to decode
46       */
47      public TicketContainer( ByteBuffer stream )
48      {
49          super( stream );
50          setGrammar( TicketGrammar.getInstance() );
51          setTransition( TicketStatesEnum.START_STATE );
52      }
53  
54  
55      /**
56       * @return Returns the Ticket.
57       */
58      public Ticket getTicket()
59      {
60          return ticket;
61      }
62  
63  
64      /**
65       * Set a Ticket into the container. It will be completed by the
66       * KerberosDecoder.
67       * 
68       * @param ticket The ticket to set.
69       */
70      public void setTicket( Ticket ticket )
71      {
72          this.ticket = ticket;
73      }
74  }