View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2008 utgenome.org
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  // utgb-shell Project
18  //
19  // GWT.java
20  // Since: Jun 2, 2008
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.shell;
26  
27  import java.io.IOException;
28  
29  import org.utgenome.config.UTGBConfig;
30  import org.xerial.util.log.Logger;
31  
32  /**
33   * A sub command for creating a GWT interface
34   * 
35   * @author leo
36   * 
37   */
38  public class GWT extends UTGBShellCommand {
39  
40  	private static Logger _logger = Logger.getLogger(GWT.class);
41  
42  	@Override
43  	public void execute(String[] args) throws Exception {
44  		UTGBConfig config = loadUTGBConfig();
45  
46  		if (!isInProjectRoot())
47  			throw new UTGBShellException("must be in the project root");
48  
49  		String packageName = config.javaPackage;
50  		String projectName = config.projectName;
51  
52  		ScaffoldGenerator generator = new ScaffoldGenerator(globalOption.projectDir, new Create.CreateAllScaffoldFileFilter());
53  		try {
54  			generator.createGWTModuleScaffold(config);
55  		}
56  		catch (IOException e) {
57  			_logger.error("failed to craate GWT module: " + e.getMessage());
58  		}
59  
60  	}
61  
62  	@Override
63  	public String name() {
64  		return "gwt";
65  	}
66  
67  	public String getOneLinerDescription() {
68  		return "create a GWT interface";
69  	}
70  
71  }