Author: elecharny
Date: Fri Apr 22 22:55:27 2005
New Revision: 164341
URL: http://svn.apache.org/viewcvs?rev=164341&view=rev
Log:
Added the spnego container
Added:
directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/
directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoContainer.java
Added:
directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoContainer.java
URL:
http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoContainer.java?rev=164341&view=auto
==============================================================================
---
directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoContainer.java
(added)
+++
directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoContainer.java
Fri Apr 22 22:55:27 2005
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1.spnego.codec;
+
+import org.apache.asn1.ber.AbstractContainer;
+import org.apache.asn1.ber.containers.IAsn1Container;
+import org.apache.asn1.ber.grammar.IGrammar;
+import org.apache.asn1.spnego.codec.grammars.SpnegoGrammar;
+import org.apache.asn1.spnego.codec.grammars.SpnegoStatesEnum;
+import org.apache.asn1.spnego.pojo.SpnegoPOJO;
+
+
+/**
+ * The Spnego container stores all the spnego decoded by the
+ * Asn1Decoder. When dealing whith an incoding PDU, we will obtain
+ * a SpnegoPOJO in the IContainer.
+ *
+ * @author <a href="mailto:[email protected]">Apache Directory
Project</a>
+ */
+public class SpnegoContainer extends AbstractContainer implements
IAsn1Container //extends AbstractLdapContainer
+{
+ //~ Instance fields
----------------------------------------------------------------------------
+
+ /** The SPNEGO POJO */
+ private SpnegoPOJO spnego;
+
+ //~ Constructors
-------------------------------------------------------------------------------
+
+ /**
+ * Creates a new SpnegoContainer object.
+ * We will store ten grammars, it's enough ...
+ */
+ public SpnegoContainer()
+ {
+ super( );
+ currentGrammar = 0;
+ grammars = new IGrammar[10];
+ grammarStack = new IGrammar[10];
+ nbGrammars = 0;
+
+ grammars[SpnegoStatesEnum.SPNEGO_GRAMMAR] =
SpnegoGrammar.getInstance();
+
+ grammarStack[currentGrammar] =
grammars[SpnegoStatesEnum.SPNEGO_GRAMMAR];
+ }
+
+ //~ Methods
------------------------------------------------------------------------------------
+
+ /**
+ * Release the Spnego POJO
+ */
+ public void free()
+ {
+ state = 0;
+ transition = 0;
+ spnego.free();
+
+ for (int i = 0; i <= currentGrammar; i++ )
+ {
+ grammarStack[i] = null;
+ }
+
+ currentGrammar = 0;
+ nbGrammars = 0;
+
+ grammarStack[currentGrammar] =
grammars[SpnegoStatesEnum.SPNEGO_GRAMMAR];
+
+ super.free();
+ }
+
+ /**
+ * @return Returns the spnego.
+ */
+ public SpnegoPOJO getSpnego()
+ {
+
+ return spnego;
+ }
+
+ /**
+ * Set a spnego POJO into the container. It will be completed
+ * by the spnego Decoder .
+ *
+ * @param spnego The spnego to set.
+ */
+ public void setSpnego( SpnegoPOJO spnego )
+ {
+ this.spnego = spnego;
+ }
+}