directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r164640 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/LdapDecoder.java
Date Mon, 25 Apr 2005 20:32:55 GMT
Author: elecharny
Date: Mon Apr 25 13:32:55 2005
New Revision: 164640

URL: http://svn.apache.org/viewcvs?rev=164640&view=rev
Log:
Added this class to do the Ldap pools initialization

Added:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/LdapDecoder.java

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/LdapDecoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/LdapDecoder.java?rev=164640&view=auto
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/LdapDecoder.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/LdapDecoder.java
Mon Apr 25 13:32:55 2005
@@ -0,0 +1,89 @@
+/*
+ *   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.ldap.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.ldap.pojo.factories.BindRequestPOJOFactory;
+import org.apache.asn1.ldap.pojo.factories.BindResponsePOJOFactory;
+import org.apache.asn1.ldap.pojo.factories.LdapMessagePOJOFactory;
+import org.apache.asn1.ldap.pojo.factories.LdapResultPOJOFactory;
+import org.apache.asn1.ldap.pojo.factories.SaslAuthenticationPOJOFactory;
+import org.apache.asn1.ldap.pojo.factories.SimpleAuthenticationPOJOFactory;
+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 Ldap 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 LdapDecoder extends Asn1Decoder {
+    
+    /**
+     * Standard LdapDecoder constructor. The decoder will
+     * be pooled.
+     *
+     */
+    public LdapDecoder()
+    {
+        this(true);
+    }
+    
+    /**
+     * LdapDecoder constructor.
+     * 
+     * @param isPooled Tells if the objects are allocated or pooled. 
+     */
+    public LdapDecoder(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);
+        
+        // Ldap pools
+        poolMgr.initPool(LdapPoolEnum.SIMPLE_AUTH_POJO_POOL, new SimpleAuthenticationPOJOFactory(),
1024, 1024);
+        poolMgr.initPool(LdapPoolEnum.SASL_AUTH_POJO_POOL, new SaslAuthenticationPOJOFactory(),
1024, 1024);
+        poolMgr.initPool(LdapPoolEnum.BIND_RESPONSE_POJO_POOL, new BindResponsePOJOFactory(),
1024, 1024);
+        poolMgr.initPool(LdapPoolEnum.BIND_REQUEST_POJO_POOL, new BindRequestPOJOFactory(),
1024, 1024);
+        poolMgr.initPool(LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL, new LdapMessageContainerFactory(),
1024, 1024);
+        poolMgr.initPool(LdapPoolEnum.LDAP_MESSAGE_POJO_POOL, new LdapMessagePOJOFactory(),
1024, 1024);
+        poolMgr.initPool(LdapPoolEnum.LDAP_RESULT_POJO_POOL, new LdapResultPOJOFactory(),
1024, 1024);
+    }
+}



Mime
View raw message