Coverage report

  %line %branch
org.apache.jetspeed.security.spi.impl.ldap.InitLdapSchema
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.jetspeed.security.spi.impl.ldap;
 18  
 
 19  
 import javax.naming.NamingException;
 20  
 import javax.naming.directory.Attributes;
 21  
 import javax.naming.directory.BasicAttribute;
 22  
 import javax.naming.directory.BasicAttributes;
 23  
 
 24  
 import org.apache.commons.lang.StringUtils;
 25  
 import org.apache.jetspeed.security.SecurityException;
 26  
 
 27  
 public class InitLdapSchema extends AbstractLdapDao
 28  
 {
 29  
 
 30  
     /**
 31  
      * <p>
 32  
      * Default constructor.
 33  
      * </p>
 34  
      * 
 35  
      * @throws SecurityException A {@link SecurityException}.
 36  
      */
 37  
     public InitLdapSchema() throws SecurityException
 38  
     {
 39  0
         super();
 40  0
     }
 41  
 
 42  
     /**
 43  
      * <p>
 44  
      * Initializes the LDAP schema.
 45  
      * </p>
 46  
      * 
 47  
      * @param ldapConfig Holds the ldap binding configuration.
 48  
      * @throws SecurityException A {@link SecurityException}.
 49  
      */
 50  
     public InitLdapSchema(LdapBindingConfig ldapConfig) throws SecurityException
 51  
     {
 52  0
         super(ldapConfig);
 53  0
     }
 54  
 
 55  
     /**
 56  
      * @see org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao#getObjectClass()
 57  
      */
 58  
     protected String getObjectClass()
 59  
     {
 60  
         // Implementation not required for initializing the ldap schema.
 61  0
         return null;
 62  
     }
 63  
 
 64  
     /**
 65  
      * <p>
 66  
      * Inits a given ou.
 67  
      * </p>
 68  
      * 
 69  
      * @param ou The org unit.
 70  
      * @throws SecurityException
 71  
      */
 72  
     public void initOu(String ou) throws NamingException
 73  
     {
 74  0
         if (!StringUtils.isEmpty(ou))
 75  
         {
 76  0
             Attributes attrs = defineLdapAttributes(ou);
 77  0
             String dn = "ou=" + ou; // + "," + getDefaultSearchBase();
 78  0
             ctx.createSubcontext(dn, attrs);
 79  
         }
 80  0
     }
 81  
     
 82  
     public void initOu(String ou,String folder) throws NamingException
 83  
     {
 84  0
         if (!StringUtils.isEmpty(ou))
 85  
         {
 86  0
             Attributes attrs = defineLdapAttributes(ou);
 87  0
             ctx.createSubcontext("ou=" + ou + "," + folder, attrs);
 88  
         }
 89  0
     }    
 90  
 
 91  
     /**
 92  
      * <p>
 93  
      * A template method for defining the attributes for a particular LDAP class.
 94  
      * </p>
 95  
      * 
 96  
      * @param principalUid The principal uid.
 97  
      * @return the LDAP attributes object for the particular class.
 98  
      */
 99  
     protected Attributes defineLdapAttributes(String ou)
 100  
     {
 101  0
         Attributes attrs = new BasicAttributes(true);
 102  0
         BasicAttribute classes = new BasicAttribute("objectclass");
 103  
 
 104  0
         classes.add("top");
 105  0
         classes.add("organizationalUnit");
 106  0
         attrs.put(classes);
 107  0
         attrs.put("ou", ou);
 108  
 
 109  0
         return attrs;
 110  
     }
 111  
 
 112  
 	protected String getEntryPrefix()
 113  
 	{
 114  0
 		return null;
 115  
 	}
 116  
 	
 117  
 	protected String getSearchSuffix() {
 118  0
 		return null;
 119  
 	}
 120  
 
 121  
 	protected String getSearchDomain() {
 122  0
 		return null;
 123  
 	}
 124  
 
 125  
 	protected String[] getObjectClasses() {
 126  0
 		return null;
 127  
 	}
 128  
 
 129  
     protected String[] getAttributes() {
 130  0
         return null;
 131  
     }
 132  
 
 133  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.