From: <tc...@us...> - 2008-11-14 22:05:30
|
Revision: 8611 http://wonder.svn.sourceforge.net/wonder/?rev=8611&view=rev Author: tcripps Date: 2008-11-14 22:05:28 +0000 (Fri, 14 Nov 2008) Log Message: ----------- Restore didSave notifications Modified Paths: -------------- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java Modified: branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2008-11-14 20:07:14 UTC (rev 8610) +++ branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2008-11-14 22:05:28 UTC (rev 8611) @@ -68,11 +68,40 @@ private static boolean _initialized; + public static Observer observer; + /** + * This public observer is used to perform basic functions in + * response to notifications. Specifically it handles + * configuring the adapator context so that SQL debugging can + * be enabled and disabled on the fly throgh the log4j system. + * Handling cleanup issues when sessions timeout, i.e. releasing + * all references to editing contexts created for that session. + * Handling call all of the <code>did*</code> methods on + * {@link ERXGenericRecord} subclasses after an editing context + * has been saved. This delegate is also responsible for configuring + * the {@link ERXCompilerProxy} and {@link ERXValidationFactory}. + * This delegate is configured when this framework is loaded. + */ + public static class Observer { + /** + * This method is called everytime an editingcontext is + * saved. This allows us to call all of the didInsert, + * didUpdate and didSave methods on the enterprise objects + * after the transaction is complete. + * @param n notification that contains the array of inserted, + * updated and deleted objects. + */ + public void didSave(NSNotification n) { + ERXGenericRecord.didSave(n); + } + } + static { // Without this the blasted ERXLogger factory doesn't get initialized early enough. // When we move everything to use plain Loggers, we should revisit this initializer. - TC ERXConfigurationManager.defaultManager().initialize(); ERXLogger.configureLogging(System.getProperties()); + observer = new Observer(); } public ERXExtensions() { @@ -161,6 +190,15 @@ NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("sharedEditingContextWasInitialized", ERXConstant.NotificationClassArray), EOSharedEditingContext.DefaultSharedEditingContextWasInitializedNotification, null); ERXEntityClassDescription.registerDescription(); + + // TODO: Remove this and the "Observer" when we really update ERXEnterpriseObject and ERXEC from trunk, + // as they will no longer be necessary. + NSNotificationCenter.defaultCenter().addObserver(observer, + new NSSelector("didSave", ERXConstant.NotificationClassArray), + EOEditingContext.EditingContextDidSaveChangesNotification, + null); + // End TODO + //ERXPartialInitializer.registerModelGroupListener(); if (!ERXProperties.webObjectsVersionIs52OrHigher()) { NSNotificationCenter.defaultCenter().addObserver(this, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tc...@us...> - 2009-05-22 23:38:14
|
Revision: 9371 http://wonder.svn.sourceforge.net/wonder/?rev=9371&view=rev Author: tcripps Date: 2009-05-22 23:38:06 +0000 (Fri, 22 May 2009) Log Message: ----------- Post a notification before changing the adaptor logging setting in order to allow the application to make any necessary changes (e.g. to logger settings, etc.) to show the adaptor logs. Modified Paths: -------------- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java Modified: branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2009-05-22 19:05:13 UTC (rev 9370) +++ branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2009-05-22 23:38:06 UTC (rev 9371) @@ -62,6 +62,9 @@ /** Notification name, posted before object will change in an editing context */ public final static String objectsWillChangeInEditingContext= "ObjectsWillChangeInEditingContext"; + + /** Notification name, posted before EOAdaptor debug logging will change its setting. */ + public final static String eoAdaptorLoggingWillChangeNotification = "EOAdaptorLoggingWillChange"; /** logging support */ private static Logger _log; @@ -435,6 +438,8 @@ public static void setAdaptorLogging(boolean onOff) { Boolean targetState = onOff ? Boolean.TRUE : Boolean.FALSE; if (NSLog.debugLoggingAllowedForGroups(NSLog.DebugGroupSQLGeneration|NSLog.DebugGroupDatabaseAccess) != targetState.booleanValue()) { + // Post a notification to give us a hook to perform other operations necessary to get logging going, e.g. change Logger settings, etc. + NSNotificationCenter.defaultCenter().postNotification(new NSNotification(eoAdaptorLoggingWillChangeNotification, targetState)); if (targetState.booleanValue()) { NSLog.allowDebugLoggingForGroups(NSLog.DebugGroupSQLGeneration|NSLog.DebugGroupDatabaseAccess); } else { @@ -1228,7 +1233,7 @@ * not need to call this method if you already called initApp. This is lighter-weight than * initApp, and tries to just get enough configured to make EOF work properly. * - * @param mainBundleFile the folder of your main bundle + * @param mainBundleFolder the folder of your main bundle * @param args the commandline arguments for your application */ public static void initEOF(File mainBundleFolder, String[] args) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ms...@us...> - 2009-06-08 11:59:06
|
Revision: 9457 http://wonder.svn.sourceforge.net/wonder/?rev=9457&view=rev Author: mschrag Date: 2009-06-08 11:58:28 +0000 (Mon, 08 Jun 2009) Log Message: ----------- Fix NPE when attempting to refresh a shared entity that isn't loaded. Modified Paths: -------------- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java Modified: branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2009-06-08 11:48:08 UTC (rev 9456) +++ branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2009-06-08 11:58:28 UTC (rev 9457) @@ -927,6 +927,10 @@ sharedEC.lock(); try { EOEntity entity = ERXEOAccessUtilities.entityNamed(sharedEC, entityName); + if( entity == null ) { + _log.warn("Attempting to refresh a non-existent (or not accessible) EO: " + entityName); + return; + } //if entity caches objects, clear out the cache if( entity.cachesObjects() ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ms...@us...> - 2010-06-01 14:47:26
|
Revision: 10911 http://wonder.svn.sourceforge.net/wonder/?rev=10911&view=rev Author: mschrag Date: 2010-06-01 14:47:19 +0000 (Tue, 01 Jun 2010) Log Message: ----------- set the initial state of the adaptor debugger (if that accessor exists) + fire off a properties change event right after properties initialization Modified Paths: -------------- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java Modified: branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2010-06-01 14:10:53 UTC (rev 10910) +++ branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2010-06-01 14:47:19 UTC (rev 10911) @@ -7,6 +7,7 @@ package er.extensions; import com.webobjects.appserver.WOSession; +import com.webobjects.eoaccess.EOAdaptor; import com.webobjects.eoaccess.EOAttribute; import com.webobjects.eoaccess.EODatabase; import com.webobjects.eoaccess.EODatabaseContext; @@ -254,6 +255,7 @@ ERXJDBCAdaptor.registerJDBCAdaptor(); ERXConfigurationManager.defaultManager().loadOptionalConfigurationFiles(); ERXProperties.populateSystemProperties(); + ERXProperties.systemPropertiesChanged(); ERXConfigurationManager.defaultManager().configureRapidTurnAround(); ERXLocalizer.initialize(); @@ -477,6 +479,13 @@ adaptorLogger.info("Adaptor debug off"); } adaptorEnabled = targetState; + Class<EOAdaptor> eoAdaptorClass = EOAdaptor.class; + try { + eoAdaptorClass.getMethod("setDebugEnabled", boolean.class).invoke(null, Boolean.valueOf(onOff)); + } + catch (Throwable t) { + adaptorLogger.info("The method 'EOAdaptor.setDebugEnabled' is not available in this version of WebObjects."); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ms...@us...> - 2010-06-21 18:29:31
|
Revision: 10954 http://wonder.svn.sourceforge.net/wonder/?rev=10954&view=rev Author: mschrag Date: 2010-06-21 18:29:24 +0000 (Mon, 21 Jun 2010) Log Message: ----------- Fix for stack overflow during sql evaluation for ERXToManyQualifier Modified Paths: -------------- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java Modified: branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java =================================================================== --- branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2010-06-18 20:59:32 UTC (rev 10953) +++ branches/Wonder_2_0_0_Branch/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXExtensions.java 2010-06-21 18:29:24 UTC (rev 10954) @@ -269,12 +269,16 @@ _log = Logger.getLogger(ERXExtensions.class); - registerSQLSupportForSelector(new NSSelector(ERXPrimaryKeyListQualifier.IsContainedInArraySelectorName), - EOQualifierSQLGeneration.Support.supportForClass(ERXPrimaryKeyListQualifier.class)); - registerSQLSupportForSelector(new NSSelector(ERXToManyQualifier.MatchesAllInArraySelectorName), - EOQualifierSQLGeneration.Support.supportForClass(ERXToManyQualifier.class)); - registerSQLSupportForSelector(new NSSelector(ERXToManyQualifier.MatchesAnyInArraySelectorName), - EOQualifierSQLGeneration.Support.supportForClass(ERXToManyQualifier.class)); + try { + // MS: initialize these with Class.forName(Whatever.class.getName()) because the .class class literal does not trigger static initializers to run in 1.5, + // which means that the sql generation support classes are not registered + registerSQLSupportForSelector(new NSSelector(ERXPrimaryKeyListQualifier.IsContainedInArraySelectorName), EOQualifierSQLGeneration.Support.supportForClass(Class.forName(ERXPrimaryKeyListQualifier.class.getName()))); + registerSQLSupportForSelector(new NSSelector(ERXToManyQualifier.MatchesAllInArraySelectorName), EOQualifierSQLGeneration.Support.supportForClass(Class.forName(ERXToManyQualifier.class.getName()))); + registerSQLSupportForSelector(new NSSelector(ERXToManyQualifier.MatchesAnyInArraySelectorName), EOQualifierSQLGeneration.Support.supportForClass(Class.forName(ERXToManyQualifier.class.getName()))); + } + catch (Throwable t) { + throw NSForwardException._runtimeExceptionForThrowable(t); + } //ERXObjectStoreCoordinatorPool.initializeIfNecessary(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |