コード例 #1
0
 public Argument createArgument(String name, int type, int datatype) throws DDLException {
   try {
     Map gprops = (Map) getSpecification().getProperties();
     Map props = (Map) getSpecification().getCommandProperties(Specification.CREATE_PROCEDURE);
     Map bindmap = (Map) props.get("Binding");
     String tname = (String) bindmap.get("ARGUMENT");
     if (tname != null) {
       Map typemap = (Map) gprops.get(tname);
       if (typemap == null)
         throw new InstantiationException("unable to locate binded object " + tname);
       Class typeclass = Class.forName((String) typemap.get("Class"));
       String format = (String) typemap.get("Format");
       ProcedureArgument arg = (ProcedureArgument) typeclass.newInstance();
       arg.setName(name);
       arg.setType(type);
       arg.setDataType(datatype);
       arg.setFormat(format);
       return (Argument) arg;
     } else
       throw new InstantiationException("unable to locate type " + type + " in table: " + bindmap);
   } catch (Exception e) {
     throw new DDLException(e.getMessage());
   }
 }
コード例 #2
0
  public Map getCommandProperties() throws DDLException {
    Map props = (Map) getSpecification().getProperties();
    String cols = "", argdelim = (String) props.get("ArgumentListDelimiter");
    Map cmdprops = super.getCommandProperties();

    Enumeration col_e = args.elements();
    while (col_e.hasMoreElements()) {
      ProcedureArgument arg = (ProcedureArgument) col_e.nextElement();
      boolean inscomma = col_e.hasMoreElements();
      cols = cols + arg.getCommand(this) + (inscomma ? argdelim : "");
    }

    cmdprops.put("arguments", cols);
    cmdprops.put("body", body);
    return cmdprops;
  }