Re: Pure Swing + EOF distribution channel
"Pierre Gilquin" <[email protected]> Tue, 8 Nov 2005 19:24:04 +0100
| Newsgroups | gmane.comp.web.webobjects.eof |
|---|---|
| Message-ID | <[email protected]> |
Hi Florijan, I succeed to do what you are trying with lots of help from Jonathan Rochkind. You can find the exchange in the webobjects-dev Omni. Well... it seems broken right now !. Tell me if you are not able to find the info. Good luck. Pierre ----- Original Message ----- From: "Florijan Stamenkovic" <[email protected]> To: "EOF at Omni" <[email protected]> Sent: Tuesday, November 08, 2005 6:36 PM Subject: Pure Swing + EOF distribution channel > Hi, > > > I am trying to get a Swing application running and connecting to an EOF > AppServer. I am trying to do it in a way that I have all and Swing only > UI control. No nibs, no rules, no XML, all written in Swing and a part of > the distributed desktop application. > > The only lead Apple gives on this kind of applications is a two page > how-to that describes how to make a Swing project, add the client side > EOF jars, add an application URL property, and set the main class of the > app to: > com.webobjects.eoapplication.client.EOClientAppplicationSupport > > This approach results in the app turning all the control to > EOClientApplicationSupport, which then establishes a distribution > channel, but also generates the UI and sends it back to the client. As > described, this is NOT what I try to achieve. > > I was tampering with skipping the switching of the main class of the app > to EOClientApplicationSupport, and tried to establish a connection in my > own code (see below). Did manage to get a distribution channel running, > made a distributed object store and an editing context that took it as > it's parent, but when trying to fetch data I get the exception (below) ON > THE APPLICATION SERVER project (that is running in the background so I > could connect to from the Swing app). > > ANY kind of help would be very welcome as the only documentation I can > find on the issue is EOF API reference. Is there a way to use EOF and > it's ClientApplicationSupport without giving all the control to the > standard JC handling? > > > App server exception: > ------------------------ > [2005-11-08 14:10:53 CET] <WorkerThread9> <WOWorkerThread id=9 > socket=Socket[addr=/192.168.25.46,port=55839,localport=55710]> Exception > while creating request: java.lang.IllegalArgumentException: > <com.webobjects.appserver.WORequest>: No URL was provided.; dropping > connection > [2005-11-08 14:10:53 CET] <WorkerThread9> > java.lang.IllegalArgumentException: <com.webobjects.appserver.WORequest>: > No URL was provided. > at com.webobjects.appserver.WORequest.<init>(WORequest.java:212) > at > com.webobjects.appserver.WOApplication.createRequest(WOApplication.java: > 1734) > at > com.webobjects.appserver._private.WOHttpIO.readRequestFromSocket(WOHttpI > O.java:345) > at > com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread. > java:79) > at > com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java > :254) > at java.lang.Thread.run(Thread.java:552) > > > > > My client side app code (main class of the test app): > ------------------------------- > import java.awt.*; > import java.awt.event.*; > > import javax.swing.*; > > import com.webobjects.foundation.*; > import com.webobjects.eocontrol.*; > import com.webobjects.eoapplication.*; > import com.webobjects.eodistribution.client.*; > > import client.*; //EOs > > > public class JCTestClient extends JFrame { > public JCTestClient() { > > super(""); > > //set the distribution channel > EODistributionChannel c = setupDistributionChannel(); // below > EODistributedObjectStore doc = new EODistributedObjectStore(c); > EOEditingContext ec = new EOEditingContext(doc); > > //fetch some data > printSomeData(ec); > > setSize(640, 480); > setVisible(true); > } > > > public static void main(String args[]) { > new JCTestClient(); > } > > private EODistributionChannel setupDistributionChannel(){ > > //create the connection dictionary > NSMutableDictionary cd = new NSMutableDictionary(); > cd.setObjectForKey("http://hijkl.local:55710/cgi-bin/WebObjects/ > JCTestAppServer.woa", "applicationURL"); //direct connect, changes > every app server run > cd.setObjectForKey("", "componentURL"); > cd.setObjectForKey("", "sessionID"); > cd.setObjectForKey("", "page"); > > //get the channel > EODistributionChannel e = > com.webobjects.eodistribution.client.EODistributionChannel.channelWithNa > me( > "com.webobjects.eodistribution.client.EOHTTPChannel"); > > //set the dictionary > e.setConnectionDictionary(cd); > > e.establishConnection(); > return e; > } > > private void printSomeData(EOEditingContext ec){ > EOFetchSpecification fs = new EOFetchSpecification("Student", null, > null); > Object[] students = ec.objectsWithFetchSpecification(fs).objects(); > for(int i = 0 ; i < students.length ; i++){ > System.out.println(students[i]); > } > } > } > > _______________________________________________ > EOF mailing list > [email protected] > http://www.omnigroup.com/mailman/listinfo/eof