View Javadoc

1   /*
2    * $Id: CommandLineApplicationInterface.java,v 1.2 2004/10/08 19:56:50 pah Exp $
3    * 
4    * Created on 27-Aug-2004 by Paul Harrison (pah@jb.man.ac.uk)
5    * Copyright 2004 AstroGrid. All rights reserved.
6    *
7    * This software is published under the terms of the AstroGrid 
8    * Software License version 1.2, a copy of which has been included 
9    * with this distribution in the LICENSE.txt file.  
10   *
11   */ 
12  
13  package org.astrogrid.applications.commandline.digester;
14  
15  import org.apache.commons.logging.Log;
16  import org.apache.commons.logging.LogFactory;
17  
18  import org.astrogrid.applications.beans.v1.ParameterRef;
19  import org.astrogrid.applications.description.ApplicationDescription;
20  import org.astrogrid.applications.description.base.BaseApplicationInterface;
21  import org.astrogrid.applications.description.exception.ParameterDescriptionNotFoundException;
22  
23  /***
24   * Utility class to make it easier to create interfaces from digester.
25   * @author Paul Harrison (pah@jb.man.ac.uk) 27-Aug-2004
26   * @version $Name:  $
27   * @since iteration6
28   */
29  class CommandLineApplicationInterface extends BaseApplicationInterface {
30     /***
31      * Logger for this class
32      */
33     private static final Log logger = LogFactory
34           .getLog(CommandLineApplicationInterface.class);
35  
36      /***
37       * @param name
38       * @param description
39       */
40      public CommandLineApplicationInterface(String name,
41              ApplicationDescription description) {
42          super(name, description);
43  
44        if (logger.isDebugEnabled()) {
45           logger
46                 .debug("CommandLineApplicationInterface(ApplicationDescription description = "
47                       + description + ") - creating new interface description");
48        }
49   
50      }
51      
52      public void addInputParameterAsPref(ParameterRef pref) throws ParameterDescriptionNotFoundException
53      {
54            getApplicationDescription().getParameterDescription(pref.getRef());
55            addInputParameter(pref.getRef(), pref.getMinoccurs(), pref.getMaxoccurs());
56      }
57      public void addOutputParameterAsPref(ParameterRef pref) throws ParameterDescriptionNotFoundException
58      {
59          getApplicationDescription().getParameterDescription(pref.getRef());
60          addOutputParameter(pref.getRef(), pref.getMinoccurs(), pref.getMaxoccurs());
61          
62      }
63  }