executing spring roo programmatically

浪子不回头ぞ 提交于 2019-12-10 21:33:59

问题


i had a look at spring roo.I found that we can generate entities ,contollers and others using command prompt. But i need to get the entity names and field names as a user input from text boxes and then generate the project using roo. I am using windows.


回答1:


You can use the Roo Command Wizard available on the Springsource Tool Suite (STS).




回答2:


You can create script file, and then execute that file with roo.

>roo script --file fileName.

Unfortunaly I do not know if it is possible to run roo with the script as an parameter so that it automaticaly run that script.




回答3:


The latest roo (I have 2.0.0.BUILD-SNAPSHOT [rev 7a0fe1b]) has a fledgling web interface called Eastern Grey UI (http://localhost:9191). I'm finding you can call the functions like this (a test module I'm working on -- service.post just does a standard post to a web site):

    Map<String, String> env = new HashMap<String, String>();
    env.put("projectName", "clinic");
    env.put("topLevelPackage", "com.ritchey");
    String resp = service.post("http://localhost:9191/rs-api/project", env);
    log.debug("resp = " + resp);

    env = new HashMap<String, String>();
    env.put("database", "MSSQL");
    env.put("providerName", "HIBERNATE");
    env.put("username", "Avatar");
    env.put("password", "xxxxxx");
    resp = service.post("http://localhost:9191/rs-api/persistence", env);
    log.debug("resp = " + resp);

    env = new HashMap<String, String>();
    env.put("entityName", "~.domain.Pet");
    resp = service.post("http://localhost:9191/rs-api/entities", env);
    log.debug("resp = " + resp);

    env = new HashMap<String, String>();
    env.put("entityName", "~.domain.Pet");
    env.put("fieldName", "name");
    env.put("fieldGroup", "");
    env.put("fieldType", "string");
    env.put("referencedClass", "");
    resp = service.post("http://localhost:9191/rs-api/fields", env);
    log.debug("resp = " + resp);


来源:https://stackoverflow.com/questions/9322451/executing-spring-roo-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!