Coverage Report - com.btmatthews.maven.plugins.ldap.mojos.DSMLDumperMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
DSMLDumperMojo
100%
7/7
N/A
1
 
 1  
 /*
 2  
  * Copyright 2008 Brian Thomas Matthews
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package com.btmatthews.maven.plugins.ldap.mojos;
 18  
 
 19  
 import java.io.PrintWriter;
 20  
 
 21  
 import netscape.ldap.util.DSMLWriter;
 22  
 import netscape.ldap.util.LDAPWriter;
 23  
 
 24  
 /**
 25  
  * This Mojo implements the dsml-dump goal which dumps content from the LDAP
 26  
  * directory server in DSML format.
 27  
  * 
 28  
  * @author <a href="mailto:brian.matthews@btmatthews.com">Brian Matthews</a>
 29  
  * @version 1.0
 30  
  * @goal dsml-dump
 31  
  */
 32  
 public final class DSMLDumperMojo
 33  
     extends AbstractLDAPDumperMojo
 34  
 {
 35  
     /**
 36  
      * The default constructor.
 37  
      */
 38  
     public DSMLDumperMojo()
 39  1
     {
 40  1
     }
 41  
 
 42  
     /**
 43  
      * Create the LDAP writer that will dump LDAP entries in DSML format.
 44  
      * 
 45  
      * @param writer
 46  
      *            The writer for the target output stream.
 47  
      * @return The LDAP writer.
 48  
      */
 49  
     protected LDAPWriter openLDAPWriter(final PrintWriter writer)
 50  
     {
 51  1
         writer.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
 52  1
         writer.print("<dsml:dsml xmlns:dsml=\"http://www.dsml.org/DSML\">\n");
 53  1
         return new DSMLWriter(writer);
 54  
     }
 55  
     
 56  
     /**
 57  
      * Close the LDAP wrtier that was returned by openLDAPWriter.
 58  
      * 
 59  
      * @param writer
 60  
      *            The writer for the target output stream.
 61  
      * @param ldapWriter
 62  
      *            The LDAP writer.
 63  
      */
 64  
     protected void closeLDAPWriter(final PrintWriter writer, final LDAPWriter ldapWriter)
 65  
     {        
 66  1
         writer.print("</dsml:dsml>\n");
 67  1
     }
 68  
 }