View Javadoc

1   /*
2    * Copyright 2000-2002,2004 The Apache Software Foundation.
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 org.apache.commons.modeler.ant;
18  
19  import java.util.ArrayList;
20  
21  import org.apache.commons.logging.Log;
22  import org.apache.commons.logging.LogFactory;
23  import org.apache.tools.ant.BuildException;
24  
25  /***
26   * Like MLETTask, but it wraps the bean in a BaseModelMBean.
27   *
28   */
29  public class ModelerTask extends MLETTask {
30  
31      private static Log log = LogFactory.getLog(ModelerTask.class);
32  
33      public ModelerTask() {
34      }
35  
36      public void execute() throws BuildException {
37          try {
38              Arg codeArg=new Arg();
39              codeArg.setType("java.lang.String");
40              codeArg.setValue( code );
41              if( args==null) args=new ArrayList();
42              args.add(0, codeArg);
43              super.execute();
44  //            super.bindJmx(objectName,
45  //                    "org.apache.commons.modeler.BaseModelMBean",
46  //                    null,
47  //                    args );
48          } catch(Exception ex) {
49              ex.printStackTrace();
50          }
51      }
52  
53  }