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/08/29 07:35:53 UTC

svn commit: r264078 - /directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixProvider.java

Author: elecharny
Date: Sun Aug 28 22:35:48 2005
New Revision: 264078

URL: http://svn.apache.org/viewcvs?rev=264078&view=rev
Log:
Added the TwixDecoder

Added:
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixProvider.java

Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixProvider.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixProvider.java?rev=264078&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixProvider.java (added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixProvider.java Sun Aug 28 22:35:48 2005
@@ -0,0 +1,102 @@
+/*
+ *   Copyright 2004 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.asn1new.ldap;
+
+
+import org.apache.asn1new.ldap.TwixDecoder;
+import org.apache.ldap.common.message.spi.Provider;
+import org.apache.ldap.common.message.spi.ProviderDecoder;
+import org.apache.ldap.common.message.spi.ProviderEncoder;
+import org.apache.ldap.common.message.spi.ProviderException;
+import org.apache.ldap.common.message.spi.TransformerSpi;
+
+
+/**
+ * The Twix specific BER provider for LDAP.
+ *
+ * @author <a href="mailto:dev@directory.apache.org"> Apache Directory
+ *         Project</a> $Rev: 157671 $
+ */
+public class TwixProvider extends Provider
+{
+	/** The Transformer for this provider */
+    private final TwixTransformer transformer;
+
+    /**
+     * Creates an instance of a Twix based LDAP BER Provider.
+     */
+    private TwixProvider()
+    {
+        super( "Twix LDAP BER Provider", "Apache Directory Project" );
+        transformer = new TwixTransformer( this );
+    }
+
+    /** the singleton TwixProvider instance */
+	private static TwixProvider singleton ;
+
+    /**
+     * Gets a handle on the singleton TwixProvider.  Only one instance should
+     * have to be instantiated for the entire jvm.
+     *
+     * @return the singleton SnaccProvider instance
+     */
+    public synchronized static Provider getProvider()
+    {
+        if ( singleton == null )
+        {
+            singleton = new TwixProvider() ;
+        }
+
+        return singleton ;
+    }
+
+    /**
+     * Gets the encoder associated with this provider.
+     *
+     * @return the provider's encoder.
+     * @throws org.apache.ldap.common.message.spi.ProviderException
+     *          if the provider or its encoder cannot be found
+     */
+    public ProviderEncoder getEncoder() throws ProviderException
+    {
+        return new TwixEncoder( this );
+    }
+
+    /**
+     * Gets the decoder associated with this provider.
+     *
+     * @return the provider's decoder.
+     * @throws org.apache.ldap.common.message.spi.ProviderException
+     *          if the provider or its decoder cannot be found
+     */
+    public ProviderDecoder getDecoder() throws ProviderException
+    {
+        return new TwixDecoder( this );
+    }
+
+    /**
+     * Gets the transformer associated with this provider.
+     *
+     * @return the provider's transformer.
+     * @throws org.apache.ldap.common.message.spi.ProviderException
+     *          if the provider or its transformer cannot be found
+     */
+    public TransformerSpi getTransformer() throws ProviderException
+    {
+        return transformer;
+    }
+}