public TxIntrospectorCodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { super(compArgs, domainModel); String param = compArgs.getParams().get(TXINTROSPECTOR_ON_CONFIG_KEY); enabled = (param != null) && param.trim().equalsIgnoreCase(TXINTROSPECTOR_ON_CONFIG_VALUE); }
/** * Create the CompilerArgs using command-line args. */ public CompilerArgs(String[] args) throws DmlCompilerException { try { processCommandLineArgs(args); checkArguments(); } catch (Exception e) { throw new DmlCompilerException(e); } }
String getNextArgument(String[] args, int pos) { int nextPos = pos + 1; if (nextPos < args.length) { return args[nextPos]; } else { error("option " + args[pos] + " requires argument"); } return null; }
/** * Create the CompilerArgs using the project name (requires a <code><projName></code>/project.properties file in the * classpath). */ public CompilerArgs(File destDirectory, File destDirectoryBase, String packageName, Boolean generateFinals, Class<? extends CodeGenerator> generatorClass, String projectName, Map<String, String> params) throws DmlCompilerException { this(projectName, destDirectory, destDirectoryBase, packageName, generateFinals, generatorClass, params); try { setDmlSpecsFromProjectName(projectName); } catch (Exception e) { throw new DmlCompilerException(e); } checkArguments(); }
int processOption(String[] args, int pos) throws Exception { if (args[pos].equals("-d")) { destDirectory = new File(getNextArgument(args, pos)); return pos + 2; } else if (args[pos].equals("-db")) { destDirectoryBase = new File(getNextArgument(args, pos)); return pos + 2; } else if (args[pos].equals("-p")) { packageName = getNextArgument(args, pos); return pos + 2; } else if (args[pos].equals("-f")) { error("option -f no longer exists (consider -generator instead)"); } else if (args[pos].equals("-gf")) { generateFinals = true; return pos + 1; } else if (args[pos].equals("-generator")) { generatorClass = (Class<? extends CodeGenerator>) Class.forName(getNextArgument(args, pos)); return pos + 2; } else if (args[pos].equals("-domainModelClass")) { error("option -domainModelClass no longer exists"); } else if (args[pos].equals("-localDmlSpec")) { addToDomainSpecs(getNextArgument(args, pos), addToLocalDomainSpecs); return pos + 2; } else if (args[pos].equals("-externalDmlSpec")) { addToDomainSpecs(getNextArgument(args, pos), addToLocalDomainSpecs); return pos + 2; } else if (args[pos].equals("-pn")) { String projectName = getNextArgument(args, pos);
/** * Runs the DML compiler * * This is the main entry point for running the DML compiler, from the command line. This * method will create the {@link CompilerArgs} from the command line parameters, and then invoke {@link DmlCompiler#compile}. * * @param args All the compiler's parameters * * @see CompilerArgs */ public static void main(String[] args) throws DmlCompilerException { CompilerArgs compArgs = new CompilerArgs(args); compile(compArgs); }
/** * Create the CompilerArgs using a local and external DML files specification */ public CompilerArgs(String appName, File destDirectory, File destDirectoryBase, String packageName, Boolean generateFinals, Class<? extends CodeGenerator> generatorClass, List<URL> localDomainSpecs, List<URL> externalDomainSpecs, Map<String, String> params) { this(appName, destDirectory, destDirectoryBase, packageName, generateFinals, generatorClass, params); if (localDomainSpecs != null) { this.localDomainSpecs.addAll(localDomainSpecs); } if (externalDomainSpecs != null) { this.externalDomainSpecs.addAll(externalDomainSpecs); } checkArguments(); }
printMethod(out, "public", "String", "getAppName"); startMethodBody(out); if (compArgs.getAppName() == null) { printWords(out, "return null;"); } else { printWords(out, "return \"" + compArgs.getAppName() + "\";");
new CompilerArgs(getMavenProject().getArtifactId(), getSourcesDirectory(), getGeneratedSourcesDirectory(), getPackageName(), generateFinals(), getCodeGeneratorClass(), localDmls, externalDmls, realParams);
public DAPCodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { super(compArgs, domainModel); //System.out.println("\n\n__DAPCodeGenerator__\n\n"); String state = compArgs.getParams().get(FFDAPConfig.DAP_ON_CONFIG_KEY); DAP_ENABLED = (state != null) && state.trim().equalsIgnoreCase(FFDAPConfig.DAP_ON_CONFIG_VALUE); }
void checkArguments() { if (destDirectory == null) { error("destination directory is not specified"); } if (!destDirectory.isDirectory()) { error(destDirectory.toString() + " is not a readable directory"); } if (localDomainSpecs.isEmpty() && externalDomainSpecs.isEmpty()) { error("no domainSpec files given (-localDmlSpec and/or -externalDmlSpec) and no project name give (-pn). Must provide one of the alternatives"); } }
public JVSTMCodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { super(compArgs, domainModel); String collectionName = compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY); if (collectionName == null || collectionName.isEmpty()) { setCollectionToUse("pt.ist.fenixframework.adt.bplustree.BPlusTree"); } }
public InfinispanCodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { super(compArgs, domainModel); String collectionName = compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY); if (collectionName == null || collectionName.isEmpty()) { setCollectionToUse("pt.ist.fenixframework.adt.bplustree.BPlusTree"); } }
public OgmCodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { super(compArgs, domainModel); String collectionName = compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY); if (collectionName == null || collectionName.isEmpty()) { setCollectionToUse("pt.ist.fenixframework.adt.bplustree.BPlusTree"); } }
public CodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { this.compArgs = compArgs; this.domainModel = domainModel; this.destDirectory = getPackageDirectory(compArgs.destDirectory, compArgs.packageName); this.destDirectoryBase = getPackageDirectory((compArgs.destDirectoryBase == null) ? compArgs.destDirectory : compArgs.destDirectoryBase, compArgs.packageName); String collectionName = compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY); if (collectionName == null || collectionName.isEmpty()) { this.collectionToUse = DEFAULT_DOMAIN_BASED_MAP; } else { this.collectionToUse = compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY); } }