コード例 #1
0
  @Before
  public void setUp() throws Exception {
    FileSystemUtils.deleteRecursively(repositories);

    ARTEFACTS.add(TEST_ARTEFACT_ONE);
    ARTEFACTS.add(TEST_ARTEFACT_TWO);
    ARTEFACTS.add(TEST_ARTEFACT_THREE);
    ARTEFACTS.add(TEST_ARTEFACT_FOUR);
    ARTEFACTS.add(TEST_ARTEFACT_FIVE);
    ARTEFACTS.add(TEST_ARTEFACT_SIX);
    ARTEFACTS.add(TEST_ARTEFACT_SEVEN);
    ARTEFACTS.add(TEST_ARTEFACT_EIGHT);
    ARTEFACTS.add(TEST_ARTEFACT_NINE);
    ARTEFACTS.add(TEST_ARTEFACT_TEN);
    ARTEFACTS.add(TEST_ARTEFACT_ELEVEN);
    ARTEFACTS.add(TEST_ARTEFACT_TWELVE);
    ARTEFACTS.add(TEST_ARTEFACT_THIRTEEN);
    ARTEFACTS.add(TEST_ARTEFACT_FOURTEEN);
    ARTEFACTS.add(TEST_ARTEFACT_FIFTEEN);
    ARTEFACTS.add(TEST_ARTEFACT_SIXTEEN);
  }
コード例 #2
0
ファイル: WARDeployer.java プロジェクト: eclipse/virgo.web
  @Override
  public final boolean undeploy(Bundle bundle) {
    String bundleLocation = removeTrailingFileSeparator(bundle.getLocation());
    String warPath = extractWarPath(bundleLocation);
    String extractedWarNameFromBundleLocation = extractWarNameFromBundleLocation(warPath);
    final File warDir = new File(warPath);
    String warName =
        StatusFileModificator.deleteStatusFileByNamePattern(
            extractedWarNameFromBundleLocation.replaceAll("[.]", "[^a-zA-Z0-9_-]"), this.pickupDir);
    if (("").equals(warName)) {
      warName = extractedWarNameFromBundleLocation;
    }

    try {
      if (this.logger.isInfoEnabled()) {
        this.logger.info(
            "Removing bundle '"
                + bundle.getSymbolicName()
                + "' version '"
                + bundle.getVersion()
                + "' from bundles.info.");
      }
      if (this.bundleInfosUpdaterUtil != null && this.bundleInfosUpdaterUtil.isAvailable()) {
        String locationForBundlesInfo =
            BundleLocationUtil.getRelativisedURI(kernelHomeFile, warDir).toString();
        BundleInfosUpdater.unregisterToBundlesInfo(bundle, locationForBundlesInfo, NOT_A_FRAGMENT);
        this.logger.info(
            "Successfully removed bundle '"
                + bundle.getSymbolicName()
                + "' version '"
                + bundle.getVersion()
                + "' from bundles.info.");
      } else {
        this.logger.error(
            "BundleInfosUpdater not available. Failed to remove bundle '"
                + bundle.getSymbolicName()
                + "' version '"
                + bundle.getVersion()
                + "' from bundles.info.");
      }
      this.eventLogger.log(
          WARDeployerLogEvents.NANO_STOPPING, bundle.getSymbolicName(), bundle.getVersion());
      bundle.stop();
      this.eventLogger.log(
          WARDeployerLogEvents.NANO_STOPPED, bundle.getSymbolicName(), bundle.getVersion());
      this.eventLogger.log(
          WARDeployerLogEvents.NANO_UNINSTALLING, bundle.getSymbolicName(), bundle.getVersion());
      bundle.uninstall();
      // we need to decode the path before delete or a /webapps entry might leak
      FileSystemUtils.deleteRecursively(new File(warDir.getAbsolutePath()));
      this.eventLogger.log(
          WARDeployerLogEvents.NANO_UNINSTALLED, bundle.getSymbolicName(), bundle.getVersion());
      wabStates.remove((String) bundle.getSymbolicName());
    } catch (BundleException e) {
      this.eventLogger.log(
          WARDeployerLogEvents.NANO_UNDEPLOY_ERROR,
          e,
          bundle.getSymbolicName(),
          bundle.getVersion());
      StatusFileModificator.createStatusFile(
          warName, this.pickupDir, StatusFileModificator.OP_UNDEPLOY, STATUS_ERROR, -1, -1);
      return STATUS_ERROR;
    } catch (IOException e) {
      this.eventLogger.log(
          WARDeployerLogEvents.NANO_PERSIST_ERROR,
          e,
          bundle.getSymbolicName(),
          bundle.getVersion());
    } catch (URISyntaxException e) {
      this.eventLogger.log(
          WARDeployerLogEvents.NANO_PERSIST_ERROR,
          e,
          bundle.getSymbolicName(),
          bundle.getVersion());
    }

    StatusFileModificator.createStatusFile(
        warName, this.pickupDir, StatusFileModificator.OP_UNDEPLOY, STATUS_OK, -1, -1);
    return STATUS_OK;
  }
コード例 #3
0
 @After
 public void cleanUp() {
   FileSystemUtils.deleteRecursively(repositories);
 }