Author: seelmann
Date: Sun Sep 26 21:12:20 2010
New Revision: 1001516
URL: http://svn.apache.org/viewvc?rev=1001516&view=rev
Log:
Fixed checkstyle errors and formatting
Modified:
directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/UniqueResourceException.java
directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SingleLdifSchemaLoader.java
directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/UniqueResourceException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/UniqueResourceException.java?rev=1001516&r1=1001515&r2=1001516&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/UniqueResourceException.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/UniqueResourceException.java
Sun Sep 26 21:12:20 2010
@@ -34,19 +34,39 @@ import java.util.List;
*/
public class UniqueResourceException extends RuntimeException
{
+
+ /** The serialVersionUID. */
private static final long serialVersionUID = 1L;
+ /** The resource name. */
private final String resourceName;
+
+ /** The urls. */
private final List<URL> urls;
+
+ /** The resource description. */
private final String resourceDescription;
-
+
+ /**
+ * Instantiates a new unique resource exception.
+ *
+ * @param resourceName the resource name
+ * @param resourceDescription the resource description
+ */
public UniqueResourceException( String resourceName, String resourceDescription )
{
this( resourceName, null, resourceDescription );
}
-
+
+ /**
+ * Instantiates a new unique resource exception.
+ *
+ * @param resourceName the resource name
+ * @param urls the URLs
+ * @param resourceDescription the resource description
+ */
public UniqueResourceException( String resourceName, List<URL> urls, String resourceDescription
)
{
this.resourceName = resourceName;
@@ -54,32 +74,44 @@ public class UniqueResourceException ext
this.resourceDescription = resourceDescription;
}
-
+
+ /**
+ * Instantiates a new unique resource exception.
+ *
+ * @param resourceName the resource name
+ * @param first the first
+ * @param urlEnum the enum with URLs
+ * @param resourceDescription the resource description
+ */
public UniqueResourceException( String resourceName, URL first, Enumeration<URL>
urlEnum, String resourceDescription )
{
this( resourceName, toList( first, urlEnum ), resourceDescription );
}
-
+
private static List<URL> toList( URL first, Enumeration<URL> urlEnum )
{
ArrayList<URL> urls = new ArrayList<URL>();
urls.add( first );
- while( urlEnum.hasMoreElements() )
+ while ( urlEnum.hasMoreElements() )
{
urls.add( urlEnum.nextElement() );
}
return urls;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public String getMessage()
{
StringBuffer buf = new StringBuffer( "Problem locating " ).append( resourceDescription
).append( "\n" );
if ( urls == null )
{
buf.append( "No resources named '" ).append( resourceName ).append( "' located
on classpath" );
- } else
+ }
+ else
{
buf.append( "Multiple copies of resource named '" ).append( resourceName ).append(
"' located on classpath at urls" );
@@ -92,12 +124,22 @@ public class UniqueResourceException ext
}
+ /**
+ * Gets the resource name.
+ *
+ * @return the resource name
+ */
public String getResourceName()
{
return resourceName;
}
-
+
+ /**
+ * Gets the URLs.
+ *
+ * @return the URLs
+ */
public List<URL> getUrls()
{
return Collections.unmodifiableList( urls );
Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java?rev=1001516&r1=1001515&r2=1001516&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
Sun Sep 26 21:12:20 2010
@@ -54,19 +54,29 @@ import org.slf4j.LoggerFactory;
*/
public class DefaultSchemaLdifExtractor implements SchemaLdifExtractor
{
+
+ /** The base path. */
private static final String BASE_PATH = "";
+ /** The schema sub-directory. */
private static final String SCHEMA_SUBDIR = "schema";
+ /** The logger. */
private static final Logger LOG = LoggerFactory.getLogger( DefaultSchemaLdifExtractor.class
);
- // java.util.regex.Pattern is immutable so only one instance is needed for all uses.
+ /**
+ * The pattern to extract the schema from LDIF files.
+ * java.util.regex.Pattern is immutable so only one instance is needed for all uses.
+ */
private static final Pattern EXTRACT_PATTERN = Pattern.compile( ".*schema" + "[/\\Q\\\\E]"
+ "ou=schema.*\\.ldif" );
+ /** The extracted flag. */
private boolean extracted;
+ /** The output directory. */
private File outputDirectory;
+ /** The schema directory. */
private File schemaDirectory;
Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java?rev=1001516&r1=1001515&r2=1001516&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
Sun Sep 26 21:12:20 2010
@@ -35,32 +35,47 @@ import org.apache.directory.shared.ldap.
*/
public class AttributeClassLoader extends ClassLoader
{
+
+ /** The attribute. */
private EntryAttribute attribute;
-
+
+ /**
+ * Instantiates a new attribute class loader.
+ */
public AttributeClassLoader()
{
super( AttributeClassLoader.class.getClassLoader() );
}
-
-
+
+
+ /**
+ * Sets the attribute.
+ *
+ * @param attribute the new attribute
+ * @throws LdapException if the attribute is not binary.
+ */
public void setAttribute( EntryAttribute attribute ) throws LdapException
{
if ( attribute.isHR() )
{
- throw new LdapInvalidAttributeValueException( ResultCodeEnum.CONSTRAINT_VIOLATION,
I18n.err( I18n.ERR_10001 ) );
+ throw new LdapInvalidAttributeValueException( ResultCodeEnum.CONSTRAINT_VIOLATION,
+ I18n.err( I18n.ERR_10001 ) );
}
-
+
this.attribute = attribute;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public Class<?> findClass( String name ) throws ClassNotFoundException
{
byte[] classBytes = null;
-
+
Value<?> value = attribute.get();
-
+
if ( value.isBinary() )
{
classBytes = value.getBytes();
Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java?rev=1001516&r1=1001515&r2=1001516&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
Sun Sep 26 21:12:20 2010
@@ -53,7 +53,10 @@ import org.slf4j.LoggerFactory;
*/
public class JarLdifSchemaLoader extends AbstractSchemaLoader
{
- // java.util.regex.Pattern is immutable so only one instance is needed for all uses.
+ /**
+ * Filesystem path separator pattern, either forward slash or backslash.
+ * java.util.regex.Pattern is immutable so only one instance is needed for all uses.
+ */
private static final String SEPARATOR_PATTERN = "[/\\Q\\\\E]";
/** ldif file extension used */
Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java?rev=1001516&r1=1001515&r2=1001516&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
Sun Sep 26 21:12:20 2010
@@ -73,7 +73,10 @@ public class SchemaEntityFactory impleme
/** Slf4j logger */
private static final Logger LOG = LoggerFactory.getLogger( SchemaEntityFactory.class
);
+ /** The empty string list. */
private static final List<String> EMPTY_LIST = new ArrayList<String>();
+
+ /** The empty string array. */
private static final String[] EMPTY_ARRAY = new String[]
{};
@@ -81,7 +84,10 @@ public class SchemaEntityFactory impleme
private final AttributeClassLoader classLoader;
- public SchemaEntityFactory() throws Exception
+ /**
+ * Instantiates a new schema entity factory.
+ */
+ public SchemaEntityFactory()
{
this.classLoader = new AttributeClassLoader();
}
Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SingleLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SingleLdifSchemaLoader.java?rev=1001516&r1=1001515&r2=1001516&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SingleLdifSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SingleLdifSchemaLoader.java
Sun Sep 26 21:12:20 2010
@@ -49,19 +49,28 @@ import org.slf4j.LoggerFactory;
*/
public class SingleLdifSchemaLoader extends AbstractSchemaLoader
{
- // java.util.regex.Pattern is immutable so only one instance is needed for all uses.
+ /**
+ * Pattern for start of schema DN.
+ * java.util.regex.Pattern is immutable so only one instance is needed for all uses.
+ */
private static final Pattern SCHEMA_START_PATTERN = Pattern
.compile( "cn\\s*=\\s*[a-z0-9-_]*\\s*,\\s*ou\\s*=\\s*schema" );
+ /** The logger. */
private static final Logger LOG = LoggerFactory.getLogger( SingleLdifSchemaLoader.class
);
+ /** The schema object RDN attribute types. */
private String[] schemaObjectTypeRdns = new String[]
{ "attributetypes", "comparators", "ditContentRules", "ditStructureRules", "matchingRules",
"matchingRuleUse",
"nameForms", "normalizers", "objectClasses", "syntaxes", "syntaxCheckers" };
+ /** The map containing ... */
private Map<String, Map<String, List<Entry>>> scObjEntryMap = new HashMap<String,
Map<String, List<Entry>>>();
+ /**
+ * Instantiates a new single LDIF schema loader.
+ */
public SingleLdifSchemaLoader()
{
try
@@ -261,25 +270,14 @@ public class SingleLdifSchemaLoader exte
return loadSchemaObjects( "syntaxCheckers", schemas );
}
-
- // a simple manual test method
- public static void main( String[] args ) throws Exception
- {
- SingleLdifSchemaLoader loader = new SingleLdifSchemaLoader();
-
- Schema schema = loader.getSchema( "inetorgperson" );
-
- System.out.println( schema );
-
- List<Entry> attrList = loader.loadAttributeTypes( schema );
- assert ( 9 == attrList.size() );
- }
-
}
class SchemaMarker
{
+ /** The start marker. */
private int start;
+
+ /** The end marker. */
private int end;
Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java?rev=1001516&r1=1001515&r2=1001516&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java
Sun Sep 26 21:12:20 2010
@@ -120,8 +120,10 @@ public class DefaultSchemaManager implem
/** A flag indicating that the SchemaManager is relaxed or not */
private boolean isRelaxed = STRICT;
- /** Two flags for RELAXED and STRICT */
+ /** Two flags for RELAXED and STRICT, this is STRICT */
public static final boolean STRICT = false;
+
+ /** Two flags for RELAXED and STRICT, this is RELAXED */
public static final boolean RELAXED = true;
@@ -130,7 +132,7 @@ public class DefaultSchemaManager implem
*
* @param loader The schema loader to use
*/
- public DefaultSchemaManager( SchemaLoader loader ) throws Exception
+ public DefaultSchemaManager( SchemaLoader loader )
{
// Default to the the root (one schemaManager for all the entries
namingContext = DN.EMPTY_DN;
@@ -149,7 +151,7 @@ public class DefaultSchemaManager implem
* @param loader The schema loader to use
* @param namingContext The associated NamingContext
*/
- public DefaultSchemaManager( SchemaLoader loader, DN namingContext ) throws Exception
+ public DefaultSchemaManager( SchemaLoader loader, DN namingContext )
{
this.namingContext = namingContext;
this.schemaLoader = loader;
|