code: private int getFileType(String filename) throws Exception {
  
          String extension = "";
          if (filename.indexOf(".") > -1) {
              extension = filename.substring((filename.lastIndexOf(".")));
          }
  
          String typename = (String)m_extensions.get(extension.toLowerCase());
          if (typename == null) {
              typename = "binary";
          }
          CmsResourceManager resourceManager = OpenCms.getResourceManager();
  
          return resourceManager.getResourceType(typename).getTypeId();
      }
docs: Returns the OpenCms file type of a real file system file. <p>
  This is made by checking the extension.<p>
  
  @param filename the name of the file in the real file system
  
  @return the id of the OpenCms file type
  
  @throws Exception if something goes wrong