Esempio n. 1
0
 /** see {@link RimDslGenerator#generateRimDslMap(InteractionModel, Commands)} */
 public Map<String, String> getRIMsMap(InteractionModel interactionModel, Commands commands) {
   RimDslGenerator rimDslGenerator = new RimDslGenerator(ve);
   Map<String, String> rims =
       rimDslGenerator.generateRimDslMap(interactionModel, commands, strictOData);
   return rims;
 }
Esempio n. 2
0
  private boolean writeArtefacts(
      String modelName,
      List<EntityInfo> entitiesInfo,
      Commands commands,
      EntityModel entityModel,
      InteractionModel interactionModel,
      File srcOutputPath,
      File configOutputPath,
      boolean generateMockResponder) {
    boolean ok = true;
    String namespace = modelName + Metadata.MODEL_SUFFIX;
    interactionModel.setDomain(namespace);

    // Create the source directory
    new File(srcOutputPath + "/" + namespace.replace(".", "/")).mkdirs();

    // generate metadata.xml
    if (!writeMetadata(configOutputPath, generateMetadata(entityModel))) {
      ok = false;
    }

    // generate spring configuration files
    if (!writeSpringConfiguration(
        configOutputPath,
        SPRING_CONFIG_FILE,
        generateSpringConfiguration(namespace, modelName, commands))) {
      ok = false;
    }

    // generate the rim DSL
    RimDslGenerator rimDslGenerator = new RimDslGenerator(ve);
    Map<String, String> rims =
        rimDslGenerator.generateRimDslMap(interactionModel, commands, strictOData);
    for (String key : rims.keySet()) {
      String rimDslFilename = key + ".rim";
      if (!writeRimDsl(configOutputPath, rimDslFilename, rims.get(key))) {
        System.out.print("Failed to write " + key);
        ok = false;
        break;
      }
    }

    if (generateMockResponder) {
      // Write JPA classes
      for (EntityInfo entityInfo : entitiesInfo) {
        if (!generateJPAEntity(entityInfo, srcOutputPath)) {
          ok = false;
        }
      }

      // generate persistence.xml
      if (!writeJPAConfiguration(configOutputPath, generateJPAConfiguration(entitiesInfo))) {
        ok = false;
      }

      // generate spring configuration for JPA database
      if (!writeSpringConfiguration(
          configOutputPath,
          SPRING_RESOURCEMANAGER_FILE,
          generateSpringResourceManagerContext(modelName))) {
        ok = false;
      }

      // generate responder insert
      if (!writeResponderDML(configOutputPath, generateResponderDML(entitiesInfo))) {
        ok = false;
      }

      // generate responder settings
      if (!writeResponderSettings(configOutputPath, generateResponderSettings(modelName))) {
        ok = false;
      }
    }

    return ok;
  }
Esempio n. 3
0
 /** see {@link RimDslGenerator#getRIM(InteractionModel, Commands)} */
 public InputStream getRIM(InteractionModel interactionModel, Commands commands) throws Exception {
   RimDslGenerator rimDslGenerator = new RimDslGenerator(ve);
   return rimDslGenerator.getRIM(interactionModel, commands, strictOData);
 }