/** * Retire all the other versions of the same DU: * first take the DU name and insert version regexp, * than try to match the this string against names of already deployed DUs. * For instance if we are deploying DU "AbsenceRequest-2/AbsenceRequest.ode" and * there's already version 2 than regexp * "AbsenceRequest([-\\.](\d)+)?/AbsenceRequest.ode" will be matched against * "AbsenceRequest-2/AbsenceRequest.ode" and setRetirePackage() will be called accordingly. */ private void retirePreviousPackageVersions(DeploymentUnitDir du) { //retire all the other versions of the same DU String[] nameParts = du.getName().split("/"); /* Replace the version number (if any) with regexp to match any version number */ nameParts[0] = nameParts[0].replaceAll("([-\\Q.\\E](\\d)+)?\\z", ""); nameParts[0] += "([-\\Q.\\E](\\d)+)?"; StringBuilder duNameRegExp = new StringBuilder(du.getName().length() * 2); for (int i = 0, n = nameParts.length; i < n; i++) { if (i > 0) duNameRegExp.append("/"); duNameRegExp.append(nameParts[i]); } Pattern duNamePattern = Pattern.compile(duNameRegExp.toString()); for (String deployedDUname : _deploymentUnits.keySet()) { Matcher matcher = duNamePattern.matcher(deployedDUname); if (matcher.matches()) { setRetiredPackage(deployedDUname, true); } } }
/** * Retire all the other versions of the same DU: * first take the DU name and insert version regexp, * than try to match the this string against names of already deployed DUs. * For instance if we are deploying DU "AbsenceRequest-2/AbsenceRequest.ode" and * there's already version 2 than regexp * "AbsenceRequest([-\\.](\d)+)?/AbsenceRequest.ode" will be matched against * "AbsenceRequest-2/AbsenceRequest.ode" and setRetirePackage() will be called accordingly. */ // https://jira.jboss.org/browse/RIFTSAW-155 // need to override this in RiftSawProcessStore because Riftsaw deployment unit naming // is different from ODE. protected void retirePreviousPackageVersions(DeploymentUnitDir du) { //retire all the other versions of the same DU List<String> deployedDUNames = getPreviousPackageVersions(du.getName()); for (String deployedDUName : deployedDUNames) { setRetiredPackage(deployedDUName, true); } }