1 23 package org.enhydra.kelp.common.codegen; 24 25 import org.enhydra.tool.codegen.ProjectGenerator; 27 import org.enhydra.tool.codegen.GeneratorException; 28 import org.enhydra.tool.codegen.internal.ServiceOptionSet; 29 import org.enhydra.tool.codegen.internal.ServiceGenerator; 30 31 import org.enhydra.kelp.KelpInfo; 33 import org.enhydra.kelp.common.node.OtterNode; 34 import org.enhydra.kelp.common.node.OtterProject; 35 import org.enhydra.kelp.common.node.OtterFolderNode; 36 import org.enhydra.kelp.common.node.OtterJavaFileNode; 37 import org.enhydra.kelp.common.node.OtterTextFileNode; 38 import org.enhydra.kelp.common.node.OtterNodeFactory; 39 40 import java.awt.Component ; 42 import java.io.File ; 43 import java.io.FilenameFilter ; 44 import java.util.Vector ; 45 import java.util.ResourceBundle ; 46 47 public class ServiceUtil extends ProjectGenUtil { 49 50 private final static String DEFAULT_COMMAND_NAME = "service"; 53 public ServiceUtil() throws CodeGenException { 55 super(new ServiceGenerator()); 56 } 57 58 public ServiceUtil(OtterProject project) throws CodeGenException { 59 super(project, new ServiceGenerator()); 60 } 61 62 public ServiceUtil(OtterProject project, ServiceGenerator gen) throws CodeGenException { 63 super(project, gen); 64 } 65 66 67 public static ProjectGenerator createGenerator() { 68 return new ServiceGenerator(); 69 } 70 71 public static String getCommandName() { 72 String commandName = DEFAULT_COMMAND_NAME; 73 74 if (KelpInfo.isClassPathComplete()) { 75 commandName = ServiceGenerator.COMMAND_NAME; 76 } 77 return commandName; 78 } 79 80 85 public static String getDisplayName() { 86 String displayName = res.getString("Web_Application"); 87 88 if (KelpInfo.isClassPathComplete()) { 89 displayName = ServiceGenerator.displayName; 90 } 91 return displayName; 92 } 93 94 protected void initOptions() throws GeneratorException { 96 String serviceName = new String (); 97 StringBuffer buf = new StringBuffer (); 98 super.initOptions(); 99 100 serviceName = getGenerator().getOptionSet().lookup(ServiceOptionSet.PROJECT).getValue(); 101 buf.append(Character.toUpperCase(serviceName.charAt(0))); 102 if (serviceName.length() > 1) { 103 buf.append(serviceName.substring(1)); 104 } 105 serviceName = buf.toString(); 106 getGenerator().getOptionSet().lookup(ServiceOptionSet.SERVICE).setValue(serviceName); 107 getGenerator().getOptionSet().lookup(ServiceOptionSet.MBEAN).setValue(true); 108 } 109 110 } 111 | Popular Tags |