public Parameter[] getParameterList() {

    return new Parameter[] {
      SmOption.getModelOption_F(),
      SmOptionPM.getListAttrOption_F().setHelp("list of all the valid attributes"),
      SmOptionPM.getPwrsrcOption_F(),
      SmOption.getNameValuePairs_Uf().setHelp("(name value)+")
    };
  }
 public Parameter[] getParameterList() {
   return new Parameter[] {
     SmOption.getModelOption_F(),
     SmOption.getInstanceOption_UfG().setRequired(false),
     SmOption.getCreatePortOption_S().setHelp("allow the creation of new ports"),
     SmOption.getDirectionOption_F(),
     SmOption.getLeakage_S().setHelp("connect only leakage port"),
     SmOption.getHier_S(),
     SmOption.getForce_S().setHelp("remove initial connections if existing"),
     SmOption.getPropagateOption_F()
   };
 }
Exemple #3
0
  public Object execute(List<String> argList) {
    JSAPResult argv = parse(argList);
    if (argv == null) {
      return false;
    }

    String modelID = argv.getString(SmOption.MODEL_OPTION);

    ModelDB model = SmOption.getModel(modelID);

    DBJobParam dBJobParam = new DBJobParam();
    dBJobParam.setDstModel(model);

    for (String portName : argv.getStringArray(SmOption.PORT_OPTION)) {
      dBJobParam.setDstPortName(portName);

      new PortDeleteDBJob(dBJobParam).launch();
    }

    return true;
  }
  public Object execute(List<String> argList) throws TclShellException {

    JSAPResult argv = parse(argList);
    if (argv == null) {
      return false;
    }
    InstanceDB inst;
    boolean hasError = false;
    String modelID = argv.getString(SmOption.MODEL_OPTION);

    ModelDB model = SmOption.getModel(modelID);
    if (model == null) throw new TclShellException("");

    boolean createPort = argv.getBoolean(SmOption.CREATE_PORT_OPTION);
    /*
     * Set Parameters
     */
    String[] instances = argv.getStringArray(SmOption.INSTANCE_OPTION);

    Collection<InstanceDB> instToConnect = new ArrayList<InstanceDB>();

    if (instances == null || instances.length == 0) instToConnect = model.instances();

    for (String instName : instances) {
      inst = model.instance(instName);

      if (inst == null) {
        Logger.error(
            ErrorList.DB15.errorName(),
            ErrorList.DB15.getMessage(instName + " in model " + model.getModelName()));
        hasError = true;
        continue;
      }
      instToConnect.add(inst);
    }

    DBJobParam param = new DBJobParam();
    param.setSrcData(
        ConnectByNameDBJob.CONNECT_INSTANCES,
        instToConnect.toArray(new InstanceDB[instToConnect.size()]));
    param.setSrcData(ConnectByNameDBJob.CREATE_PORT, createPort);
    param.setSrcData(ConnectByNameDBJob.LEAKAGE_PORT, argv.getBoolean(SmOption.LEAKAGE_OPTION));
    param.setSrcData(
        ConnectByNameDBJob.PROPAGATE_UP,
        SmOption.UP_OPTION.equals(argv.getString(SmOption.PROPAGATE_OPTION)));

    if (argv.contains(SmOption.DIRECTION_OPTION)) {
      String dir = argv.getString(SmOption.DIRECTION_OPTION);

      if ("in".equals(dir)) param.setSrcData(ConnectByNameDBJob.DIRECTION, PortInDB.class);
      else if ("out".equals(dir)) param.setSrcData(ConnectByNameDBJob.DIRECTION, PortOutDB.class);
    }

    if (argv.getBoolean(SmOption.HIER_OPTION))
      param.setSrcData(ConnectByNameDBJob.HIER_OPTION, true);

    param.setSrcData(ConnectByNameDBJob.KEEPCONNECTION, !argv.getBoolean(SmOption.FORCE_OPTION));

    DBJob job = new ConnectByNameDBJob(param);
    job.launch();

    if (hasError || !job.isSuccessful())
      throw new TclShellException("error with " + getCommandText());

    return null;
  }
Exemple #5
0
 public Parameter[] getParameterList() {
   return new Parameter[] {
     SmOption.getModelOption_F(), SmOption.getPortOption_Uf().setGreedy(true),
   };
 }