avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate AbstractHelper.java MetaGenerateQdoxTask.java MxinfoFactory.java MxinfoHelper.java NamedXmlSnippet.java XinfoFactory.java XinfoHelper.java
Date Tue, 01 Oct 2002 06:45:12 GMT
hammant     2002/09/30 23:45:12

  Added:       src/java/org/apache/avalon/phoenix/tools/metagenerate
                        AbstractHelper.java MetaGenerateQdoxTask.java
                        MxinfoFactory.java MxinfoHelper.java
                        NamedXmlSnippet.java XinfoFactory.java
                        XinfoHelper.java
  Log:
  Move to Tools dir
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate/AbstractHelper.java
  
  Index: AbstractHelper.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.metagenerate;
  
  /**
   * Abstract Helper
   * @author Paul Hammant
   */
  public abstract class AbstractHelper
  {
      /**
       * Replace a test with another in a string
       * @param source The string to be changed.
       * @param term The term to replace.
       * @param replacement To replace with.
       * @return The resulting string.
       */
      protected String replaceString(final String source, String term, String replacement)
      {
          String retval = source;
          int ix = retval.indexOf(term);
          if (ix != -1)
          {
              retval =
                      retval.substring(0, ix)
                      + replacement
                      + retval.substring(ix + term.length(), retval.length());
          }
          return retval;
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate/MetaGenerateQdoxTask.java
  
  Index: MetaGenerateQdoxTask.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.metagenerate;
  
  import com.thoughtworks.qdox.model.JavaClass;
  import com.thoughtworks.qdox.model.DocletTag;
  import com.thoughtworks.qdox.ant.AbstractQdoxTask;
  import org.apache.tools.ant.BuildException;
  
  import java.io.File;
  import java.io.IOException;
  
  /**
   * MetaInfo Generation Ant Taskdef
    * @author Paul Hammant
   */
  public class MetaGenerateQdoxTask extends AbstractQdoxTask
  {
  
      private File m_destDir;
  
      /**
       * Execute
       */
      public void execute()
      {
          super.execute();
          try
          {
              m_destDir.mkdirs();
              outputClasses();
          }
          catch (IOException e)
          {
              e.printStackTrace();
              throw new BuildException("IOException " + e.getMessage());
          }
      }
  
      /**
       * Set the desitation
       * @param destinationDir The destination directory
       */
      public void setDest(File destinationDir)
      {
          m_destDir = destinationDir;
      }
  
      /**
       * Output the classes
       * @throws IOException If a problem writing output
       */
      protected void outputClasses() throws IOException
      {
  
          for (int i = 0; i < allClasses.size(); i++)
          {
              JavaClass javaClass = (JavaClass) allClasses.get(i);
              DocletTag block = javaClass.getTagByName("phoenix:block");
              if (block != null)
              {
                  XinfoFactory factory = new XinfoFactory(m_destDir, javaClass);
                  factory.generate();
              }
              DocletTag topic = javaClass.getTagByName("phoenix:mx-topic");
              if (topic != null)
              {
                  MxinfoFactory factory = new MxinfoFactory(m_destDir, javaClass);
                  factory.generate();
              }
          }
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate/MxinfoFactory.java
  
  Index: MxinfoFactory.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.metagenerate;
  
  import com.thoughtworks.qdox.model.JavaClass;
  import com.thoughtworks.qdox.model.JavaMethod;
  import com.thoughtworks.qdox.model.DocletTag;
  import com.thoughtworks.qdox.model.Type;
  import com.thoughtworks.qdox.model.JavaParameter;
  
  import java.io.IOException;
  import java.io.File;
  import java.util.ArrayList;
  
  /**
   * A Mxinfo Factory
   * @author Paul Hammant
   */
  public class MxinfoFactory
  {
  
      private JavaClass m_javaClass;
      private File m_destDir;
      private ArrayList m_attributes = new ArrayList();
      private ArrayList m_operations = new ArrayList();
      private MxinfoHelper m_mxinfo;
  
      /**
       * Construct a factory for a class.
       * @param destDir
       * @param javaClass
       */
      public MxinfoFactory(File destDir, JavaClass javaClass)
      {
          m_javaClass = javaClass;
          m_destDir = destDir;
      }
  
      /**
       * Generate the m_mxinfo file
       * @throws IOException If a problem writing output
       */
      public void generate() throws IOException
      {
          File file = new File(m_destDir,
                  m_javaClass.getFullyQualifiedName().replace('.', File.separatorChar) + ".mxinfo");
          file.getParentFile().mkdirs();
          m_mxinfo = new MxinfoHelper(file);
          m_mxinfo.writeHeader(
                  m_javaClass.getTagByName("phoenix:mx-topic").getNamedParameter("name"));
          // m_attributes
          JavaMethod[] methods = m_javaClass.getMethods();
          for (int j = 0; j < methods.length; j++)
          {
              makeAttribute(methods[j], m_mxinfo);
          }
          writeAttributes();
          m_mxinfo.writeOperationsHeader();
          // operations
          methods = m_javaClass.getMethods();
          for (int j = 0; j < methods.length; j++)
          {
              makeOperation(methods[j], m_mxinfo);
          }
          writeOperations();
          m_mxinfo.writeFooter();
          m_mxinfo.close();
      }
  
      private void writeOperations() throws IOException
      {
          m_mxinfo.writeOperations(m_operations);
      }
  
      private void makeAttribute(JavaMethod method, MxinfoHelper mxinfo) throws IOException
      {
  
          DocletTag attribute = method.getTagByName("phoenix:mx-attribute");
          if (attribute != null)
          {
              String attributeName = getName(method.getName());
              DocletTag tag = method.getTagByName("phoenix:mx-description");
              String comment;
              if (tag == null)
              {
                  comment = method.getComment();
              }
              else
              {
                  comment = tag.getValue();
              }
              Type attributeType = method.getReturns();
              String attributeTypeString =
                      attributeType.getValue() + (attributeType.isArray() ? "[]" : "");
  
              NamedXmlSnippet attr = mxinfo.makeAttrLines(attributeName,
                      "\"" + comment + "\"",
                      attributeTypeString);
              m_attributes.add(attr);
          }
      }
  
      private void writeAttributes() throws IOException
      {
          m_mxinfo.writeAttributes(m_attributes);
      }
  
      private String makeOperation(JavaMethod method, MxinfoHelper mxinfo) throws IOException
      {
          String xml = "";
          DocletTag attribute = method.getTagByName("phoenix:mx-operation");
          if (attribute != null)
          {
              String operationName = method.getName();
              String description = method.getComment();
              Type type = method.getReturns();
  
              String typeString = type.getValue() + (type.isArray() ? "[]" : "");
  
              xml = xml + mxinfo.makeOperationHeader(operationName, description, typeString);
              JavaParameter[] params = method.getParameters();
              for (int i = 0; i < params.length; i++)
              {
                  xml = xml + makeOperationParameter(params[i], method, mxinfo);
  
              }
              xml = xml + mxinfo.makeOperationFooter();
              NamedXmlSnippet operation = new NamedXmlSnippet(operationName,xml);
              m_operations.add(operation);
          }
          return xml;
      }
  
      private String makeOperationParameter(JavaParameter param, JavaMethod method,
                                           MxinfoHelper mxinfo) throws IOException
      {
          String paramName = param.getName();
          DocletTag[] paramTags = method.getTagsByName("param");
          String paramDescription = "";
          for (int k = 0; k < paramTags.length; k++)
          {
              String paramTagValue = paramTags[k].getValue().trim();
              if (paramTagValue.startsWith(paramName))
              {
                  paramDescription = paramTagValue.substring(
                          paramTagValue.indexOf(" ") + 1, paramTagValue.length());
              }
          }
          Type paramType = param.getType();
          String paramTypeString = paramType.getValue() + (paramType.isArray() ? "[]" : "");
          return mxinfo.makeOperationParameter(paramName, paramDescription, paramTypeString);
      }
  
      private String getName(final String name)
      {
          String retval = name;
          if (retval.startsWith("set") || retval.startsWith("get"))
          {
              retval = retval.substring(3, retval.length());
              retval = retval.substring(0, 1).toLowerCase() + retval.substring(1, retval.length());
          }
          else if (retval.startsWith("is"))
          {
              retval = retval.substring(2, retval.length());
              retval = retval.substring(0, 1).toLowerCase() + retval.substring(1, retval.length());
          }
          return retval;
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate/MxinfoHelper.java
  
  Index: MxinfoHelper.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.metagenerate;
  
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.File;
  import java.util.Collections;
  import java.util.Iterator;
  import java.util.List;
  
  /**
   * A Xinfo Helper.
   * @author Paul Hammant
   */
  public class MxinfoHelper extends AbstractHelper
  {
  
      private FileWriter m_output;
  
      private static final String HEADER[] = new String[]{
          "<?xml version=\"1.0\"?>",
          "<!DOCTYPE mxinfo PUBLIC \"-//PHOENIX/Mx Info DTD Version 1.0//EN\"",
          "                  \"http://jakarta.apache.org/avalon/dtds/phoenix/mxinfo_1_0.dtd\">",
          "",
          "<mxinfo>",
          ""};
  
      private static final String TOPIC[] = new String[]{
          "    <topic name=\"@TOPIC@\" >"};
  
      private static final String ATTR_HEADER[] = new String[]{
          "",
          "      <!-- attributes -->"};
  
      private static final String ATTRIBUTE[] = new String[]{
          "      <attribute",
          "        name=\"@NAME@\"",
          "        description=\"@DESCRIPTION@\"",
          "        type=\"@RETURN@\"",
          "      />"};
  
      private static final String OPERATIONS_HEADER[] = new String[]{
          "",
          "      <!-- operations -->",
          "" };
  
      private static final String OPERATION_HEADER[] = new String[]{
          "      <operation",
          "        name=\"@NAME@\"",
          "        description=\"@DESCRIPTION@\"",
          "        type=\"@RETURN@\">" };
  
      private static final String PARAMETER[] = new String[]{
          "        <param",
          "           name=\"@NAME@\"",
          "           description=\"@DESCRIPTION@\"",
          "           type=\"@TYPE@\"",
          "        />" };
  
      private static final String OPERATION_FOOTER[] = new String[]{
          "      </operation>" };
  
      private static final String FOOTER[] = new String[]{
          "",
          "    </topic>",
          "",
          "</mxinfo>"};
  
      /**
       * Construct
       * @param file The File to create
       * @throws IOException If a problem writing output
       */
      public MxinfoHelper(File file) throws IOException
      {
          m_output = new FileWriter(file);
      }
  
      /**
       * Write the header
       * @param topic The topic
       * @throws IOException If a problem writing output
       */
      public void writeHeader(String topic) throws IOException
      {
          for (int i = 0; i < HEADER.length; i++)
          {
              m_output.write(HEADER[i] + "\n");
          }
  
          for (int i = 0; i < TOPIC.length; i++)
          {
              String line = TOPIC[i];
              line = replaceString(line, "\"@TOPIC@\"", topic);
              m_output.write(line + "\n");
          }
  
          for (int i = 0; i < ATTR_HEADER.length; i++)
          {
              m_output.write(ATTR_HEADER[i] + "\n");
          }
  
      }
  
      /**
       * Write the Attribute Lines
       * @param attrName The attribute name
       * @param description The description
       * @param type The type
       * @throws IOException If a problem writing output
       */
      public NamedXmlSnippet makeAttrLines(String attrName, String description, String type)
              throws IOException
      {
          String xml = "";
          for (int i = 0; i < ATTRIBUTE.length; i++)
          {
              String line = ATTRIBUTE[i];
              line = replaceString(line, "@NAME@", attrName);
              line = replaceString(line, "\"@DESCRIPTION@\"", description);
              line = replaceString(line, "@RETURN@", type);
              xml = xml + line + "\n";
          }
          return new NamedXmlSnippet(attrName, xml);
      }
  
      /**
       * Write attributes.
       * @param attributes A list of attributes
       * @throws IOException If a problem writing output
       */
      public void writeAttributes(List attributes) throws IOException
      {
          Collections.sort(attributes);
          for (Iterator iterator = attributes.iterator(); iterator.hasNext();)
          {
              NamedXmlSnippet attribute = (NamedXmlSnippet) iterator.next();
              m_output.write(attribute.getXml());
          }
      }
  
  
      /**
       * Write the operations headers
       * @throws IOException If a problem writing output
       */
      public void writeOperationsHeader() throws IOException
      {
          for (int i = 0; i < OPERATIONS_HEADER.length; i++)
          {
              m_output.write(OPERATIONS_HEADER[i] + "\n");
          }
      }
  
      /**
       * Write the operation headers
       * @param operName The attribute name
       * @param description The description
       * @param type The type
       * @throws IOException If a problem writing output
       */
      public String makeOperationHeader(String operName, String description, String type)
              throws IOException
      {
          String xml = "";
          for (int i = 0; i < OPERATION_HEADER.length; i++)
          {
              String line = OPERATION_HEADER[i];
              line = replaceString(line, "@NAME@", operName);
              line = replaceString(line, "@DESCRIPTION@", description);
              line = replaceString(line, "@RETURN@", type);
              xml = xml + line + "\n";
          }
          return xml;
      }
  
      /**
       * Write the operation footer
       * @throws IOException If a problem writing output
       */
      public String makeOperationFooter() throws IOException
      {
          String xml = "";
          for (int i = 0; i < OPERATION_FOOTER.length; i++)
          {
              xml = xml + OPERATION_FOOTER[i] + "\n";
          }
          return xml;
      }
  
      /**
       * Make a parameter for an operation
       * @param paramName The attribute name
       * @param description The description
       * @param type The type
       * @throws IOException If a problem writing output
       */
      public String makeOperationParameter(String paramName, String description, String type)
              throws IOException
      {
          String xml = "";
          for (int i = 0; i < PARAMETER.length; i++)
          {
              String line = PARAMETER[i];
              line = replaceString(line, "@NAME@", paramName);
              line = replaceString(line, "@DESCRIPTION@", description);
              line = replaceString(line, "@TYPE@", type);
              xml = xml + line + "\n";
          }
          return xml;
      }
  
      /**
       * Write operations
       * @param operations A list of operations
       * @throws IOException If a problem writing output
       */
      public void writeOperations(List operations) throws IOException
      {
          Collections.sort(operations);
          for (Iterator iterator = operations.iterator(); iterator.hasNext();)
          {
              NamedXmlSnippet operation = (NamedXmlSnippet) iterator.next();
              m_output.write(operation.getXml());
          }
      }
  
  
      /**
       * Write footer
       * @throws IOException If a problem writing output
       */
      public void writeFooter() throws IOException
      {
          for (int i = 0; i < FOOTER.length; i++)
          {
              m_output.write(FOOTER[i] + "\n");
          }
      }
  
      /**
       * Close the file.
       * @throws IOException If a problem writing output
       */
      public void close() throws IOException
      {
          m_output.close();
      }
  
  
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate/NamedXmlSnippet.java
  
  Index: NamedXmlSnippet.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.metagenerate;
  
  /**
   * A named XML snippet
   * @author Paul Hammant
   */
  public class NamedXmlSnippet implements Comparable
  {
      private String m_name;
      private String m_xml;
  
      /**
       * Construct an NamedXmlSnippet
       * @param name The node name
       * @param xml the XML
       */
      public NamedXmlSnippet(String name, String xml)
      {
          this.m_name = name;
          this.m_xml = xml;
      }
  
      /**
       * Get the name
       * @return The Name
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Get the XML
       * @return The XML
       */
      public String getXml()
      {
          return m_xml;
      }
  
      /**
       * From comparable
       * @param object The object to compare to.
       * @return whichever is order precidence
       */
      public int compareTo(Object object)
      {
          NamedXmlSnippet attr = (NamedXmlSnippet) object;
          return m_name.compareTo(attr.getName());
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate/XinfoFactory.java
  
  Index: XinfoFactory.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.metagenerate;
  
  import com.thoughtworks.qdox.model.JavaClass;
  import com.thoughtworks.qdox.model.JavaMethod;
  import com.thoughtworks.qdox.model.DocletTag;
  import com.thoughtworks.qdox.model.Type;
  
  import java.io.IOException;
  import java.io.File;
  
  /**
   * A Xinfo Factory
    * @author Paul Hammant
   */
  public class XinfoFactory
  {
  
      private JavaClass m_javaClass;
      private File m_destDir;
  
      /**
       * Construct a factory for a class.
       * @param destDir
       * @param javaClass
       */
      public XinfoFactory(File destDir, JavaClass javaClass)
      {
          m_javaClass = javaClass;
          m_destDir = destDir;
      }
  
      /**
       * Generate the xinfo file
       * @throws IOException If a problem writing output
       */
      public void generate() throws IOException
      {
          File file = new File(m_destDir,
                  m_javaClass.getFullyQualifiedName().replace('.',File.separatorChar) + ".xinfo");
          file.getParentFile().mkdirs();
          XinfoHelper xinfo = new XinfoHelper(file);
  
          xinfo.writeHeader();
  
          // services
  
          processServiceInterfaces(xinfo);
  
          xinfo.writeEndOfServicesSection();
  
          processManagementInterfaces(xinfo);
  
          xinfo.writeEndOfManagementSection();
  
          processServiceMethod(xinfo);
          xinfo.writeFooter();
          xinfo.close();
  
      }
  
      /**
       * Process the service interfaces
       * @param xinfo the xinfo helper
       * @throws IOException If a problem
       */
      private void processServiceInterfaces(XinfoHelper xinfo) throws IOException
      {
          DocletTag[] services = m_javaClass.getTagsByName("phoenix:service");
          for (int i = 0; i < services.length; i++)
          {
              DocletTag service = services[i];
              xinfo.writeServiceLines(service.getNamedParameter("name"));
          }
      }
  
      /**
       * Process the management interface lines
       * @param xinfo the xinfo helper
       * @throws IOException If a problem
       */
      private void processManagementInterfaces(XinfoHelper xinfo) throws IOException
      {
          DocletTag[] managementInterfaces = m_javaClass.getTagsByName("phoenix:mx");
          for (int i = 0; i < managementInterfaces.length; i++)
          {
              xinfo.writeManagementLine(managementInterfaces[i].getNamedParameter("name"));
          }
      }
  
      /**
       * Process the service method. Cehck for the right signature.
       * @param xinfo The xinfo helper
       * @throws IOException If a problem
       */
      private void processServiceMethod(XinfoHelper xinfo) throws IOException
      {
          JavaMethod[] methods = m_javaClass.getMethods();
          for (int j = 0; j < methods.length; j++)
          {
              // dependencies
  
              JavaMethod method = methods[j];
              if (method.getName().equals("service")
                      && method.getReturns().equals(new Type("void",0))
                      && method.getParameters().length == 1
                      && method.getParameters()[0].getType().getValue().equals(
                              "org.apache.avalon.framework.service.ServiceManager"))
              {
                  DocletTag[] dependencies = method.getTagsByName("phoenix:dependency");
                  for (int i = 0; i < dependencies.length; i++)
                  {
                      DocletTag dependency = dependencies[i];
                      xinfo.writeDependencyLines(dependency.getNamedParameter("name"));
                  }
              }
          }
      }
  
  
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/metagenerate/XinfoHelper.java
  
  Index: XinfoHelper.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.metagenerate;
  
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.File;
  
  /**
   * A Xinfo Helper.
    * @author Paul Hammant
   */
  public class XinfoHelper extends AbstractHelper
  {
  
      private FileWriter m_output;
  
      private static final String[] HEADER = new String[] {
      "<?xml version=\"1.0\"?>",
      "<!DOCTYPE blockinfo PUBLIC \"-//PHOENIX/Block Info DTD Version 1.0//EN\"",
      "                  \"http://jakarta.apache.org/avalon/dtds/phoenix/blockinfo_1_0.dtd\">",
      "",
      "<blockinfo>",
      "",
      "  <!-- section to describe block -->",
      "  <block>",
      "    <version>1.0</version>",
      "  </block>",
      "",
      "  <!-- services that are offered by this block -->",
      "  <services>" };
  
      private static final String[] SERVICE_LINES = new String[] {
      "    <service name=\"@SERVICE-CLASS@\"/>" };
  
      private static final String[] END_OF_SERVICES = new String[] {
      "  </services>",
      "",
      "  <!-- interfaces that may be exported to manange this block -->",
      "  <management-access-points>" };
  
      private static final String[] MANAGEMENT_LINE = new String[] {
      "     <service name=@INTERFACE-NAME@/>" };
  
      private static final String[] END_OF_MGMT = new String[] {
      "  </management-access-points>",
      "",
      "  <!-- services that are required by this block -->",
      "  <dependencies>" };
  
      private static final String[] DEPENDENCY_SECTION = new String[] {
  
      "    <dependency>",
      "      <service name=\"@SERVICE-CLASS@\"/>",
      "    </dependency>" };
  
      private static final String[] FOOTER = new String[] {
      "  </dependencies>",
      "</blockinfo>" };
  
      /**
       * Construct
       * @param file The File to create
       * @throws IOException If a problem writing output
       */
      public XinfoHelper(File file) throws IOException
      {
          m_output = new FileWriter(file);
      }
  
      /**
       * Write the header
       * @throws IOException If a problem writing output
       */
      public void writeHeader() throws IOException
      {
          for (int i = 0; i < HEADER.length; i++)
          {
              m_output.write(HEADER[i] + "\n");
          }
      }
  
      /**
       * Write the Service Lines
       * @param service The service name
       * @throws IOException If a problem writing output
       */
      public void writeServiceLines(String service) throws IOException
      {
          for (int i = 0; i < SERVICE_LINES.length; i++)
          {
              String line =  SERVICE_LINES[i];
              line = replaceString(line, "\"@SERVICE-CLASS@\"", service);
              m_output.write(line  + "\n");
          }
      }
  
      /**
       * Write the end of services section
       * @throws IOException If a problem writing output
       */
      public void writeEndOfServicesSection() throws IOException
      {
          for (int i = 0; i < END_OF_SERVICES.length; i++)
          {
              m_output.write(END_OF_SERVICES[i] + "\n");
          }
      }
  
      public void writeManagementLine(String interfaceName) throws IOException
      {
          for (int i = 0; i < MANAGEMENT_LINE.length; i++)
          {
              String line =  MANAGEMENT_LINE[i];
              line = replaceString(line, "@INTERFACE-NAME@", interfaceName);
              m_output.write(line + "\n");
          }
  
      }
  
      /**
       * Write the end of management section
       * @throws IOException If a problem writing output
       */
      public void writeEndOfManagementSection() throws IOException
      {
          for (int i = 0; i < END_OF_MGMT.length; i++)
          {
              m_output.write(END_OF_MGMT[i] + "\n");
          }
      }
  
  
      /**
       * Write Dependency Lines
       * @param dependency The Dependency
       * @throws IOException If a problem writing output
       */
      public void writeDependencyLines(String dependency) throws IOException
      {
          for (int i = 0; i < DEPENDENCY_SECTION.length; i++)
          {
              String line =  DEPENDENCY_SECTION[i];
              line = replaceString(line, "\"@SERVICE-CLASS@\"", dependency);
              m_output.write(line + "\n");
          }
      }
  
      /**
       * Write footer
       * @throws IOException If a problem writing output
       */
      public void writeFooter() throws IOException
      {
          for (int i = 0; i < FOOTER.length; i++)
          {
              m_output.write(FOOTER[i] + "\n");
          }
      }
  
      /**
       * Close the file.
       * @throws IOException If a problem writing output
       */
      public void close() throws IOException
      {
          m_output.close();
      }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message