コード例 #1
0
 private static void reportInvalidSysId(String msg) throws AdeException {
   final IDataStoreSources dataStoreSources = Ade.getAde().getDataStore().sources();
   final Collection<ISource> sources = dataStoreSources.getAllSources();
   StringBuilder bldids = new StringBuilder("");
   for (ISource source : sources) {
     if (bldids.length() > 0) {
       bldids.append(", ");
     }
     bldids.append(source.getSourceId());
   }
   throw new AdeUsageException(msg + " Valid ids are: " + bldids.toString());
 }
コード例 #2
0
  private static Collection<ISource> getSourcesFromArgument(String sysId, boolean allowAll)
      throws AdeException {
    final IDataStoreSources dataStoreSources = Ade.getAde().getDataStore().sources();

    if (sysId.equalsIgnoreCase(ArgumentConstants.ALL)) {
      if (allowAll) {
        return dataStoreSources.getAllSources();
      }
      reportInvalidSysId("'all' not allowed here. Please specifiy a system id.");
    }

    final List<ISource> result = new ArrayList<ISource>();
    final ISource res = dataStoreSources.getSource(sysId);
    if (res != null) {
      result.add(res);
      return result;
    }

    reportInvalidSysId(String.format("Invalid system id '%s'.", sysId));
    return null;
  }
コード例 #3
0
 public static Set<ISource> getAnalysisGroupSourcesFromArgument(String analysisGroup)
     throws AdeException {
   final IDataStoreSources dataStoreSources = Ade.getAde().getDataStore().sources();
   int analysisGroupId = GroupRead.getAnalysisGroupId(analysisGroup);
   return dataStoreSources.getSourcesForAnalysisGroup(analysisGroupId);
 }