Source:
FileSystemDeploymentService(final String relativeTo, final File deploymentDir, final File relativeToDir, final DeploymentOperations.Factory deploymentOperationsFactory, final ScheduledExecutorService scheduledExecutor, final ControlledProcessStateService processStateService) throws OperationFailedException { if (scheduledExecutor == null) { throw DeploymentScannerLogger.ROOT_LOGGER.nullVar("scheduledExecutor"); } if (deploymentDir == null) { throw DeploymentScannerLogger.ROOT_LOGGER.nullVar("deploymentDir"); } if (!deploymentDir.exists()) { throw DeploymentScannerLogger.ROOT_LOGGER.directoryDoesNotExist(deploymentDir.getAbsolutePath()); } if (!deploymentDir.isDirectory()) { throw DeploymentScannerLogger.ROOT_LOGGER.notADirectory(deploymentDir.getAbsolutePath()); } if (!deploymentDir.canWrite()) { throw DeploymentScannerLogger.ROOT_LOGGER.directoryNotWritable(deploymentDir.getAbsolutePath()); } this.relativeTo = relativeTo; this.deploymentDir = deploymentDir; this.deploymentOperationsFactory = deploymentOperationsFactory; this.scheduledExecutor = scheduledExecutor; this.processStateService = processStateService; if(processStateService != null) { this.processStateService.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (ControlledProcessState.State.RUNNING == evt.getNewValue()) { synchronized (this) { if (scanEnabled) { new UndeployScanRunnable().run(); } } } } }); } if (relativeToDir != null) { String fullDir = deploymentDir.getAbsolutePath(); String relDir = relativeToDir.getAbsolutePath(); String sub = fullDir.substring(relDir.length()); if (sub.startsWith(File.separator)) { sub = sub.length() == 1 ? "" : sub.substring(1); } this.relativePath = sub.length() > 0 ? sub + File.separator : sub; } else { relativePath = null; } }

Target:
FileSystemDeploymentService(final String relativeTo, final File deploymentDir, final File relativeToDir, final DeploymentOperations.Factory deploymentOperationsFactory, final ScheduledExecutorService scheduledExecutor, final ControlledProcessStateService processStateService) throws OperationFailedException { if (scheduledExecutor == null) { throw DeploymentScannerLogger.ROOT_LOGGER.nullVar("scheduledExecutor"); } if (deploymentDir == null) { throw DeploymentScannerLogger.ROOT_LOGGER.nullVar("deploymentDir"); } if (!deploymentDir.exists()) { throw DeploymentScannerLogger.ROOT_LOGGER.directoryDoesNotExist(deploymentDir.getAbsolutePath()); } if (!deploymentDir.isDirectory()) { throw DeploymentScannerLogger.ROOT_LOGGER.notADirectory(deploymentDir.getAbsolutePath()); } if (!deploymentDir.canWrite()) { throw DeploymentScannerLogger.ROOT_LOGGER.directoryNotWritable(deploymentDir.getAbsolutePath()); } this.relativeTo = relativeTo; this.deploymentDir = deploymentDir; this.deploymentOperationsFactory = deploymentOperationsFactory; this.scheduledExecutor = scheduledExecutor; this.processStateService = processStateService; if(processStateService != null) { this.propertyChangeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (ControlledProcessState.State.RUNNING == evt.getNewValue()) { synchronized (this) { if (scanEnabled) { scheduledExecutor.execute(new UndeployScanRunnable()); } } } else if (ControlledProcessState.State.STOPPING == evt.getNewValue()) { processStateService.removePropertyChangeListener(propertyChangeListener); } } }; this.processStateService.addPropertyChangeListener(propertyChangeListener); } else { this.propertyChangeListener = null; } if (relativeToDir != null) { String fullDir = deploymentDir.getAbsolutePath(); String relDir = relativeToDir.getAbsolutePath(); String sub = fullDir.substring(relDir.length()); if (sub.startsWith(File.separator)) { sub = sub.length() == 1 ? "" : sub.substring(1); } this.relativePath = sub.length() > 0 ? sub + File.separator : sub; } else { relativePath = null; } }