예제 #1
0
  public void renderView(final ViewPath viewPath) {
    int bundleVersionId = Integer.parseInt(viewPath.getCurrent().getPath());

    BundleVersionCriteria criteria = new BundleVersionCriteria();
    criteria.addFilterId(bundleVersionId);
    criteria.fetchBundle(true);
    criteria.fetchBundleFiles(true);
    criteria.fetchBundleDeployments(true);
    criteria.fetchConfigurationDefinition(true);
    criteria.fetchTags(true);

    bundleManager.findBundleVersionsByCriteria(
        criteria,
        new AsyncCallback<PageList<BundleVersion>>() {
          public void onFailure(Throwable caught) {
            CoreGUI.getErrorHandler().handleError(MSG.view_bundle_version_loadFailure(), caught);
          }

          public void onSuccess(PageList<BundleVersion> result) {
            BundleVersion version = result.get(0);
            ViewId nextPath = viewPath.next().getCurrent();
            viewBundleVersion(version, nextPath);
          }
        });
  }
  private BundleVersion getBundleVersion(Bundle bundle) throws Exception {
    BundleVersionCriteria criteria = new BundleVersionCriteria();
    criteria.addFilterBundleId(bundle.getId());
    criteria.addFilterVersion(bundleVersion);
    criteria.fetchBundle(true);
    criteria.fetchBundleDeployments(true);

    PageList<BundleVersion> bundleVersions =
        bundleManager.findBundleVersionsByCriteria(overlord, criteria);

    if (bundleVersions.isEmpty()) {
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      StreamUtil.copy(getClass().getResourceAsStream("cassandra-bundle.jar"), outputStream);
      return bundleManager.createBundleVersionViaByteArray(overlord, outputStream.toByteArray());
    }

    return bundleVersions.get(0);
  }