@Override public String replacePath(String inputURI){
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("About to filter: " + inputURI);
  }
  if (inputURI.contains(TemporaryDirectoryManager.DIRECTORY_TEMPLATE)) {
synchronized (LOCK) {
      initialiseDirectory();
      String[] components=inputURI.split("[:;]");
      for (      String component : components) {
        if (component.contains(DIRECTORY_TEMPLATE)) {
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Component of URL: " + component);
            LOGGER.debug("temporaryDirectoryName: " + temporaryDirectoryName);
          }
          String prefix=component.substring(0,component.indexOf(DIRECTORY_TEMPLATE));
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("prefix: " + prefix);
          }
          File temporaryDirectory=new File(prefix,temporaryDirectoryName);
          if (!createdDirectories.contains(temporaryDirectory.getPath())) {
            if (!temporaryDirectory.exists()) {
              if (!temporaryDirectory.mkdirs()) {
                throw new IllegalStateException("Directory " + temporaryDirectory + " could not be created while configuring "+ inputURI);
              }
 else {
                createdDirectories.add(temporaryDirectory.getPath());
              }
            }
 else {
              createdDirectories.add(temporaryDirectory.getPath());
            }
          }
        }
      }
    }
    final String modifiedInputURI=inputURI.replace(TemporaryDirectoryManager.DIRECTORY_TEMPLATE,temporaryDirectoryName);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("modifiedInputURI: " + modifiedInputURI);
    }
    return modifiedInputURI;
  }
  return inputURI;
}

@ Override public String replacePath ( String inputURI ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "About to filter: " + inputURI ) ; } if ( inputURI . contains ( TemporaryDirectoryManager . DIRECTORY_TEMPLATE ) ) { synchronized ( LOCK ) { initialiseDirectory ( ) ; String [ ] components = inputURI . split ( "[:;]" ) ; for ( String component : components ) { if ( component . contains ( DIRECTORY_TEMPLATE ) ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Component of URL: " + component ) ; LOGGER . debug ( "temporaryDirectoryName: " + temporaryDirectoryName ) ; } String prefix = component . substring ( 0 , component . indexOf ( DIRECTORY_TEMPLATE ) ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "prefix: " + prefix ) ; } File temporaryDirectory = new File ( prefix , temporaryDirectoryName ) ; if ( ! createdDirectories . contains ( temporaryDirectory . getPath ( ) ) ) { if ( ! temporaryDirectory . exists ( ) ) { if ( ! temporaryDirectory . mkdirs ( ) ) { throw new IllegalStateException ( "Directory " + temporaryDirectory + " could not be created while configuring " + inputURI ) ; } else { createdDirectories . add ( temporaryDirectory . getPath ( ) ) ; } } else { createdDirectories . add ( temporaryDirectory . getPath ( ) ) ; } } } } } final String modifiedInputURI = inputURI . replace ( TemporaryDirectoryManager . DIRECTORY_TEMPLATE , temporaryDirectoryName ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "modifiedInputURI: " + modifiedInputURI ) ; } return modifiedInputURI ; } return inputURI ; }
this method replaces ( if found ) the sub - string [ temp ] in any input string with the value determined by the implementation of this interface . < p / > todo : there is a possibility of a race condition where two separate processes ( jvms ) are attempting to create the same directory name simultaneously . this needs to be addressed .
