You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/09/26 20:32:09 UTC
svn commit: r1001489 - in
/directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi:
JndiUtils.java UniversalContextFactory.java
Author: seelmann
Date: Sun Sep 26 18:32:09 2010
New Revision: 1001489
URL: http://svn.apache.org/viewvc?rev=1001489&view=rev
Log:
Fixed checkstyle errors and formatting
Modified:
directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java
directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
Modified: directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java?rev=1001489&r1=1001488&r2=1001489&view=diff
==============================================================================
--- directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java (original)
+++ directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java Sun Sep 26 18:32:09 2010
@@ -78,7 +78,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
import org.apache.directory.shared.ldap.message.LdapResult;
-import org.apache.directory.shared.ldap.message.MessageException;
import org.apache.directory.shared.ldap.message.ResultResponse;
import org.apache.directory.shared.ldap.message.control.Control;
import org.apache.directory.shared.ldap.name.DN;
@@ -89,9 +88,22 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class JndiUtils
-
+public final class JndiUtils
{
+ /**
+ * Private constructor for utility class.
+ */
+ private JndiUtils()
+ {
+ }
+
+
+ /**
+ * Converts Apache Directory control the to an JNDI control.
+ *
+ * @param control the Apache Directory control
+ * @return the JNDI control
+ */
public static javax.naming.ldap.Control toJndiControl( Control control )
{
byte[] value = control.getValue();
@@ -101,6 +113,12 @@ public class JndiUtils
}
+ /**
+ * Converts the Apache Directory controls to JNDI controls.
+ *
+ * @param controls the Apache Directory controls
+ * @return the JNDI controls
+ */
public static javax.naming.ldap.Control[] toJndiControls( Control... controls )
{
if ( controls != null )
@@ -122,6 +140,12 @@ public class JndiUtils
}
+ /**
+ * Converts the JNDI control to an Apache Directory control.
+ *
+ * @param jndiControl the JNDI control
+ * @return the Apache Directory control
+ */
public static Control fromJndiControl( javax.naming.ldap.Control jndiControl )
{
Control control = new ControlImpl( jndiControl.getID() );
@@ -132,6 +156,12 @@ public class JndiUtils
}
+ /**
+ * Converts the JNDI controls to Apache Directory controls.
+ *
+ * @param jndiControls the JNDI controls
+ * @return the Apache Directory controls
+ */
public static Control[] fromJndiControls( javax.naming.ldap.Control... jndiControls )
{
if ( jndiControls != null )
@@ -154,22 +184,32 @@ public class JndiUtils
/**
- * TODO toJndiExtendedResponse. This is NOT correct ATM
+ * Converts an Apache Directory extended request to an JNDI extended request.
+ * TODO: This is NOT correct ATM
*
- * @param request
- * @return
+ * @param request the Apache Directory extended request
+ * @return the JDNI extended response
*/
public static ExtendedResponse toJndiExtendedResponse(
final org.apache.directory.shared.ldap.message.ExtendedRequest request )
{
class JndiExtendedResponse implements ExtendedResponse
{
+ private static final long serialVersionUID = 2535213952391003045L;
+
+
+ /**
+ * {@inheritDoc}
+ */
public byte[] getEncodedValue()
{
return request.getRequestValue();
}
+ /**
+ * {@inheritDoc}
+ */
public String getID()
{
return request.getRequestName();
@@ -181,16 +221,22 @@ public class JndiUtils
/**
- * Transform a JNDI extended request to an internal ExtendedRequest
+ * Transform a JNDI extended request to an Apache Directory extended request
*
- * @param request The JNDI extendedRequest
- * @return An internal ExtendedRequest
+ * @param request The JNDI extended request
+ * @return An Apache Directory extended request
*/
public static ExtendedRequest toJndiExtendedRequest(
final org.apache.directory.shared.ldap.message.ExtendedRequest request )
{
class JndiExtendedRequest implements ExtendedRequest
{
+ private static final long serialVersionUID = 2887613172871934108L;
+
+
+ /**
+ * {@inheritDoc}
+ */
public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
throws NamingException
{
@@ -198,12 +244,18 @@ public class JndiUtils
}
+ /**
+ * {@inheritDoc}
+ */
public byte[] getEncodedValue()
{
return request.getRequestValue();
}
+ /**
+ * {@inheritDoc}
+ */
public String getID()
{
return request.getRequestName();
@@ -275,7 +327,7 @@ public class JndiUtils
/**
* {@inheritDoc}
*/
- public void addAllControls( Control[] controls ) throws MessageException
+ public void addAllControls( Control[] controls )
{
}
@@ -283,7 +335,7 @@ public class JndiUtils
/**
* {@inheritDoc}
*/
- public void addControl( Control control ) throws MessageException
+ public void addControl( Control control )
{
}
@@ -363,7 +415,7 @@ public class JndiUtils
/**
* {@inheritDoc}
*/
- public void removeControl( Control control ) throws MessageException
+ public void removeControl( Control control )
{
}
@@ -473,7 +525,7 @@ public class JndiUtils
/**
* {@inheritDoc}
*/
- public void addAllControls( Control[] controls ) throws MessageException
+ public void addAllControls( Control[] controls )
{
}
@@ -481,7 +533,7 @@ public class JndiUtils
/**
* {@inheritDoc}
*/
- public void addControl( Control control ) throws MessageException
+ public void addControl( Control control )
{
}
@@ -561,7 +613,7 @@ public class JndiUtils
/**
* {@inheritDoc}
*/
- public void removeControl( Control control ) throws MessageException
+ public void removeControl( Control control )
{
}
@@ -751,11 +803,19 @@ public class JndiUtils
// a ReferralException around the LdapReferralException to be used in tests
class WrappedReferralException extends ReferralException
{
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
+ /** The wrapped referral exception. */
private LdapReferralException lre;
+ /**
+ * Creates a new instance of WrappedReferralException.
+ *
+ * @param lre the wrapped referral exception
+ */
public WrappedReferralException( LdapReferralException lre )
{
this.lre = lre;
@@ -821,11 +881,19 @@ class WrappedReferralException extends R
// a PartialResultException around the LdapPartialResultException to be used in tests
class WrappedPartialResultException extends PartialResultException
{
+
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
+ /** The wrapped partial result exception. */
private LdapPartialResultException lpre;
+ /**
+ * Instantiates a new wrapped partial result exception.
+ *
+ * @param lpre the wrapped partial result exception
+ */
public WrappedPartialResultException( LdapPartialResultException lpre )
{
this.lpre = lpre;
Modified: directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java?rev=1001489&r1=1001488&r2=1001489&view=diff
==============================================================================
--- directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java (original)
+++ directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java Sun Sep 26 18:32:09 2010
@@ -35,22 +35,31 @@ import javax.naming.spi.InitialContextFa
*/
public class UniversalContextFactory implements InitialContextFactory
{
+
+ /** The Constant SUN_ICF_FQCN. */
private static final String SUN_ICF_FQCN = "com.sun.jndi.ldap.LdapCtxFactory";
+
+ /** The Constant IBM_ICF_FQCN. */
private static final String IBM_ICF_FQCN = "com.ibm.jndi.LDAPCtxFactory";
- private static final String BEA_ICF_FQCN = SUN_ICF_FQCN; // BEA JRocket might use SUN classes
- private static final String ORACLE_FQCN = BEA_ICF_FQCN; // Oracle JRocket is the former BEA JRockit
- private static final String ICF_FQCN;
+ /** The Constant BEA_ICF_FQCN. */
+ private static final String BEA_ICF_FQCN = SUN_ICF_FQCN; // BEA JRocket might use SUN classes
+ /** The Constant ORACLE_FQCN. */
+ private static final String ORACLE_FQCN = BEA_ICF_FQCN; // Oracle JRocket is the former BEA JRockit
+
+ /** The Constant ICF_FQCN. */
+ private static final String ICF_FQCN;
+
static
{
// -------------------------------------------------------------------
// for lack of a better approach we're just checking the JVM here and
// setting the ICF_FQCN based on that using a bunch of conditional tests
// -------------------------------------------------------------------
-
+
String jvmVendor = System.getProperty( "java.vm.vendor" );
-
+
if ( jvmVendor.equalsIgnoreCase( "SUN Microsystems, Inc." ) )
{
ICF_FQCN = SUN_ICF_FQCN;
@@ -72,17 +81,30 @@ public class UniversalContextFactory imp
ICF_FQCN = "Unknown";
}
}
-
-
+
+ /** The initial context factory. */
private final InitialContextFactory factory;
-
-
+
+
+ /**
+ * Instantiates a new universal context factory.
+ *
+ * @throws InstantiationException if this Class represents an abstract class, an interface,
+ * an array class, a primitive type, or void; or if the class has no nullary constructor;
+ * or if the instantiation fails for some other reason.
+ * @throws IllegalAccessException if the class or its nullary constructor is not accessible
+ * @throws ClassNotFoundException if the class cannot be located
+ */
public UniversalContextFactory() throws InstantiationException, IllegalAccessException, ClassNotFoundException
{
factory = ( InitialContextFactory ) Class.forName( ICF_FQCN ).newInstance();
}
+
+
-
+ /**
+ * {@inheritDoc}
+ */
public Context getInitialContext( Hashtable<?, ?> env ) throws NamingException
{
return factory.getInitialContext( env );