Re: EditingContext Newbiee Question

2008-08-02 Thread Jeff Schmitz

Hi Dave,
   Regarding your comments on ERXEC (which I am using in all my EO's,  
or at least all my EO's extend ERXGenericRecord):



I always create new ECs for any task that is going to require editing.

Using Project Wonder's ERXEC makes this particularly painless as it  
handles the necessary EC locking automagically.


I have a long running background task.  If I do as suggested here:


In the task method itself:
	- Create a new ObjectStoreCoordinator (use Wonder OSC  
synchronization if you want changes to propogate)

- Create any editing contexts using that single task OSC as a parent
- lock and unlock your ec's manually when working with them


Since I'm using ERXEC, should I be able to get away with NOT locking  
and unlocking my ec's manually?  What if I don't create a new  
ObjectStoreCoordinator for the background task?


Thanks,
Jeff

On Aug 1, 2008, at 10:22 PM, David LeBer wrote:



On 1-Aug-08, at 8:33 PM, Gustavo Pizano wrote:

Hello everyone, I just wanted to ask a noob question. Everywhere I  
look I see about the EditingConext, as I know, it function its to  
hold instances of the EO's so they can interact each other and so.
in the tutorials and the documentations, they talk most of the part  
about the defaultEditingContext, from the session, or the  
apllication, so my question is, when its necessary to use the  
defaultEditingContext, and  to create a new one?.

This thing about the EditingContext its spining my head a little.


Tutorials generally don't use anything other than the  
defaultEditingContext because it adds a layer of complexity that the  
authors (I assume) feel will detract from the core purpose of the  
tutorial.


However, this tends to give beginners a false impression of how most  
real-world applications are written and also fails to demonstrate  
the pitfalls of a single EC design.


Lets take a (completely contrived) example:

Your application is using the defaultEditingContext. Your user  
enters a form that creates a new EO. Half way through they decide to  
abort and hit the back button a couple of times and go somewhere  
else in the site.


The defaultEditingContext is now dirtied with that new EO. If the  
user later performs any action that calls saveChanges on the  
defaultEC it will try and commit the EO, it might fail giving your  
user a completely unexplainable validation error, or it might  
succeed saving unwanted and probably invalid data.


So my general rule of thumb is to never use the  
defaultEditingContext for any edit actions. I always create new ECs  
for any task that is going to require editing.


Using Project Wonder's ERXEC makes this particularly painless as it  
handles the necessary EC locking automagically.


Other options are documented here: http://wiki.objectstyle.org/confluence/display/WO/EOF-Using+EOF-Context+and+Database+Locking 



;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog:   http://davidleber.net
profile:http://www.linkedin.com/in/davidleber
twitter:http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jeffandmonica%40mac.com

This email sent to [EMAIL PROTECTED]


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: EditingContext Newbiee Question

2008-08-02 Thread Gustavo Pizano

Ok so let's say I have this

try {

session().defaultEditingContext().saveChanges();
} catch (ValidationException e) {
setErrorMsgs(e.getMessage());
} catch (EOGeneralAdaptorException e) {
setErrorMsgs(e.getMessage());
}



Using the ERXEC how should it be then?

Im asking this for a couple of reasons, first of all when i started to  
learn WO, I asked what would be a better start, from WO, or from  
WOnder, it was huge discussion, but my final conclusion was that i can  
start with Wonder due the things it provides me.



Im doing the LicensePlate tutorial but with Wonder, I did it already  
with WO, so I want to see the differences form Wonder and WO in this  
tutorial.


Regards

Gus



On Aug 1, 2008, at 11:22 PM, David LeBer wrote:



On 1-Aug-08, at 8:33 PM, Gustavo Pizano wrote:

Hello everyone, I just wanted to ask a noob question. Everywhere I  
look I see about the EditingConext, as I know, it function its to  
hold instances of the EO's so they can interact each other and so.
in the tutorials and the documentations, they talk most of the part  
about the defaultEditingContext, from the session, or the  
apllication, so my question is, when its necessary to use the  
defaultEditingContext, and  to create a new one?.

This thing about the EditingContext its spining my head a little.


Tutorials generally don't use anything other than the  
defaultEditingContext because it adds a layer of complexity that the  
authors (I assume) feel will detract from the core purpose of the  
tutorial.


However, this tends to give beginners a false impression of how most  
real-world applications are written and also fails to demonstrate  
the pitfalls of a single EC design.


Lets take a (completely contrived) example:

Your application is using the defaultEditingContext. Your user  
enters a form that creates a new EO. Half way through they decide to  
abort and hit the back button a couple of times and go somewhere  
else in the site.


The defaultEditingContext is now dirtied with that new EO. If the  
user later performs any action that calls saveChanges on the  
defaultEC it will try and commit the EO, it might fail giving your  
user a completely unexplainable validation error, or it might  
succeed saving unwanted and probably invalid data.


So my general rule of thumb is to never use the  
defaultEditingContext for any edit actions. I always create new ECs  
for any task that is going to require editing.


Using Project Wonder's ERXEC makes this particularly painless as it  
handles the necessary EC locking automagically.


Other options are documented here: http://wiki.objectstyle.org/confluence/display/WO/EOF-Using+EOF-Context+and+Database+Locking 



;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog:   http://davidleber.net
profile:http://www.linkedin.com/in/davidleber
twitter:http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org






 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

com.webobjects.appserver.WOApplication opening?

2008-08-02 Thread Gustavo Pizano
Hello, Again when running the tutorial im doing, and clicking the  
submit button the com.webobjects.appserver.WOApplication opens as a  
java application, I dont rememebr thgis to be happening before, am I  
doing something bad?


regards
Gustavo

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


ant for embedding projects

2008-08-02 Thread Florijan Stamenkovic

Hi all,

Not a question...

I've been playing around with modifying the ant described in:

http://wiki.objectstyle.org/confluence/display/WOL/Embedding 
+WOFrameworks


Primarily I wanted to get rid of having to declare project  
dependencies in build.xml files, coz that's just dirty. So, what I've  
done was add this to the build.xml:


	!-- This is optional, it installs the framework projects, normally  
into wolocalroot/Library/Frameworks --

target name=install.projects
subant target=install
dirset dir=${projects.root}
includesfile 
name=woproject/ant.frameworks.projects/
/dirset
/subant
/target

!-- in the build.woapp target --
frameworks root=${wo.wolocalroot} 
embed=${embed.projects}
patternset
includesfile 
name=woproject/ant.frameworks.projects /
/patternset
/frameworks

!-- in the compile target --
frameworks root=${wo.wolocalroot}
patternset
includesfile 
name=woproject/ant.frameworks.projects /
/patternset
/frameworks

The build, compileAndBuild and install targets add an  
install.projects dependency, just after the init.xxx dependency.


Additionally two properties are required in the build.properties:
projects.root=../
embed.projects=true

And a file named ant.frameworks.projects in the wobuild folder, that  
looks like this:


FrameworkName1
Library/Frameworks/FrameworkName1.framework
Framework2
Library/Frameworks/Framework2.framework

An ugly point is that each framework needs to be added twice to the  
file, once just it's name, which will point to the project directory  
in Eclipse's workspace in the subant, and once as Library/Frameworks/ 
xxx.framework, which is used in build.woapp and compile targets. If  
anyone knows how filesets can be modified based on an includesfile  
(for example the includesfile declares Name, but we exrapolate  
Name.framework from it, please let me know.


This (from my tests) seems to be working good, and one does not have  
to modify the ant anymore when adding project dependencies, they just  
need to be added to the ant.frameworks.projects file.


Also, one might want to add a target which will delete all the  
installed frameworks from wolocalroot lib, to clean things up.


Hope this is interesting to someone,
F
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


WOText Escape HTML Broken?

2008-08-02 Thread Mr. Frank Cobia
The escapeHTML binding has not effect on WOText (or ERXWOText). Is  
this the way it is supposed to behave or is it broken. I am using WO  
5.4.2 on Mac OS.


As a follow up question, whether it is broken or not, is there a way  
for me to create a textarea without the HTML being escaped? All I am  
really looking for is to insert br into the text.


Thanks,
Frank
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: WO5.4 Web Services - Application not responding

2008-08-02 Thread Chandrashekhar Tupe
Hi David,To make sure of this I ran sample self contained WO 5.4 WebObjects Hello World Application and didnt get any issue accessing the same.Thread dump while accessing the web service application.WorkerThreadsare "waiting for monitor entry" per this.Full thread dump Java HotSpot(TM) Server VM (1.5.0_13-121 mixed mode):

WorkerThread15 prio=5 tid=0x0061eb30 nid=0x19a2e00 waiting for monitor entry 
[0xb161c000..0xb161cd10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread14 prio=5 tid=0x0061e720 nid=0x19a2a00 waiting for monitor entry 
[0xb159b000..0xb159bd10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread13 prio=5 tid=0x0061e270 nid=0x19a2600 waiting for monitor entry 
[0xb151a000..0xb151ad10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread12 prio=5 tid=0x0061ddc0 nid=0x19a2200 waiting for monitor entry 
[0xb1499000..0xb1499d10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread11 prio=5 tid=0x0061d910 nid=0x19a1e00 waiting for monitor entry 
[0xb1418000..0xb1418d10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread10 prio=5 tid=0x0061d460 nid=0x19a1a00 waiting for monitor entry 
[0xb1397000..0xb1397d10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread9 prio=5 tid=0x0061cfb0 nid=0x19a1600 waiting for monitor entry 
[0xb1316000..0xb1316d10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread8 prio=5 tid=0x0061cb00 nid=0x199b600 waiting for monitor entry 
[0xb1295000..0xb1295d10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread7 prio=5 tid=0x0061c650 nid=0x199b200 waiting for monitor entry 
[0xb1214000..0xb1214d10]
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:382)
- waiting to lock 0x080462a8 (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at 
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:210)
at java.lang.Thread.run(Thread.java:613)

WorkerThread6 prio=5 tid=0x0061c1a0 nid=0x199ae00 waiting for monitor entry 
[0xb1193000..0xb1193d10]
   

Re: EditingContext Newbiee Question

2008-08-02 Thread Lachlan Deck

On 02/08/2008, at 11:46 PM, Jeff Schmitz wrote:


Hi Dave,
  Regarding your comments on ERXEC (which I am using in all my EO's,  
or at least all my EO's extend ERXGenericRecord):


I always create new ECs for any task that is going to require  
editing.


Using Project Wonder's ERXEC makes this particularly painless as it  
handles the necessary EC locking automagically.


I have a long running background task.  If I do as suggested here:


In the task method itself:
	- Create a new ObjectStoreCoordinator (use Wonder OSC  
synchronization if you want changes to propogate)

- Create any editing contexts using that single task OSC as a parent
- lock and unlock your ec's manually when working with them


Since I'm using ERXEC, should I be able to get away with NOT locking  
and unlocking my ec's manually?


You need to handle locking for background threads seeing as they're  
not related to a request/response loop - but a background thread.


What if I don't create a new ObjectStoreCoordinator for the  
background task?


Doesn't matter. That's a separate question.

with regards,
--

Lachlan Deck



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: EditingContext Newbiee Question

2008-08-02 Thread Lachlan Deck

Hi Gustavo,

On 03/08/2008, at 12:37 AM, Gustavo Pizano wrote:


Ok so let's say I have this

try {

session().defaultEditingContext().saveChanges();
} catch (ValidationException e) {
setErrorMsgs(e.getMessage());
} catch (EOGeneralAdaptorException e) {
setErrorMsgs(e.getMessage());
}

Using the ERXEC how should it be then?


Exactly the same.

However with non-defaultEditing contexts you need (if not using ERX  
ecs) to handle locking/unlocking also (which can be tricky sometimes  
with ensuring your contexts are locked for access (e.g., during  
component.awake() and perhaps your opportunity to unlock doesn't get  
called because of some exception).


ec = newEditingContext();
ec.lock();
try {


finally
{
ec.unlock();
}

Im asking this for a couple of reasons, first of all when i started  
to learn WO, I asked what would be a better start, from WO, or from  
WOnder, it was huge discussion, but my final conclusion was that i  
can start with Wonder due the things it provides me.


Good choice.

Im doing the LicensePlate tutorial but with Wonder, I did it already  
with WO, so I want to see the differences form Wonder and WO in this  
tutorial.


It's really too early for you to make the decision as to whether it's  
worth using Wonder based on a beginners tutorial. Take the advice of  
more experienced devs on this one. It'll pay off.


with regards,
--

Lachlan Deck

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]