private File getStreamFile(IScope scope, String name) {
   if (log.isDebugEnabled()) {
     log.debug("getStreamFile - name: {}", name);
   }
   IStreamableFileFactory factory =
       (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class);
   if (name.indexOf(':') == -1 && name.indexOf('.') == -1) {
     // Default to .flv files if no prefix and no extension is given.
     name = "flv:" + name;
   }
   // ams sends an asterisk at the start of the name on mp4, so remove it
   if (name.charAt(0) == '*') {
     name = name.substring(1);
     if (log.isTraceEnabled()) {
       log.trace("Removed star prefix: {}", name);
     }
   }
   for (IStreamableFileService service : factory.getServices()) {
     if (name.startsWith(service.getPrefix() + ':')) {
       name = service.prepareFilename(name);
       break;
     }
   }
   // look for a custom filename gen class
   IStreamFilenameGenerator filenameGenerator =
       (IStreamFilenameGenerator)
           ScopeUtils.getScopeService(
               scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
   // get the filename
   String filename = filenameGenerator.generateFilename(scope, name, GenerationType.PLAYBACK);
   File file;
   try {
     // most likely case first
     if (!filenameGenerator.resolvesToAbsolutePath()) {
       try {
         file = scope.getContext().getResource(filename).getFile();
       } catch (FileNotFoundException e) {
         log.debug("File {} not found, nulling it", filename);
         file = null;
       }
     } else {
       file = new File(filename);
     }
     // check file existence
     if (file != null && !file.exists()) {
       // if it does not exist then null it out
       file = null;
     }
   } catch (IOException e) {
     log.info("Exception attempting to lookup file: {}", e.getMessage());
     if (log.isDebugEnabled()) {
       log.warn("Exception attempting to lookup file: {}", name, e);
     }
     // null out the file (fix for issue #238)
     file = null;
   }
   return file;
 }
 /** Start this server-side stream */
 public void start() {
   if (state != StreamState.UNINIT) {
     throw new IllegalStateException("State " + state + " not valid to start");
   }
   if (items.size() == 0) {
     throw new IllegalStateException("At least one item should be specified to start");
   }
   if (publishedName == null) {
     throw new IllegalStateException("A published name is needed to start");
   }
   try {
     IScope scope = getScope();
     IContext context = scope.getContext();
     providerService = (IProviderService) context.getBean(IProviderService.BEAN_NAME);
     // publish this server-side stream
     providerService.registerBroadcastStream(scope, publishedName, this);
     scheduler = (ISchedulingService) context.getBean(ISchedulingService.BEAN_NAME);
   } catch (NullPointerException npe) {
     log.warn("Context beans were not available; this is ok during unit testing", npe);
   }
   setState(StreamState.STOPPED);
   currentItemIndex = -1;
   nextItem();
 }