
Classes | |
| class | KeyValueQualifierSQLGenerationSupport |
Public Member Functions | |
| void | bundleDidLoad (NSNotification n) |
| void | configureAdaptorContext (NSNotification n) |
| EOModelGroup | defaultModelGroup () |
| void | editingContextDidCreate (NSNotification n) |
| ERXExtensions () | |
| void | finishInitialization () |
| void | sessionDidTimeOut (NSNotification n) |
| void | sharedEditingContextWasInitialized (NSNotification n) |
Static Public Member Functions | |
| static boolean | adaptorLogging () |
| static void | addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath (EOEnterpriseObject to, EOEnterpriseObject from, String keyPath) |
| static void | addRandomizeDirectActionURL (StringBuffer daURL) |
| static String | addWosidFormValue (String url, WOSession s) |
| static boolean | booleanFlagOnSessionForKeyWithDefault (WOSession s, String key, boolean defaultValue) |
| static byte[] | bytesFromFile (File f) throws IOException |
| static String | capitalize (String s) |
| static String | cleanString (String newString, NSArray toBeCleaneds) |
| static void | configureAdaptorContext () |
| static void | configureAdaptorContextRapidTurnAround (Object anObserver) |
| static void | forceGC (int maxLoop) |
| static void | freeProcessResources (Process p) |
| static ERXSimpleHTMLFormatter | htmlFormatter () |
| static void | initApp (String mainBundleName, URL mainBundleURL, Class applicationSubclass, String[] args) |
| static void | initApp (String mainBundleName, Class applicationSubclass, String[] args) |
| static void | initApp (Class applicationSubclass, String[] args) |
| static void | initEOF (final File mainBundleFile, String[] args, boolean assertsBundleExists, boolean assertsBundleIsWOApplicationFolder, boolean fallbackToUserDirAsBundle) |
| static void | initEOF (final File mainBundleFile, final String[] args, boolean assertsBundleExists) |
| static void | initEOF (final File mainBundleFolder, final String[] args) |
| static void | initEOF (final String[] args) |
| static int | intFromParseableIntegerString (String s) |
| static long | lastModifiedDateForFileInFramework (String fileName, String frameworkName) |
| static boolean | objectImplementsMethod (Object object, String methodName, Class[] parameters) |
| static String | plurify (String s, int howMany, String language) |
| static String | randomizeDirectActionURL (String daURL) |
| static Object | readPropertyListFromFileInFramework (String fileName, String aFrameWorkName, NSArray languageList) |
| static Object | readPropertyListFromFileinFramework (String fileName, String aFrameWorkName) |
| static void | refreshSharedObjectsWithName (String entityName) |
| static void | refreshSharedObjectsWithNames (NSArray names) |
| static synchronized void | registerSQLSupportForSelector (NSSelector selector, EOQualifierSQLGeneration.Support support) |
| static String | removeHTMLTagsFromString (String s) |
| static String | resolveUnit (String userInfoUnitString, EOEnterpriseObject object, String prefixKeyPath) |
| static void | retainEditingContextForCurrentSession (EOEditingContext ec) |
| static boolean | safeDifferent (Object v1, Object v2) |
| static boolean | safeEquals (Object v1, Object v2) |
| static synchronized ERXSession | session () |
| static void | sessionDidTimeOut (String sessionID) |
| static void | setAdaptorLogging (boolean onOff) |
| static void | setBooleanFlagOnSessionForKey (WOSession s, String key, boolean newValue) |
| static synchronized void | setSession (ERXSession session) |
| static String | stringFromFile (File f, String encoding) throws IOException |
| static String | stringFromFile (File f) throws IOException |
| static boolean | stringIsParseableInteger (String s) |
| static String | substituteStringByStringInString (String s1, String s2, String s) |
| static String | userInfoUnit (EOEnterpriseObject object, String key) |
| static String | userPreferencesKeyFromContext (String key, NSKeyValueCoding context) |
Static Public Attributes | |
| static Logger | adaptorLogger |
| static final String | eoAdaptorLoggingWillChangeNotification = "EOAdaptorLoggingWillChange" |
| static final String | objectsWillChangeInEditingContext = "ObjectsWillChangeInEditingContext" |
| static Logger | sharedEOadaptorLogger |
Protected Member Functions | |
| void | initialize () |
Protected Attributes | |
| volatile ERXModelGroup | defaultModelGroup |
Static Private Attributes | |
| static boolean | _appInitialized = false |
| static NSMutableDictionary | _editingContextsPerSession |
| static boolean | _eofInitialized = false |
| static final Lock | _eofInitializeLock = new ReentrantLock() |
| static boolean | _initialized |
| static boolean | _isConfigureAdaptorContextRapidTurnAround = false |
| static Logger | _log |
| static Map | _qualifierKeys |
| static Random | _random = new Random() |
| static NSSelector | _sharedEntityDataWasRefreshedSelector = new NSSelector("sharedEntityDataWasRefreshed") |
| static Boolean | adaptorEnabled |
| ERXExtensions | ( | ) |
| static boolean adaptorLogging | ( | ) | [static] |
Returns the current state of EOAdaptor logging.
| static void addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath | ( | EOEnterpriseObject | to, | |
| EOEnterpriseObject | from, | |||
| String | keyPath | |||
| ) | [static] |
This method handles 3 different cases
1. keyPath is a single key and represents a relationship --> addObjectToBothSidesOfRelationshipWithKey 2. keyPath is a single key and does NOT represents a relationship 3. keyPath is a real key path: break it up, navigate to the last atom --> back to 1. or 2.
| to | enterprise object that is having objects added to it | |
| from | enterprise object that is providing the objects | |
| keyPath | that specifies the relationship on the to object to add the objects to. |
| static void addRandomizeDirectActionURL | ( | StringBuffer | daURL | ) | [static] |
This method can be used with Direct Action URLs to make sure that the browser will reload the page. This is done by adding the parameter [? | &]r=random_number to the end of the url.
| daURL | a url to add the randomization to. |
Adds the session ID (wosid) for a given session to a given url.
| url | to add wosid form value to. |
| static boolean booleanFlagOnSessionForKeyWithDefault | ( | WOSession | s, | |
| String | key, | |||
| boolean | defaultValue | |||
| ) | [static] |
Retrieves a value from the session's dictionary and evaulates that object using the booleanValue method of ERXUtilities. If there is no object corresponding to the key passed in, then the default value is returned. The usual way in which boolean values are set on the session object is by using the method setBooleanFlagOnSessionForKey in this class.
| s | session object to retrieve the boolean flag from | |
| key | that the boolean is stored under | |
| defaultValue | value to be returned if the object in the dictionary is null |
| void bundleDidLoad | ( | NSNotification | n | ) |
| static byte [] bytesFromFile | ( | File | f | ) | throws IOException [static] |
Returns the byte array for a given file.
| f | file to get the bytes from |
| IOException | if things go wrong |
Capitalizes the given string.
| s | string to capitalize |
Given an initial string and an array of substrings, Removes any occurances of any of the substrings from the initial string. Used in conjunction with fuzzy matching.
| newString | initial string from which to remove other strings | |
| toBeCleaneds | array of substrings to be removed from the initial string. |
| static void configureAdaptorContext | ( | ) | [static] |
This method is called by the delegate when the configuration file is changed. It's sole purpose is to map a logging logger to a debug group. Hopefully in the future we will have a more generic solution.
| void configureAdaptorContext | ( | NSNotification | n | ) |
This method is called everytime the configuration file is changed. This allows for turning SQL debuging on and off at runtime.
| n | notification posted when the configuration file changes. |
| static void configureAdaptorContextRapidTurnAround | ( | Object | anObserver | ) | [static] |
Configures the passed in observer to register a call back when the configuration file is changed. This allows one to change a logger's setting and have that changed value change the NSLog setting to log the generated SQL. This method is called as part of the framework initialization process.
| anObserver | object to register the call back with. |
| EOModelGroup defaultModelGroup | ( | ) |
Delegate method for the EOModelGroup class delegate.
| void editingContextDidCreate | ( | NSNotification | n | ) |
This is needed for WO pre-5.2 when ec's were not retained by their eos. Not called in 5.2+ systems.
| n | notification posted when an ec is created |
| void finishInitialization | ( | ) | [virtual] |
This method is called when the application has finished launching. Here is where log4j is configured for rapid turn around and the validation template system is configured.
Implements ERXFrameworkPrincipal.
| static void forceGC | ( | int | maxLoop | ) | [static] |
Forces the garbage collector to run. The max loop parameter determines the maximum number of times to run the garbage collector if the memory footprint is still going down. In normal cases you would just need to call this method with the parameter 1. If called with the parameter 0 the garbage collector will continue to run until no more free memory is available to collect.
Note: This can be a very costly operation and should only be used in extreme circumstances.
| maxLoop | maximum times to run the garbage collector. Passing in 0 will cause the collector to run until all free objects have been collected. |
| static void freeProcessResources | ( | Process | p | ) | [static] |
Frees all of the resources associated with a given process and then destroys the process.
| p | process to destroy |
| static ERXSimpleHTMLFormatter htmlFormatter | ( | ) | [static] |
| static void initApp | ( | String | mainBundleName, | |
| URL | mainBundleURL, | |||
| Class | applicationSubclass, | |||
| String[] | args | |||
| ) | [static] |
Initializes your WOApplication programmatically (for use in test cases and main methods).
| mainBundleName | the name of your main bundle (or null to use mainBundleURL) | |
| mainBundleURL | the URL to your main bundle (ignored if mainBundleName is set) | |
| applicationSubclass | your Application subclass | |
| args | the commandline arguments for your application |
Initializes your WOApplication programmatically (for use in test cases and main methods).
| mainBundleName | the name of your main bundle | |
| applicationSubclass | your Application subclass | |
| args | the commandline arguments for your application |
| static void initApp | ( | Class | applicationSubclass, | |
| String[] | args | |||
| ) | [static] |
Initializes your WOApplication programmatically (for use in test cases and main methods) with the assumption that the current directory is your main bundle URL.
| applicationSubclass | your Application subclass | |
| args | the commandline arguments for your application |
| static void initEOF | ( | final File | mainBundleFile, | |
| String[] | args, | |||
| boolean | assertsBundleExists, | |||
| boolean | assertsBundleIsWOApplicationFolder, | |||
| boolean | fallbackToUserDirAsBundle | |||
| ) | [static] |
Initializes Wonder EOF programmatically (for use in test cases and main methods). You do 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. This method is also, unlike initEOF(String[]) or initEOF(File, String[]), not so restrictive as to require the name of the bundle be a *.woa, and nor does it require *.framework as the name of the bundle.
It can therefore be useful for, and used with, folder, jar or war bundles -- whichever bundle is referenced by mainBundleURI -- so long as it is bundle-like in content rather than by name. For NSBundle, this usually just requires a Resources folder within the bundle.
For example, if you're build tool compiles sources and puts Resources under target/classes you can call this method via ERXExtensions.initEOF(new File(projectDir, "target/classes").toURI(), args).
Note 1: this will set the system property webobjects.user.dir to the canonical path of the given bundle uri if, and only if, the bundle uri points to a directory and is schema is file.
Note 2: this will set NSBundle's mainBundle to the referenced bundle loaded via ERXRuntimeUtilities#loadBundleIfNeeded(URI) if found.
| mainBundleFile | the archive file or directory of your main bundle | |
| args | the commandline arguments for your application | |
| assertsBundleExists | ensures that the bundle exists and is loaded | |
| assertsBundleIsWOApplicationFolder | ensures that the bundle referenced by mainBundleFile, or the current dir if fallbackToUserDirAsBundle is true, is a *.woa bundle folder. | |
| fallbackToUserDirAsBundle | falls back to current dir if the mainBundleFile does not exist |
| NSForwardException | if the given bundle doesn't satisfy the given assertions or ERXRuntimeUtilities.loadBundleIfNeeded or ERXApplication.setup fails. |
NSBundle._setMainBundle(NSBundle)
| static void initEOF | ( | final File | mainBundleFile, | |
| final String[] | args, | |||
| boolean | assertsBundleExists | |||
| ) | [static] |
Initializes Wonder EOF programmatically (for use in test cases and main methods). You do 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. This method is also, unlike initEOF(String[]) or initEOF(File, String[]), not so restrictive as to require the name of the bundle be a *.woa, and nor does it require *.framework as the name of the bundle.
It can therefore be useful for, and used with, folder, jar or war bundles -- whichever bundle is referenced by mainBundleURI -- so long as it is bundle-like in content rather than by name. For NSBundle, this usually just requires a Resources folder within the bundle.
For example, if you're build tool compiles sources and puts Resources under target/classes you can call this method via ERXExtensions.initEOF(new File(projectDir, "target/classes"), args, true).
Note 1: this will set the system property webobjects.user.dir to the canonical path of the given bundle uri if, and only if, the bundle uri points to a directory and is schema is file.
Note 2: this will set NSBundle's mainBundle to the referenced bundle loaded via ERXRuntimeUtilities#loadBundleIfNeeded(URI) if found.
This is equivalent to calling initEOF(mainBundleFolder, args, assertsBundleExists, false, true).
| mainBundleFile | the archive file or directory of your main bundle | |
| args | the commandline arguments for your application | |
| assertsBundleExists | ensures that the bundle exists and is loaded |
| NSForwardException | if the given bundle doesn't satisfy the given assertions or ERXRuntimeUtilities.loadBundleIfNeeded or ERXApplication.setup fails. |
| static void initEOF | ( | final File | mainBundleFolder, | |
| final String[] | args | |||
| ) | [static] |
Initializes Wonder EOF programmatically (for use in test cases and main methods). You do 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.
This is equivalent to calling initEOF(mainBundleFolder, args, true, true, true).
| mainBundleFolder | the folder of your main bundle | |
| args | the commandline arguments for your application |
| IllegalArgumentException | if the current dir or mainBundleFolder is not a *.woa bundle. |
| static void initEOF | ( | final String[] | args | ) | [static] |
Initializes Wonder EOF programmatically (for use in test cases and main methods). You do 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. This method assumes you are running your app from a .woa folder.
This is equivalent to calling initEOF(new File("."), args).
| args | the commandline arguments for your application |
| IllegalArgumentException | if the current dir or mainBundleFolder is not a *.woa bundle. |
| void initialize | ( | ) | [protected] |
Configures the framework. All the bits and pieces that need to be configured are configured, those that need to happen later are delayed by registering an observer for notifications that are posted when the application is finished launching. 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 did* methods on ERXGenericRecord subclasses after an editing context has been saved. This delegate is also responsible for configuring the ERXCompilerProxy and ERXValidationFactory. This delegate is configured when this framework is loaded.
Reimplemented from ERXFrameworkPrincipal.
| static int intFromParseableIntegerString | ( | String | s | ) | [static] |
Returns an integer from a parsable string. If the string can not be parsed then 0 is returned.
| s | string to be parsed. |
Determines the last modification date for a given file in a framework. Note that this method will only test for the global resource not the localized resources.
| fileName | name of the file | |
| frameworkName | name of the framework, null or "app" for the application bundle |
lastModified method of the file object | static boolean objectImplementsMethod | ( | Object | object, | |
| String | methodName, | |||
| Class[] | parameters | |||
| ) | [static] |
Determines if a given object implements a method given the name and the array of input parameters. Note that this doesn't quite check the method signature since the method return type is not checked.
| object | to determine if it implements a method | |
| methodName | name of the method | |
| parameters | array of parameters |
Pluralizes a given string for a given language. See ERXLocalizer for more information.
| s | string to pluralize | |
| howMany | number of its | |
| language | target language |
This method can be used with Direct Action URLs to make sure that the browser will reload the page. This is done by adding the parameter [? | &]r=random_number to the end of the url.
| daURL | a url to add the randomization to. |
| static Object readPropertyListFromFileInFramework | ( | String | fileName, | |
| String | aFrameWorkName, | |||
| NSArray | languageList | |||
| ) | [static] |
Reads a file in from the file system for the given set of languages and parses the file as if it were a property list.
| fileName | name of the file | |
| aFrameWorkName | name of the framework, null or 'app' for the application bundle. | |
| languageList | language list search order |
| static Object readPropertyListFromFileinFramework | ( | String | fileName, | |
| String | aFrameWorkName | |||
| ) | [static] |
Reads a file in from the file system and parses it as if it were a property list.
| fileName | name of the file | |
| aFrameWorkName | name of the framework, null or 'app' for the application bundle. |
| static void refreshSharedObjectsWithName | ( | String | entityName | ) | [static] |
Refreshes all of the shared enterprise objects for a given shared entity, then notifies the entity's class by calling the static method sharedEntityDataWasRefreshed() if the shared entity implements it.
| entityName | name of the shared entity |
| static void refreshSharedObjectsWithNames | ( | NSArray | names | ) | [static] |
Refreshes all of the objects for an array of entity names.
| names | array of shared entity names |
| static synchronized void registerSQLSupportForSelector | ( | NSSelector | selector, | |
| EOQualifierSQLGeneration.Support | support | |||
| ) | [static] |
Removes all of the HTML tags from a given string. Note: this is a very simplistic implementation and will most likely not work with complex HTML. Note: for actual conversion of HTML tags into regular strings have a look at ERXSimpleHTMLFormatter
| s | html string |
| static String resolveUnit | ( | String | userInfoUnitString, | |
| EOEnterpriseObject | object, | |||
| String | prefixKeyPath | |||
| ) | [static] |
Resolves a given user info unit string for a given object. User info values are stored in an EOAttibute or EORelationship's userInfo dictionary. See the method userInfoUnit for a better description of getting values out of the userInfo dictionary. This method deals with resolving dynamic userInfo keys. These keys need to start with the '@' symbol. For instance if you have the user info value '' off of an attribute for the entity Movie, then you can either pass in a Movie object or a different object with a prefix key path to a movie object.
| userInfoUnitString | string to be resolved, needs to start with '@'. This keypath will be evaluated against either the object if no prefixKeyPath is specified or the object returned by the prefixKeyPath being evaluated against the object passed in. | |
| object | to resolve either the user info unit or the prefixKeyPath. | |
| prefixKeyPath | used as a prefix for the unit resolution. |
| static void retainEditingContextForCurrentSession | ( | EOEditingContext | ec | ) | [static] |
Retains an editing context for the current session. This is only needed or used for versions of WO pre-5.2. If you use ERXEC to create your editing contexts then you never need to call this method yourself.
| ec | to be retained. |
| static boolean safeDifferent | ( | Object | v1, | |
| Object | v2 | |||
| ) | [static] |
A safe different comparison method that first checks to see if either of the objects are null before comparing them with the equals method.
Note that if both objects are null then they will be considered equal.
| v1 | first object | |
| v2 | second object |
| static boolean safeEquals | ( | Object | v1, | |
| Object | v2 | |||
| ) | [static] |
A safe comparison method that first checks to see if either of the objects are null before comparing them with the equals method.
Note that if both objects are null then they will be considered equal.
| v1 | first object | |
| v2 | second object |
| static synchronized ERXSession session | ( | ) | [static] |
Returns the current session object for this thread.
| static void sessionDidTimeOut | ( | String | sessionID | ) | [static] |
This method is called when a session times out. Calling this method will release references to all editing contexts that were created when this session was active. This method is only called in pre-WO 5.2 versions of WebObjects.
| sessionID | of the session that timed out |
| void sessionDidTimeOut | ( | NSNotification | n | ) |
This method is called every time a session times out. It allows us to release references to all the editing contexts that were created when that particular session was active. Not used in WO 5.2+
| n | notification that contains the session ID. |
| static void setAdaptorLogging | ( | boolean | onOff | ) | [static] |
Turn EOAdaptor logging on and off.
| onOff |
| static void setBooleanFlagOnSessionForKey | ( | WOSession | s, | |
| String | key, | |||
| boolean | newValue | |||
| ) | [static] |
Uses the setObjectForKey method of the WOSession class to push a Boolean object onto the session for a given key. Note this is not using key value coding, meaning you don't need to have a boolean instance variable corresponding to the given key on your session object. This flag can be retrieved using the method booleanFlagOnSessionForKeyWithDefault.
| s | session object on which to set the boolean flag | |
| key | to be used in the session's dictionary | |
| newValue | boolean value to be set on the session |
| static synchronized void setSession | ( | ERXSession | session | ) | [static] |
Sets the current session for this thread. This is called from ERXSession's awake and sleep methods.
| session | that is currently active for this thread. |
| void sharedEditingContextWasInitialized | ( | NSNotification | n | ) |
This method is called for the following notification EOSharedEditingContext#DefaultSharedEditingContextWasInitializedNotification
| n | the notification. |
Returns a string from the file using the specified encoding.
| f | file to read | |
| encoding | to be used, null will use the default |
| static String stringFromFile | ( | File | f | ) | throws IOException [static] |
Returns a string from the file using the default encoding.
| f | file to read |
| static boolean stringIsParseableInteger | ( | String | s | ) | [static] |
Tests if a given string object can be parsed into an integer.
| s | string to be parsed |
For a given enterprise object and key path, will return what the key 'unit' returns from the userInfo dictionary of the last property of the key path's EOAttribute or EORelationship. The userInfo dictionary can be edited via EOModeler, it is that open book looking icon when looking at either an attribute or relationship.
For example if the userInfo dictionary or the attribute 'speed' on the entity Car contained the key-value pair unit=mph, then this method would be able to resolve that unit given either of these keypaths:
userInfoUnit(aCar, "speed"); Units can be very useful for adding meta information to particular attributes and relationships in models. The ERDirectToWeb framework adds support for displaying units.
userInfoUnit(aDrive, "toCar.speed");
| object | to resolve the key-path from | |
| key | path off of the object |
Constructs a unique key based on a context. A method used by the preferences mechanism from ERDirectToWeb which needs to be here because it is shared by ERDirectToWeb and ERCoreBusinessLogic.
| key | preference key | |
| context | most likely a d2wContext object |
boolean _appInitialized = false [static, private] |
NSMutableDictionary _editingContextsPerSession [static, private] |
Retaining the editing contexts explicitly until the session that was active when they were created goes away this hopefully will go some way towards avoiding the 'attempted to send' message to EO whose EditingContext is gone. Only used in pre-5.2 systems.
boolean _eofInitialized = false [static, private] |
final Lock _eofInitializeLock = new ReentrantLock() [static, private] |
boolean _initialized [static, private] |
boolean _isConfigureAdaptorContextRapidTurnAround = false [static, private] |
flag to inidicate if rapid turn around is enabled for the adaptor channel logging.
Map _qualifierKeys [static, private] |
Random _random = new Random() [static, private] |
Holds a reference to the random object
NSSelector _sharedEntityDataWasRefreshedSelector = new NSSelector("sharedEntityDataWasRefreshed") [static, private] |
Boolean adaptorEnabled [static, private] |
flag to indicate if adaptor channel logging is enabled
Logger adaptorLogger [static] |
logging support for the adaptor channel
volatile ERXModelGroup defaultModelGroup [protected] |
holds the default model group
final String eoAdaptorLoggingWillChangeNotification = "EOAdaptorLoggingWillChange" [static] |
Notification name, posted before EOAdaptor debug logging will change its setting.
final String objectsWillChangeInEditingContext = "ObjectsWillChangeInEditingContext" [static] |
Notification name, posted before object will change in an editing context
Logger sharedEOadaptorLogger [static] |
logging support for shared object loading
1.5.8