class JobFileListener implements FileListener {

  protected JobMeta processLinkedTrans( JobMeta jobMeta ) {
    for ( int i = 0; i < jobMeta.nrJobEntries(); i++ ) {
      JobEntryCopy jec = jobMeta.getJobEntry( i );
      if ( jec.getEntry() instanceof JobEntryTrans ) {
        JobEntryTrans jet = (JobEntryTrans) jec.getEntry();
        ObjectLocationSpecificationMethod specMethod = jet.getSpecificationMethod();
        // If the reference is by filename, change it to Repository By Name. Otherwise it's fine so leave it alone
        if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) {
          jet.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME );
          String filename = jet.getFilename();
          // if the filename is a missing variable name, it will not contain a slash - we don't want to fail
          // ungracefully in this case, simply set the trans name to the whole filename value and let the run-time
          // handle any exceptions that arise from this
          if ( filename != null ) {
            if ( filename.indexOf( "/" ) > -1 ) {
              String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) );
              String directory = filename.substring( 0, filename.lastIndexOf( "/" ) );
              jet.setTransname( jobname );
              jet.setDirectory( directory );
            } else {
              jet.setTransname( filename );
            }
          }
          jobMeta.setJobEntry( i, jec );
        }
      }
    }
    return jobMeta;
  }

}