Recurring willUpdate Notifications Problem

2015-08-11 Thread Henrique Prange
Hey guys,

I’ve been using Wonder’s augmented transaction methods in combination with 
notifications to encourage a loosely coupled design. Over time, I've been 
increasingly applying this kind of solution on my systems. Now, I'm facing a 
problem when expecting to produce notifications for recurring EO changes. 
Basically, I expect the invocation of the willUpdate method on a second EO 
changed during the willUpdate phase of a former EO. However, in that scenario, 
the second EO willUpdate method is never invoked.

I've seen that the CooperatingEditingContext described in the Practical 
WebObjects book does exactly what I want. So, is there a reason to not support 
notifications for recurring changes (i.e. avoid notification cycles)? Is the 
current behavior expected? Or is it a misbehavior?

Cheers,

Henrique
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: EOF and optimizing Oracle sequence generation

2015-08-11 Thread Ruggentaler, JR
Below is our Oracle extension of EROraclePlugIn and ERXJDBCAdaptor. I overrode 
method JDBCAdaptor.newPrimaryKeys() to cache primary keys and reduce database 
roundtrips to get the sequence’s NEXTVAL. The code also contains some other 
Oracle specific features like storing the pid and app name in Oracle’s 
v$session…

I would like to add code to determine the sequence INCREMENT_BY value rather 
than depending on the developer and or DBA to update the Oracle sequence value 
and Entity.userInfo dictionary (ERXPrimaryKeyBatchSize #).

Does any one have an example of executing a select from ERXJDBCAdaptor (SELECT 
INCREMENT_BY FROM ALL_SEQUENCES WHERE SEQUENCE_NAME = '_SEQ';)?

public class MYOraclePlugIn extends EROraclePlugIn {

public MYOraclePlugIn(JDBCAdaptor adaptor) {
super(adaptor);
}

protected Class defaultExpressionClass;

/* (non-Javadoc)
 * @see com.webobjects.jdbcadaptor.JDBCPlugIn#defaultExpressionClass()
 */
public Class defaultExpressionClass() {
if (defaultExpressionClass == null) {
if (MYOracleExpression.isFetchLimitSupportEnabled()) {
defaultExpressionClass = 
MYOracleExpression.class;  
} else {
defaultExpressionClass = OracleExpression.class;
}
}

return defaultExpressionClass;
}

/**
 * Overriden to augment the connection properties to enable the DBA to 
see the application name 
 * and PID for WO5 apps.
 */
@Override
public Properties 
connectionPropertiesForConnectionDictionary(@SuppressWarnings("rawtypes") 
NSDictionary nsdictionary) {
Properties properties = 
super.connectionPropertiesForConnectionDictionary(nsdictionary);

// Oracle specific properties
if (properties != null) {
String pid = "" + System_Additions.processID();
String processName = System_Additions.processName();
Number port = System_Additions.port();
String host = System_Additions.hostName();

String program = processName + ":" + port + "@" + host;

if (program.length() > 41) {
program = StringUtils.truncate(program, 41, "");
}

if (null != processName) {
properties.put("v$session.program", program);
}

if (null != pid) {
properties.put("v$session.process", pid);
}

Boolean isBackgroundTask = (Boolean) 
ERXThreadStorage.valueForKey(MYTask.IS_BACKGROUND_TASK_KEY);
if (isBackgroundTask != null) {
properties.put("v$session.program", program + 
"-job");
}
}

return properties;
}

/**
 * The whole purpose of this MYJDBCAdaptorPatch class is to expose 
 * the JDBCAdaptor's _cachedContext protected i-var.  This allows the
 * plugin's jdbcInfo() method to access this cached context object
 * and close it after using it to fetch the JDBC info.
 */
public static class MYJDBCAdaptorPatch extends ERXJDBCAdaptor {

public MYJDBCAdaptorPatch(String name) {
super(name);
}

public JDBCContext cachedAdaptorContext() {
return (JDBCContext) this.createAdaptorContext();
}
}

/** 
 * Overrides method jdbcInfo() in order to close the database connection
 * used to fetch the JDBC info.
 */
@Override
public NSDictionary jdbcInfo() {
NSDictionary jdbcInfo;

// Just in case two different adaptors share the same plug-in 
and this
// method happens to get called by different threads it seems 
like a
// good idea to guard this code that swaps out the _adaptor 
i-var
// so that the _adaptor is not restored by the other thread 
while in
// the middle of doing this.

synchronized(this) {
// Remember the current adaptor
JDBCAdaptor adaptor = _adaptor;

// Instantiate and setup our adaptor patch that gives 
us access to  
// the object used to fetch the

RE: Gradle and Eclipse

2015-08-11 Thread Beatty, Daniel D CIV NAVAIR, 474300D
Hi gang,
For those of us not cool enough to come, do you have a podcast or something to 
enlighten us on Gradle?Also, do you have solutions for the highly security 
conscious, or at least those who have to stay out of trouble and want to be 
cool.

V/R,

Daniel Beatty, Ph.D., 
IEEE Certified Software Development Professional (CSDP)
Computer Scientist
Code 474300D
1 Administration Circle. M/S 1109
China Lake, CA 93555
daniel.bea...@navy.mil
(760)939-7097 




-Original Message-
From: webobjects-dev-bounces+daniel.beatty=navy@lists.apple.com 
[mailto:webobjects-dev-bounces+daniel.beatty=navy@lists.apple.com] On 
Behalf Of Yoann Canal
Sent: Tuesday, August 11, 2015 1:52 AM
To: Dennis Bliefernicht; WebObjects Development
Subject: Re: Gradle and Eclipse

Hi Dennis and thanks for your reply.

On 11/08/15 08:49, Dennis Bliefernicht wrote:


Hi, 


On 10 Aug 2015, at 16:25, Yoann Canal < 
 yca...@sophiacom.fr> wrote:

Hi all,

After the WOWODC and Dennis' talk, we started to migrate our 
build system to use gradle.
The build works well on our staging servers. We had to modify 
the gradle-wonder-plugin to fit our needs
and might issue a pull request if someone is interested.



Always welcome :-) Out of curiosity: what kind of changes?


- download woproject.jar only once instead of once per framework
- remove reference to nexus.xyrality.net
- remove postgres dependencies
- allow setting webobjectsVersion / wonderVersion before applying the plugin 
since automatically added frameworks will use the default versions otherwise

Some other stuff that would probably only be of interest to us:
- use a fixed name for the generated tar.gz to have a fixed archive URL in 
Jenkins
- don't resolve wounit dependencies since it gets outdated jars

You can take a look at https://github.com/Sophiacom/gradle-wonder-plugin for 
those changes.


However, we can't run the eclipse projects as generated with 
gradle:
projects are correctly imported and built, tests run fine but 
running the project itself inside eclipse with WOLips results in:

[2015-8-10 16:14:34 CEST]  Couldn't load properties file: 
/Users/ycanal/WebObjects.properties at path: /Users/ycanal
[2015-8-10 16:14:34 CEST]  Unable to initialize 
WOProperties for reason: Cannot find JavaWebObjects framework ! 
java.lang.IllegalStateException: Unable to locate the "JavaWebObjects" bundle
[2015-8-10 16:14:34 CEST]  A fatal exception occurred: 
: Cannot be initialized.
[2015-8-10 16:14:34 CEST]  
com.webobjects.foundation.NSForwardException [java.lang.IllegalStateException] 
Unable to locate the "JavaWebObjects" bundle:: Cannot be 
initialized.
   at 
com.webobjects.appserver.WOApplication.(WOApplication.java:918)
   at 
er.extensions.appserver.ajax.ERXAjaxApplication.(ERXAjaxApplication.java:30)
   at 
er.extensions.appserver.ERXApplication.(ERXApplication.java:1097)
   at 
fr.sophiacom.corason.foundation.appserver.COCoreApplication.(COCoreApplication.java:22)
   at 
fr.sophiacom.app.NRApplication.(NRApplication.java:19)
   at fr.sophiacom.app.Application.(Application.java:30)
   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at 
java.lang.reflect.Constructor.newInstance(Constructor.java:422)
   at java.lang.Class.newInstance(Class.java:442)
   at 
com.webobjects.appserver.WOApplication.main(WOApplication.java:547)
   at 
er.extensions.appserver.ERXApplication.main(ERXApplication.java:866)
   at fr.sophiacom.app.Application.main(Application.java:25)
Caused by: java.lang.IllegalStateException: Unable to locate 
the "JavaWebObjects" bundle
   at 
com.webobjects.appserver.WOResourceManager.__getJavaWebObjectsResourceAsStream(WOResourceManager.java:131)
   at 
com.webobjects.appserver._private.WOProperties.initUserDefaultsKeys(WOProperties.java:317)
   at 
com.webobjects.appserver.WOApplication._initWOApp(WOApplication.java:5743)
   at 
com.webobjects.appserver.WOApplication.(WOApplication.java:779)
   ... 13 more

Do you have any idea how to fix that ?
Right now we are still keeping our old .project / build.xml 
/.classpath but we would like to avoid maintaining 2 configurations.




Re: Gradle and Eclipse

2015-08-11 Thread Yoann Canal

Hi Dennis and thanks for your reply.

On 11/08/15 08:49, Dennis Bliefernicht wrote:

Hi,

On 10 Aug 2015, at 16:25, Yoann Canal > wrote:


Hi all,

After the WOWODC and Dennis' talk, we started to migrate our build 
system to use gradle.
The build works well on our staging servers. We had to modify the 
gradle-wonder-plugin to fit our needs

and might issue a pull request if someone is interested.


Always welcome :-) Out of curiosity: what kind of changes?


- download woproject.jar only once instead of once per framework
- remove reference to nexus.xyrality.net
- remove postgres dependencies
- allow setting webobjectsVersion / wonderVersion before applying the 
plugin since automatically added frameworks will use the default 
versions otherwise


Some other stuff that would probably only be of interest to us:
- use a fixed name for the generated tar.gz to have a fixed archive URL 
in Jenkins

- don't resolve wounit dependencies since it gets outdated jars

You can take a look at https://github.com/Sophiacom/gradle-wonder-plugin 
for those changes.

However, we can't run the eclipse projects as generated with gradle:
projects are correctly imported and built, tests run fine but running 
the project itself inside eclipse with WOLips results in:


[2015-8-10 16:14:34 CEST]  Couldn't load properties file: 
/Users/ycanal/WebObjects.properties at path: /Users/ycanal
[2015-8-10 16:14:34 CEST]  Unable to initialize WOProperties 
for reason: Cannot find JavaWebObjects framework ! 
java.lang.IllegalStateException: Unable to locate the 
"JavaWebObjects" bundle
[2015-8-10 16:14:34 CEST]  A fatal exception occurred: 
: Cannot be initialized.
[2015-8-10 16:14:34 CEST]  
com.webobjects.foundation.NSForwardException 
[java.lang.IllegalStateException] Unable to locate the 
"JavaWebObjects" bundle:: Cannot be initialized.
   at 
com.webobjects.appserver.WOApplication.(WOApplication.java:918)
   at 
er.extensions.appserver.ajax.ERXAjaxApplication.(ERXAjaxApplication.java:30)
   at 
er.extensions.appserver.ERXApplication.(ERXApplication.java:1097)
   at 
fr.sophiacom.corason.foundation.appserver.COCoreApplication.(COCoreApplication.java:22)

   at fr.sophiacom.app.NRApplication.(NRApplication.java:19)
   at fr.sophiacom.app.Application.(Application.java:30)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

   at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
   at java.lang.Class.newInstance(Class.java:442)
   at com.webobjects.appserver.WOApplication.main(WOApplication.java:547)
   at 
er.extensions.appserver.ERXApplication.main(ERXApplication.java:866)

   at fr.sophiacom.app.Application.main(Application.java:25)
Caused by: java.lang.IllegalStateException: Unable to locate the 
"JavaWebObjects" bundle
   at 
com.webobjects.appserver.WOResourceManager.__getJavaWebObjectsResourceAsStream(WOResourceManager.java:131)
   at 
com.webobjects.appserver._private.WOProperties.initUserDefaultsKeys(WOProperties.java:317)
   at 
com.webobjects.appserver.WOApplication._initWOApp(WOApplication.java:5743)
   at 
com.webobjects.appserver.WOApplication.(WOApplication.java:779)

   ... 13 more

Do you have any idea how to fix that ?
Right now we are still keeping our old .project / build.xml 
/.classpath but we would like to avoid maintaining 2 configurations.


How did you import the project exactly? Did you keep the old .project 
and .classpath around for that or did you do a fresh import using the 
gradle plugin? There could be some issue with the classpath, if the 
old files are around, best would be to have gradle generate new ones. 
Have a look at the project properties -> Build path, there should be 
no more references to WO libraries but only to JARs in 
yourhomefolder/.gradle/ (see attachment), even for all the frameworks.
We tried to use gradle + eclipse in a new workspace after a "gradle 
cleanEclipse eclipse" so the generated .classpath only reference .jar as 
in your screenshot.
It may be a missing (runtime)dependency but the exception is not really 
helpful :(

Greetings
Dennis

Yoann
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com