Re: Pure Swing JavaClient distribution channel
Re: Pure Swing JavaClient distribution channel
- Subject: Re: Pure Swing JavaClient distribution channel
- From: Marek Wawrzyczny <email@hidden>
- Date: Wed, 9 Nov 2005 10:20:33 +1100
Hi Florijan,
Shouldn't you still subclass the EOClientApplicationSupport for your main application class?
What happens if no UI classes are specified? Do you get an exception? Does the distribution channel get initialized?
Unless not having the NIB UI is a problem, it seems to me that you can still write your own MVC classes and your own GUI and instantiate it in the main function of the EOClientApplicationSupport subclass. The you get the benefit of Apple frameworks maintaining the complexities (if there are any) of initializing and handling the EOF framework. The API doesn't hint much at what's going beneath the surface.
Otherwise, using your method it seem you're not initializing the connection dictionary of EODistributedObjectStore prior to using it.
On 09/11/2005, at 1:30 AM, Florijan Stamenkovic wrote:
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(WOHttpIO.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.channelWithName(
"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]);
}
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Marek Wawrzyczny
software engineer
-------------------------->
ish group
http://www.ish.com.au
Level 1, 30 Wilson Street
Newtown 2042 Sydney Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden