Thread: [Jstyx-users] question about CStyx.openOrCreate()
Status: Beta
Brought to you by:
jonblower
From: Tianchao Li <li...@in...> - 2006-05-11 16:46:18
|
Hi, I have some problem with the correct usage of CStyx.openOrCreate() method. I have started the following server: import java.io.IOException; import uk.ac.rdg.resc.jstyx.StyxException; import uk.ac.rdg.resc.jstyx.server.DirectoryOnDisk; import uk.ac.rdg.resc.jstyx.server.StyxDirectory; import uk.ac.rdg.resc.jstyx.server.StyxServer; public class TestStyxServer { /** * @param args */ public static void main(String[] args) { StyxDirectory root; try { root = new StyxDirectory("/"); DirectoryOnDisk file = new DirectoryOnDisk("/home/lit/styxfilesystem"); root.addChild(file); new StyxServer(9876, root).start(); } catch (StyxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } and the following client: import uk.ac.rdg.resc.jstyx.StyxException; import uk.ac.rdg.resc.jstyx.StyxUtils; import uk.ac.rdg.resc.jstyx.client.CStyxFile; import uk.ac.rdg.resc.jstyx.client.StyxConnection; public class TestStyxClient { /** * @param args */ public static void main(String[] args) { StyxConnection conn = new StyxConnection("localhost", 9876); try { conn.connect(); CStyxFile file = conn.getFile("/styxfilesystem/test.txt"); file.openOrCreate(true, StyxUtils.OWRITE); System.out.println(file.getURL()); } catch (StyxException se) { se.printStackTrace(); } finally { conn.close(); } } } The client is blocked at file.openOrCreate(). Or more exactly, the callback.getReply() never returns. public void openOrCreate(boolean isDirectory, int mode) throws StyxException { StyxReplyCallback callback = new StyxReplyCallback(); this.openOrCreateAsync(isDirectory, mode, callback); // Blocks until the process is complete callback.getReply(); } Is this a bug? Regards, Tianchao Li |
From: Tianchao Li <li...@in...> - 2006-05-11 17:58:27
|
The problem only occurs if the first parameter is true (i.e. directory) file.openOrCreate(true, StyxUtils.OWRITE); Best regards, Tianchao Li On Thu, 2006-05-11 at 12:41 -0400, Tianchao Li wrote: > Hi, > > I have some problem with the correct usage of CStyx.openOrCreate() > method. > > I have started the following server: > import java.io.IOException; > > import uk.ac.rdg.resc.jstyx.StyxException; > import uk.ac.rdg.resc.jstyx.server.DirectoryOnDisk; > import uk.ac.rdg.resc.jstyx.server.StyxDirectory; > import uk.ac.rdg.resc.jstyx.server.StyxServer; > > > public class TestStyxServer { > > /** > * @param args > */ > public static void main(String[] args) { > > StyxDirectory root; > try { > root = new StyxDirectory("/"); > DirectoryOnDisk file = new > DirectoryOnDisk("/home/lit/styxfilesystem"); > root.addChild(file); > new StyxServer(9876, root).start(); > } catch (StyxException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > } > > and the following client: > > import uk.ac.rdg.resc.jstyx.StyxException; > import uk.ac.rdg.resc.jstyx.StyxUtils; > import uk.ac.rdg.resc.jstyx.client.CStyxFile; > import uk.ac.rdg.resc.jstyx.client.StyxConnection; > > > public class TestStyxClient { > > /** > * @param args > */ > public static void main(String[] args) { > StyxConnection conn = new StyxConnection("localhost", 9876); > try > { > conn.connect(); > CStyxFile file = conn.getFile("/styxfilesystem/test.txt"); > file.openOrCreate(true, StyxUtils.OWRITE); > System.out.println(file.getURL()); > } > catch (StyxException se) > { > se.printStackTrace(); > } > finally > { > conn.close(); > } > > } > > } > > The client is blocked at file.openOrCreate(). Or more exactly, the > callback.getReply() never returns. > > public void openOrCreate(boolean isDirectory, int mode) throws > StyxException > { > StyxReplyCallback callback = new StyxReplyCallback(); > this.openOrCreateAsync(isDirectory, mode, callback); > // Blocks until the process is complete > callback.getReply(); > } > > > Is this a bug? > > Regards, > Tianchao Li > > |
From: Jon B. <jd...@ma...> - 2006-05-12 11:32:08
Attachments:
OpenOrCreateCallback.java
|
Hi Tianchao, Thanks for reporting this so clearly. There is indeed a bug in the OpenOrCreateCallback class. The fix will be checked into the SVN repository later, but in the meantime I've attached the corrected version. Actually, according to the rules of Styx you should create directories with read permissions only. Therefore your call: file.openOrCreate(true, StyxUtils.OWRITE); will return an error (although in the buggy version it went into an infinite loop). You should do this: file.openOrCreate(true, StyxUtils.OREAD); This may seem counter-intuitive but is logical. The StyxUtils.OREAD is the *mode* under which the newly-created directory is opened, not the *permissions* of the directory. It is not legal to write to directories so it is not legal to open them with mode OWRITE. You can create new files in the newly-created directory as normal. Perhaps I should change the API to something more intuitive... Jon > -----Original Message----- > From: jst...@li... > [mailto:jst...@li...] On Behalf Of > Tianchao Li > Sent: 11 May 2006 18:54 > To: jst...@li... > Subject: [Jstyx-users] Re: question about CStyx.openOrCreate() > > The problem only occurs if the first parameter is true (i.e. > directory) > > file.openOrCreate(true, StyxUtils.OWRITE); > > Best regards, > Tianchao Li > > On Thu, 2006-05-11 at 12:41 -0400, Tianchao Li wrote: > > Hi, > > > > I have some problem with the correct usage of CStyx.openOrCreate() > > method. > > > > I have started the following server: > > import java.io.IOException; > > > > import uk.ac.rdg.resc.jstyx.StyxException; > > import uk.ac.rdg.resc.jstyx.server.DirectoryOnDisk; > > import uk.ac.rdg.resc.jstyx.server.StyxDirectory; > > import uk.ac.rdg.resc.jstyx.server.StyxServer; > > > > > > public class TestStyxServer { > > > > /** > > * @param args > > */ > > public static void main(String[] args) { > > > > StyxDirectory root; > > try { > > root = new StyxDirectory("/"); > > DirectoryOnDisk file = new > > DirectoryOnDisk("/home/lit/styxfilesystem"); > > root.addChild(file); > > new StyxServer(9876, root).start(); > > } catch (StyxException e) { > > // TODO Auto-generated catch block > > e.printStackTrace(); > > } catch (IOException e) { > > // TODO Auto-generated catch block > > e.printStackTrace(); > > } > > } > > > > } > > > > and the following client: > > > > import uk.ac.rdg.resc.jstyx.StyxException; > > import uk.ac.rdg.resc.jstyx.StyxUtils; import > > uk.ac.rdg.resc.jstyx.client.CStyxFile; > > import uk.ac.rdg.resc.jstyx.client.StyxConnection; > > > > > > public class TestStyxClient { > > > > /** > > * @param args > > */ > > public static void main(String[] args) { > > StyxConnection conn = new StyxConnection("localhost", 9876); > > try > > { > > conn.connect(); > > CStyxFile file = > conn.getFile("/styxfilesystem/test.txt"); > > file.openOrCreate(true, StyxUtils.OWRITE); > > System.out.println(file.getURL()); > > } > > catch (StyxException se) > > { > > se.printStackTrace(); > > } > > finally > > { > > conn.close(); > > } > > > > } > > > > } > > > > The client is blocked at file.openOrCreate(). Or more exactly, the > > callback.getReply() never returns. > > > > public void openOrCreate(boolean isDirectory, int mode) throws > > StyxException > > { > > StyxReplyCallback callback = new StyxReplyCallback(); > > this.openOrCreateAsync(isDirectory, mode, callback); > > // Blocks until the process is complete > > callback.getReply(); > > } > > > > > > Is this a bug? > > > > Regards, > > Tianchao Li > > > > > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web > services, security? > Get stuff done quickly with pre-integrated technology to make > your job easier Download IBM WebSphere Application Server > v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057& > dat=121642 > _______________________________________________ > Jstyx-users mailing list > Jst...@li... > https://lists.sourceforge.net/lists/listinfo/jstyx-users > |
From: Jon B. <jd...@ma...> - 2006-05-16 13:03:18
|
> Actually, according to the rules of Styx you should create > directories with read permissions only. Therefore your call: Sorry, I meant to write that you should create directories and open them with the mode OREAD only. Nothing to do with permissions. > -----Original Message----- > From: jst...@li... > [mailto:jst...@li...] On Behalf Of > Jon Blower > Sent: 12 May 2006 12:32 > To: jst...@li... > Subject: RE: [Jstyx-users] Re: question about CStyx.openOrCreate() > > Hi Tianchao, > > Thanks for reporting this so clearly. There is indeed a bug > in the OpenOrCreateCallback class. The fix will be checked > into the SVN repository later, but in the meantime I've > attached the corrected version. > > Actually, according to the rules of Styx you should create > directories with read permissions only. Therefore your call: > > file.openOrCreate(true, StyxUtils.OWRITE); > > will return an error (although in the buggy version it went > into an infinite loop). You should do this: > > file.openOrCreate(true, StyxUtils.OREAD); > > This may seem counter-intuitive but is logical. The > StyxUtils.OREAD is the > *mode* under which the newly-created directory is opened, not the > *permissions* of the directory. It is not legal to write to > directories so it is not legal to open them with mode OWRITE. > You can create new files in the newly-created directory as normal. > > Perhaps I should change the API to something more intuitive... > > Jon > > > > -----Original Message----- > > From: jst...@li... > > [mailto:jst...@li...] On Behalf > Of Tianchao > > Li > > Sent: 11 May 2006 18:54 > > To: jst...@li... > > Subject: [Jstyx-users] Re: question about CStyx.openOrCreate() > > > > The problem only occurs if the first parameter is true (i.e. > > directory) > > > > file.openOrCreate(true, StyxUtils.OWRITE); > > > > Best regards, > > Tianchao Li > > > > On Thu, 2006-05-11 at 12:41 -0400, Tianchao Li wrote: > > > Hi, > > > > > > I have some problem with the correct usage of > CStyx.openOrCreate() > > > method. > > > > > > I have started the following server: > > > import java.io.IOException; > > > > > > import uk.ac.rdg.resc.jstyx.StyxException; > > > import uk.ac.rdg.resc.jstyx.server.DirectoryOnDisk; > > > import uk.ac.rdg.resc.jstyx.server.StyxDirectory; > > > import uk.ac.rdg.resc.jstyx.server.StyxServer; > > > > > > > > > public class TestStyxServer { > > > > > > /** > > > * @param args > > > */ > > > public static void main(String[] args) { > > > > > > StyxDirectory root; > > > try { > > > root = new StyxDirectory("/"); > > > DirectoryOnDisk file = new > > > DirectoryOnDisk("/home/lit/styxfilesystem"); > > > root.addChild(file); > > > new StyxServer(9876, root).start(); > > > } catch (StyxException e) { > > > // TODO Auto-generated catch block > > > e.printStackTrace(); > > > } catch (IOException e) { > > > // TODO Auto-generated catch block > > > e.printStackTrace(); > > > } > > > } > > > > > > } > > > > > > and the following client: > > > > > > import uk.ac.rdg.resc.jstyx.StyxException; > > > import uk.ac.rdg.resc.jstyx.StyxUtils; import > > > uk.ac.rdg.resc.jstyx.client.CStyxFile; > > > import uk.ac.rdg.resc.jstyx.client.StyxConnection; > > > > > > > > > public class TestStyxClient { > > > > > > /** > > > * @param args > > > */ > > > public static void main(String[] args) { > > > StyxConnection conn = new > StyxConnection("localhost", 9876); > > > try > > > { > > > conn.connect(); > > > CStyxFile file = > > conn.getFile("/styxfilesystem/test.txt"); > > > file.openOrCreate(true, StyxUtils.OWRITE); > > > System.out.println(file.getURL()); > > > } > > > catch (StyxException se) > > > { > > > se.printStackTrace(); > > > } > > > finally > > > { > > > conn.close(); > > > } > > > > > > } > > > > > > } > > > > > > The client is blocked at file.openOrCreate(). Or more exactly, the > > > callback.getReply() never returns. > > > > > > public void openOrCreate(boolean isDirectory, int > mode) throws > > > StyxException > > > { > > > StyxReplyCallback callback = new StyxReplyCallback(); > > > this.openOrCreateAsync(isDirectory, mode, callback); > > > // Blocks until the process is complete > > > callback.getReply(); > > > } > > > > > > > > > Is this a bug? > > > > > > Regards, > > > Tianchao Li > > > > > > > > > > > > > > ------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > > security? > > Get stuff done quickly with pre-integrated technology to > make your job > > easier Download IBM WebSphere Application Server > > v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057& > > dat=121642 > > _______________________________________________ > > Jstyx-users mailing list > > Jst...@li... > > https://lists.sourceforge.net/lists/listinfo/jstyx-users > > > |
From: Tianchao Li <li...@in...> - 2006-05-16 21:58:10
|
I wonder if anybody has checked the interoperability of JStyx with 9p2000 (say v9fs), which might include: JStyx client - v9fs server JStyx server - v9fs client Best regards, Tianchao Li |
From: Tianchao Li <li...@in...> - 2006-05-17 05:39:27
|
If the interoperability of JStyx client with v9fs server is proven, I would suggest to separate the JStyx client from the server and to have as few dependent libraries as possible for the client. Best regards, Tianchao Li Tianchao Li wrote: >I wonder if anybody has checked the interoperability of JStyx with >9p2000 (say v9fs), which might include: >JStyx client - v9fs server >JStyx server - v9fs client > >Best regards, >Tianchao Li > > > > >------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >Jstyx-users mailing list >Jst...@li... >https://lists.sourceforge.net/lists/listinfo/jstyx-users > > > |
From: Jon B. <jd...@ma...> - 2006-05-17 07:18:29
|
I would very much like to see this tested but I don't have an appropriate machine to test it on yet. Has anyone tried this? Assuming it works, yes, we could separate the server and client as you suggest. There are some dependencies that only pertain to the server and some that only pertain to the Styx Grid Services software that is currently bundled with JStyx. This could be refactored so that the client software is as small as possible. I have tested JStyx with Inferno (both with JStyx client/Inferno server and Inferno client/JStyx server) and they interoperate without problems. (At the moment JStyx can't make an authenticated connection to an Inferno server though.) I would therefore be optimistic that JStyx will interoperate with v9fs. Does v9fs support authentication and/or encryption of any kind? Regards, Jon > > If the interoperability of JStyx client with v9fs server is > proven, I would suggest to separate the JStyx client from the > server and to have as few dependent libraries as possible for > the client. > > Best regards, > Tianchao Li > > Tianchao Li wrote: > > >I wonder if anybody has checked the interoperability of JStyx with > >9p2000 (say v9fs), which might include: > >JStyx client - v9fs server > >JStyx server - v9fs client > > > >Best regards, > >Tianchao Li > > |