Title: RE: JESS: Path of .clp files

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's what my Jess 5.0 source code says ... if you're using a different Jess version, you could check the source directly.

- -Bryan



class Batch implements Userfunction, Serializable
{
  public String getName() { return "batch";}
 
  public Value call(ValueVector vv, Context context) throws JessException
  {
    String filename = vv.get(1).stringValue(context);
    Value v = Funcall.FALSE;
    Reader fis = null;
    try
      {
        try
          {
            if (context.getEngine().getApplet() == null)
              fis = new FileReader(filename);
            else
              {
                URL url
                  = new URL(context.getEngine().getApplet().getDocumentBase(),
                            vv.get(1).stringValue(context));         
                fis = new InputStreamReader(url.openStream());
              }        
          }
        catch (Exception e)
          {           
            // Try to find a resource file, too.           
            InputStream is = getClass().getClassLoader().getSystemResourceAsStream(filename);
            if (is == null)
              throw new JessException("batch", "Cannot open file", e);
            fis = new InputStreamReader(is);
          }
        Jesp j = new Jesp(fis, context.getEngine());
        do
          {
            v = j.parse(false);
          }
        while (fis.ready());
      }
    catch (IOException ex)
      {
        throw new JessException("batch", "I/O Exception", ex);
      }   
    finally
      {
        if (fis != null) try { fis.close(); } catch (IOException ioe) {}
      }
    return v;
  }
}


=====================================================================
The programmer, like the poet, works only slightly removed from pure
thought-stuff.  He builds castles in the air, from air, creating
by exertion of the imagination.

        - Frederick P. Brooks, Jr.


>-----Original Message-----
>From: Rajaram Subramanian [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 06, 2001 2:49 PM
>To: [EMAIL PROTECTED]
>Subject: JESS: Path of .clp files
>
>
>Hi,
>I have a strong feeling Ernest has already helped me with this, but I
>seem to have deleted that mail. I have a .clp file that i have
>created and
>i am batching it from a Java file. When i want to give
>
>rete.executeCommand("(batch myFile.clp)");
>
>what is the path that Jess will check for the presence of
>myFile.clp? Is
>this path relative to the directory where the corresponding Java class
>file is stored?
>
>Also, is it possible to have the .clp file on a web server and call it
>like this
>
>rete.executeCommand("(batch http://www.../~someone/myFile.clp)");
>
>Is there a problem with the symbol " ~ " ?
>
>Do reply,
>
>Regards,
>Raj.
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
>in the BODY of a message to [EMAIL PROTECTED], NOT to the
>list (use your own address!) List problems? Notify
>[EMAIL PROTECTED]
>---------------------------------------------------------------------
>

-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.2

iQA/AwUBOs5GlkzuKKcxAa+OEQIZvwCfQJ24YnJeOEys32uHwZJTgSyXmIEAoNcl
SfG7UVdARqGYyqh7E1kZ7jfe
=YUK+
-----END PGP SIGNATURE-----

Reply via email to