Exemplo n.º 1
0
  /**
   * Gets the outputs.
   *
   * @param bundle the bundle
   * @return the outputs
   */
  public static HashMap<String, ConfigurationResource> getOutputs(File bundle) {

    HashMap<String, ConfigurationResource> results = new HashMap<String, ConfigurationResource>();
    try {
      //            SHIWABundle shiwaBundle = new SHIWABundle(bundle);

      ConcreteBundle concreteBundle = new ConcreteBundle(bundle);
      //            WorkflowController workflowController = new WorkflowController(shiwaBundle);

      for (Mapping configuration : concreteBundle.getPrimaryMappings()) {
        System.out.println("Config type : " + configuration.getClass().getCanonicalName());

        if (configuration instanceof ExecutionMapping) {
          System.out.println("Received bundle has an exec config");

          System.out.println(
              configuration.getAggregatedResources().size() + " aggregated resources");

          System.out.println(
              "Exec config contains " + configuration.getResources().size() + " resources.");
          for (ConfigurationResource r : configuration.getResources()) {
            results.put(r.getReferableResource().getTitle(), r);
          }
          System.out.println(results.size() + " outputs found.");
          return results;
        }
      }
    } catch (SHIWADesktopIOException e) {
      System.out.println("Returned bundle was corrupt or null.");
      ErrorTracker.getErrorTracker()
          .broadcastError(new ErrorEvent(null, e, "Returned Bundle was corrupt or null"));
    }

    return null;
  }
Exemplo n.º 2
0
  /**
   * Gets the first configuration of type.
   *
   * @param mappingType the mapping type
   * @return the first configuration of type
   */
  private Mapping getFirstConfigurationOfType(Class<? extends Mapping> mappingType) {
    for (Mapping mapping : concreteBundle.getPrimaryMappings()) {

      if (mapping.getClass().isAssignableFrom(mappingType)) {
        return mapping;
      }

      //            if (config.getType() == configType) {
      //                return config;
      //            }
    }
    return null;
  }