You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/04/25 23:41:12 UTC

svn commit: r164663 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoDecoder.java

Author: elecharny
Date: Mon Apr 25 14:41:11 2005
New Revision: 164663

URL: http://svn.apache.org/viewcvs?rev=164663&view=rev
Log:
Added the SpnegoDecoder class

Added:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoDecoder.java

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoDecoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoDecoder.java?rev=164663&view=auto
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoDecoder.java (added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/SpnegoDecoder.java Mon Apr 25 14:41:11 2005
@@ -0,0 +1,82 @@
+/*
+ *   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.Asn1Decoder;
+import org.apache.asn1.ber.tlv.TLVFactory;
+import org.apache.asn1.ber.tlv.TLVPoolEnum;
+import org.apache.asn1.spnego.pojo.factories.SpnegoNegTokenInitPOJOFactory;
+import org.apache.asn1.spnego.pojo.factories.SpnegoNegTokenTargPOJOFactory;
+import org.apache.asn1.util.MutableString1024Factory;
+import org.apache.asn1.util.MutableString128Factory;
+import org.apache.asn1.util.MutableString16Factory;
+import org.apache.asn1.util.MutableString256Factory;
+import org.apache.asn1.util.MutableString32Factory;
+import org.apache.asn1.util.MutableString512Factory;
+import org.apache.asn1.util.MutableString64Factory;
+import org.apache.asn1.util.MutableStringFactory;
+import org.apache.asn1.util.pools.LocalPoolManager;
+import org.apache.asn1.util.pools.PoolEnum;
+
+/**
+ * The Spnego decoder. This class does the initialisation of the object's pools.
+
+ *  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class SpnegoDecoder extends Asn1Decoder {
+    
+    /**
+     * Standard LdapDecoder constructor. The decoder will
+     * be pooled.
+     *
+     */
+    public SpnegoDecoder()
+    {
+        this(true);
+    }
+    
+    /**
+     * LdapDecoder constructor.
+     * 
+     * @param isPooled Tells if the objects are allocated or pooled. 
+     */
+    public SpnegoDecoder(boolean isPooled)
+    {
+        // We have to create the pools, which are MutableString
+        // pools. We will initialize 60 pools, because we will
+        // use TLV pools, String pools and Ldap pools
+        poolMgr = new LocalPoolManager( 60, true );
+
+        // Standard ASN.1 pools
+        poolMgr.initPool(TLVPoolEnum.TLV_POOL, new TLVFactory(), 1024, 10240);
+        
+        // String pools
+        poolMgr.initPool(PoolEnum.STRING_POOL_16, new MutableString16Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_32, new MutableString32Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_64, new MutableString64Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_128, new MutableString128Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_256, new MutableString256Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_512, new MutableString512Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_1024, new MutableString1024Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STREAMED_STRING_POOL, new MutableStringFactory(), 1024, 1024);
+        
+        // Spnego pools
+        poolMgr.initPool(SpnegoPoolEnum.SPNEGO_CONTAINER_POOL, new SpnegoContainerFactory(), 1024, 1024);
+        poolMgr.initPool(SpnegoPoolEnum.SPNEGO_NEG_TOKEN_INIT_POJO_POOL, new SpnegoNegTokenInitPOJOFactory(), 1024, 1024);
+        poolMgr.initPool(SpnegoPoolEnum.SPNEGO_NEG_TOKEN_TARG_POJO_POOL, new SpnegoNegTokenTargPOJOFactory(), 1024, 1024);
+    }
+}