Changeset 4105


Ignore:
Timestamp:
Jan 28, 2008, 1:52:31 PM (15 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #907: "Test with file" function should be able to wrap input stream

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Install.java

    r4080 r4105  
    588588        "wants to use an uploaded file to generate the regular expressions for parsing it.",
    589589        "net.sf.basedb.util.parser.ConfigureByExample", null);
     590      createPluginType("Configure by example (wrapped)", "This is an extension to the 'Configure by example' interface " +
     591          "that allows plug-ins to wrap the file with a special input stream when reading from it. " +
     592          "It makes it possible, for example, to parse compressed files on the fly.",
     593          "net.sf.basedb.util.parser.WrappedConfigureByExample", null);
    590594      createPluginType("File unpacker", "This interface should be implemented by all plugins that can unpack compressed files. " +
    591595        "The file upload feature uses these plugins for automatic unpacking of compressed files.",
  • trunk/src/core/net/sf/basedb/core/PluginRequest.java

    r3679 r4105  
    271271  /**
    272272    Get the plugin object.
    273   */
    274   P getPlugin()
     273    @since 2.6 (was not public before)
     274  */
     275  public P getPlugin()
    275276  {
    276277    return plugin;
  • trunk/www/common/plugin/parse_file.jsp

    r3675 r4105  
    3535  import="net.sf.basedb.core.Path"
    3636  import="net.sf.basedb.core.Location"
     37  import="net.sf.basedb.core.PluginConfigurationRequest"
     38  import="net.sf.basedb.core.plugin.Plugin"
    3739  import="net.sf.basedb.util.parser.FlatFileParser"
     40  import="net.sf.basedb.util.parser.WrappedConfigureByExample"
    3841  import="net.sf.basedb.clients.web.Base"
    3942  import="net.sf.basedb.util.Values"
     
    6063  String path = request.getParameter("path");
    6164  String charsetName = Values.getString(request.getParameter("charset"), Config.getCharset());
     65  PluginConfigurationRequest pcRequest = (PluginConfigurationRequest)sc.getSessionSetting("plugin.configure.request");
     66  Plugin plugin = pcRequest.getPlugin();
     67 
    6268  File file = null;
    6369  FlatFileParser parser = null;
     
    147153   
    148154    fileInputStream = file.getDownloadStream(0);
     155    if (plugin instanceof WrappedConfigureByExample)
     156    {
     157      WrappedConfigureByExample wex = (WrappedConfigureByExample)plugin;
     158      fileInputStream = wex.wrapInputStream(fileInputStream);
     159    }
    149160    parser.setInputStream(fileInputStream, charsetName);
    150161    lastLine = parser.parseHeaders();
Note: See TracChangeset for help on using the changeset viewer.