public class ERXExtensions extends ERXFrameworkPrincipal
| Modifier and Type | Class and Description |
|---|---|
static class |
ERXExtensions.KeyValueQualifierSQLGenerationSupport
Support class that listens for EOKeyValueQualifiers that have a selector
that was registered and uses their support instead.
|
ERXFrameworkPrincipal.Observer| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
adaptorLogger
logging support for the adaptor channel
|
protected ERXModelGroup |
defaultModelGroup
holds the default model group
|
static java.lang.String |
eoAdaptorLoggingWillChangeNotification
Notification name, posted before EOAdaptor debug logging will change its setting.
|
static java.lang.String |
objectsWillChangeInEditingContext
Notification name, posted before object will change in an editing context
|
static org.apache.log4j.Logger |
sharedEOadaptorLogger
logging support for shared object loading
|
initializedFrameworks, launchingFrameworks, log| Constructor and Description |
|---|
ERXExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
adaptorLogging()
Returns the current state of EOAdaptor logging.
|
static void |
addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath(EOEnterpriseObject to,
EOEnterpriseObject from,
java.lang.String keyPath)
This method handles 3 different cases
1.
|
static void |
addRandomizeDirectActionURL(java.lang.StringBuffer daURL)
This method can be used with Direct Action URLs to make sure
that the browser will reload the page.
|
static java.lang.String |
addSessionIdFormValue(java.lang.String urlString,
WOSession session)
Adds the session ID for a given session to a given URL.
|
static java.lang.String |
addWosidFormValue(java.lang.String url,
WOSession session)
Deprecated.
|
static boolean |
booleanFlagOnSessionForKeyWithDefault(WOSession s,
java.lang.String key,
boolean defaultValue)
Retrieves a value from the session's dictionary and evaluates
that object using the
booleanValue method of
ERXValueUtilities. |
void |
bundleDidLoad(NSNotification n) |
static byte[] |
bytesFromFile(java.io.File f)
Deprecated.
|
static java.lang.String |
capitalize(java.lang.String s)
Deprecated.
|
static java.lang.String |
cleanString(java.lang.String newString,
NSArray<java.lang.String> toBeCleaneds)
|
static void |
configureAdaptorContext()
This method is called by the delegate when the configuration
file is changed.
|
void |
configureAdaptorContext(NSNotification n)
This method is called every time the configuration file
is changed.
|
static void |
configureAdaptorContextRapidTurnAround(java.lang.Object anObserver)
Configures the passed in observer to register a call back
when the configuration file is changed.
|
EOModelGroup |
defaultModelGroup()
Delegate method for the
EOModelGroup class delegate. |
void |
didFinishInitialization()
Overridden by subclasses to finalize framework initialization.
|
void |
finishInitialization()
This method is called when the application has finished
launching.
|
static void |
forceGC(int maxLoop)
Forces the garbage collector to run.
|
static void |
freeProcessResources(java.lang.Process p)
Frees all of the resources associated with a given
process and then destroys the process.
|
static ERXSimpleHTMLFormatter |
htmlFormatter()
Deprecated.
|
static void |
initApp(java.lang.Class applicationSubclass,
java.lang.String[] args)
Initializes your WOApplication programmatically (for use in test cases and main methods) with
the assumption that the current directory is your main bundle URL.
|
static void |
initApp(java.lang.String mainBundleName,
java.lang.Class applicationSubclass,
java.lang.String[] args)
Initializes your WOApplication programmatically (for use in test cases and main methods).
|
static void |
initApp(java.lang.String mainBundleName,
java.net.URL mainBundleURL,
java.lang.Class applicationSubclass,
java.lang.String[] args)
Initializes your WOApplication programmatically (for use in test cases and main methods).
|
static void |
initEOF(java.io.File mainBundleFolder,
java.lang.String[] args)
Initializes Wonder EOF programmatically (for use in test cases and main methods).
|
static void |
initEOF(java.io.File mainBundleFile,
java.lang.String[] args,
boolean assertsBundleExists)
Initializes Wonder EOF programmatically (for use in test cases and main methods).
|
static void |
initEOF(java.io.File mainBundleFile,
java.lang.String[] args,
boolean assertsBundleExists,
boolean assertsBundleIsWOApplicationFolder,
boolean fallbackToUserDirAsBundle)
Initializes Wonder EOF programmatically (for use in test cases and main methods).
|
static void |
initEOF(java.lang.String[] args)
Initializes Wonder EOF programmatically (for use in test cases and main methods).
|
protected void |
initialize()
Configures the framework.
|
static int |
intFromParseableIntegerString(java.lang.String s)
Deprecated.
|
static long |
lastModifiedDateForFileInFramework(java.lang.String fileName,
java.lang.String frameworkName)
|
static boolean |
objectImplementsMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Class[] parameters)
Determines if a given object implements a method given
the name and the array of input parameters.
|
static java.lang.String |
plurify(java.lang.String s,
int howMany,
java.lang.String language)
Deprecated.
|
static java.lang.String |
randomizeDirectActionURL(java.lang.String daURL)
This method can be used with Direct Action URLs to make sure
that the browser will reload the page.
|
static java.lang.Object |
readPropertyListFromFileinFramework(java.lang.String fileName,
java.lang.String aFrameWorkName)
|
static java.lang.Object |
readPropertyListFromFileInFramework(java.lang.String fileName,
java.lang.String aFrameWorkName,
NSArray languageList)
|
static void |
refreshSharedObjectsWithName(java.lang.String entityName)
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.
|
static void |
refreshSharedObjectsWithNames(NSArray names)
Refreshes all of the objects for an array of entity names.
|
static void |
registerSQLSupportForSelector(NSSelector selector,
EOQualifierSQLGeneration.Support support) |
static java.lang.String |
removeHTMLTagsFromString(java.lang.String s)
Deprecated.
Please use ERXStringUtilities.removeHTMLTagsFromString(String) directly
|
static java.lang.String |
resolveUnit(java.lang.String userInfoUnitString,
EOEnterpriseObject object,
java.lang.String prefixKeyPath)
Resolves a given user info unit string for a given object.
|
static boolean |
safeDifferent(java.lang.Object v1,
java.lang.Object v2)
Deprecated.
use
ObjectUtils.equals(Object, Object) instead |
static boolean |
safeEquals(java.lang.Object v1,
java.lang.Object v2)
Deprecated.
use
ObjectUtils.equals(Object, Object) instead |
static ERXSession |
session()
Deprecated.
use ERXSession.session() instead
|
static void |
setAdaptorLogging(boolean onOff)
Turn EOAdaptor logging on and off.
|
static void |
setBooleanFlagOnSessionForKey(WOSession s,
java.lang.String key,
boolean newValue)
Uses the
setObjectForKey method of the WOSession
class to push a Boolean object onto the session for a given key. |
static void |
setSession(ERXSession session)
Deprecated.
use ERXSession.setSession(session) instead
|
void |
sharedEditingContextWasInitialized(NSNotification n)
This method is called for the following notification
EOSharedEditingContext.DefaultSharedEditingContextWasInitializedNotification |
static java.lang.String |
stringFromFile(java.io.File f)
Deprecated.
|
static java.lang.String |
stringFromFile(java.io.File f,
java.lang.String encoding)
Deprecated.
|
static boolean |
stringIsParseableInteger(java.lang.String s)
Deprecated.
|
static java.lang.String |
substituteStringByStringInString(java.lang.String s1,
java.lang.String s2,
java.lang.String s)
Deprecated.
use
StringUtils#replace(String, String, String) instead |
static java.lang.String |
userInfoUnit(EOEnterpriseObject object,
java.lang.String key)
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.
|
static java.lang.String |
userPreferencesKeyFromContext(java.lang.String key,
NSKeyValueCoding context)
Constructs a unique key based on a context.
|
hasFrameworkInstalled, setUpFrameworkPrincipalClass, sharedInstance, toStringpublic static final java.lang.String objectsWillChangeInEditingContext
public static final java.lang.String eoAdaptorLoggingWillChangeNotification
protected volatile ERXModelGroup defaultModelGroup
public static org.apache.log4j.Logger adaptorLogger
public static org.apache.log4j.Logger sharedEOadaptorLogger
public EOModelGroup defaultModelGroup()
EOModelGroup class delegate.protected void initialize()
did* methods on
ERXGenericRecord subclasses after an editing context
has been saved. This delegate is also responsible for configuring
ERXValidationFactory.
This delegate is configured when this framework is loaded.initialize in class ERXFrameworkPrincipalpublic void bundleDidLoad(NSNotification n)
public void finishInitialization()
finishInitialization in class ERXFrameworkPrincipalpublic void didFinishInitialization()
ERXFrameworkPrincipaldidFinishInitialization in class ERXFrameworkPrincipalpublic static void registerSQLSupportForSelector(NSSelector selector, EOQualifierSQLGeneration.Support support)
public void configureAdaptorContext(NSNotification n)
n - notification posted when the configuration file
changes.public void sharedEditingContextWasInitialized(NSNotification n)
EOSharedEditingContext.DefaultSharedEditingContextWasInitializedNotificationn - the notification.public static void configureAdaptorContextRapidTurnAround(java.lang.Object anObserver)
anObserver - object to register the call back with.public static void configureAdaptorContext()
public static boolean adaptorLogging()
public static void setAdaptorLogging(boolean onOff)
onOff - public static java.lang.String removeHTMLTagsFromString(java.lang.String s)
public static void forceGC(int maxLoop)
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.@Deprecated public static java.lang.String capitalize(java.lang.String s)
ERXStringUtilities.capitalize(String)s - string to capitalize@Deprecated
public static java.lang.String plurify(java.lang.String s,
int howMany,
java.lang.String language)
ERXLocalizer.localizerForLanguage(String) then ERXLocalizer.plurifiedString(String, int)ERXLocalizer for more information.s - string to pluralizehowMany - number of itslanguage - target language@Deprecated
public static boolean safeEquals(java.lang.Object v1,
java.lang.Object v2)
ObjectUtils.equals(Object, Object) insteadnull before comparing
them with the equals method.
Note that if both objects are null then they will
be considered equal.
v1 - first objectv2 - second objecttrue if they are equal, false if not@Deprecated
public static boolean safeDifferent(java.lang.Object v1,
java.lang.Object v2)
ObjectUtils.equals(Object, Object) insteadnull before comparing
them with the equals method.
Note that if both objects are null then they will
be considered equal.
v1 - first objectv2 - second objecttrue if they are not equal, false if they are@Deprecated public static boolean stringIsParseableInteger(java.lang.String s)
ERXStringUtilities.stringIsParseableInteger(String)s - string to be parsed@Deprecated public static int intFromParseableIntegerString(java.lang.String s)
ERXValueUtilities.intValue(Object)s - string to be parsed.@Deprecated
public static java.lang.String substituteStringByStringInString(java.lang.String s1,
java.lang.String s2,
java.lang.String s)
StringUtils#replace(String, String, String) insteads1 - string to be replaceds2 - to be inserteds - string to have the replacement done on it@Deprecated public static ERXSimpleHTMLFormatter htmlFormatter()
ERXSimpleHTMLFormatter.formatter()public static void addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath(EOEnterpriseObject to, EOEnterpriseObject from, java.lang.String keyPath)
to - enterprise object that is having objects added to itfrom - enterprise object that is providing the objectskeyPath - that specifies the relationship on the to object
to add the objects to.@Deprecated
public static byte[] bytesFromFile(java.io.File f)
throws java.io.IOException
ERXFileUtilities.bytesFromFile(File)f - file to get the bytes fromjava.io.IOException - if things go wrong@Deprecated
public static java.lang.String stringFromFile(java.io.File f)
throws java.io.IOException
ERXFileUtilities.stringFromFile(File)f - file to readjava.io.IOException - if things go wrong@Deprecated
public static java.lang.String stringFromFile(java.io.File f,
java.lang.String encoding)
throws java.io.IOException
ERXFileUtilities.stringFromFile(File, String)f - file to readencoding - to be used, null will use the defaultjava.io.IOException - if things go wrong@Deprecated
public static long lastModifiedDateForFileInFramework(java.lang.String fileName,
java.lang.String frameworkName)
fileName - name of the fileframeworkName - name of the framework, null or "app"
for the application bundlelastModified method of the file object@Deprecated
public static java.lang.Object readPropertyListFromFileinFramework(java.lang.String fileName,
java.lang.String aFrameWorkName)
fileName - name of the fileaFrameWorkName - name of the framework, null or
'app' for the application bundle.@Deprecated
public static java.lang.Object readPropertyListFromFileInFramework(java.lang.String fileName,
java.lang.String aFrameWorkName,
NSArray languageList)
fileName - name of the fileaFrameWorkName - name of the framework, null or
'app' for the application bundle.languageList - language list search orderpublic static java.lang.String userInfoUnit(EOEnterpriseObject object, java.lang.String key)
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");
userInfoUnit(aDrive, "toCar.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.object - to resolve the key-path fromkey - path off of the objectpublic static java.lang.String resolveUnit(java.lang.String userInfoUnitString,
EOEnterpriseObject object,
java.lang.String prefixKeyPath)
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 '@unit' 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.public static void refreshSharedObjectsWithNames(NSArray names)
names - array of shared entity namespublic static void refreshSharedObjectsWithName(java.lang.String entityName)
entityName - name of the shared entitypublic static java.lang.String randomizeDirectActionURL(java.lang.String daURL)
daURL - a url to add the randomization to.public static void addRandomizeDirectActionURL(java.lang.StringBuffer daURL)
daURL - a url to add the randomization to.@Deprecated
public static java.lang.String addWosidFormValue(java.lang.String url,
WOSession session)
addSessionIdFormValue(String, WOSession)url - URL string to add session ID form value to.session - session objectpublic static java.lang.String addSessionIdFormValue(java.lang.String urlString,
WOSession session)
urlString - URL string to add session ID form value tosession - session objectpublic static java.lang.String cleanString(java.lang.String newString,
NSArray<java.lang.String> toBeCleaneds)
ERXStringUtilities.cleanString(java.lang.String, com.webobjects.foundation.NSArray<java.lang.String>)newString - toBeCleaneds - public static void setBooleanFlagOnSessionForKey(WOSession s, java.lang.String key, boolean newValue)
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 flagkey - to be used in the session's dictionarynewValue - boolean value to be set on the sessionpublic static boolean booleanFlagOnSessionForKeyWithDefault(WOSession s, java.lang.String key, boolean defaultValue)
booleanValue method of
ERXValueUtilities. 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 fromkey - that the boolean is stored underdefaultValue - value to be returned if the object in the
dictionary is null@Deprecated public static void setSession(ERXSession session)
ERXSession's awake and sleep methods.session - that is currently active for this thread.@Deprecated public static ERXSession session()
public static java.lang.String userPreferencesKeyFromContext(java.lang.String key,
NSKeyValueCoding context)
key - preference keycontext - most likely a d2wContext objectpublic static void freeProcessResources(java.lang.Process p)
p - process to destroypublic static boolean objectImplementsMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Class[] parameters)
object - to determine if it implements a methodmethodName - name of the methodparameters - array of parameterspublic static void initApp(java.lang.Class applicationSubclass,
java.lang.String[] args)
applicationSubclass - your Application subclassargs - the commandline arguments for your applicationpublic static void initApp(java.lang.String mainBundleName,
java.lang.Class applicationSubclass,
java.lang.String[] args)
mainBundleName - the name of your main bundleapplicationSubclass - your Application subclassargs - the commandline arguments for your applicationpublic static void initApp(java.lang.String mainBundleName,
java.net.URL mainBundleURL,
java.lang.Class applicationSubclass,
java.lang.String[] args)
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 subclassargs - the commandline arguments for your applicationpublic static void initEOF(java.lang.String[] args)
This is equivalent to calling initEOF(new File("."), args).
args - the commandline arguments for your applicationjava.lang.IllegalArgumentException - if the current dir or mainBundleFolder is not a *.woa bundle.public static void initEOF(java.io.File mainBundleFolder,
java.lang.String[] args)
This is equivalent to calling initEOF(mainBundleFolder, args, true, true, true).
mainBundleFolder - the folder of your main bundleargs - the commandline arguments for your applicationjava.lang.IllegalArgumentException - if the current dir or mainBundleFolder is not a *.woa bundle.public static void initEOF(java.io.File mainBundleFile,
java.lang.String[] args,
boolean assertsBundleExists)
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(File) if found.
This is equivalent to calling initEOF(mainBundleFolder, args, assertsBundleExists, false, true).
mainBundleFile - the archive file or directory of your main bundleargs - the commandline arguments for your applicationassertsBundleExists - ensures that the bundle exists and is loadedNSForwardException - if the given bundle doesn't satisfy the given assertions or
ERXRuntimeUtilities.loadBundleIfNeeded or ERXApplication.setup fails.initEOF(File, String[], boolean, boolean, boolean)public static void initEOF(java.io.File mainBundleFile,
java.lang.String[] args,
boolean assertsBundleExists,
boolean assertsBundleIsWOApplicationFolder,
boolean fallbackToUserDirAsBundle)
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(File) if found.
mainBundleFile - the archive file or directory of your main bundleargs - the commandline arguments for your applicationassertsBundleExists - ensures that the bundle exists and is loadedassertsBundleIsWOApplicationFolder - 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 existNSForwardException - if the given bundle doesn't satisfy the given assertions or
ERXRuntimeUtilities.loadBundleIfNeeded or ERXApplication.setup fails.ERXRuntimeUtilities.loadBundleIfNeeded(File),
NSBundle._setMainBundle(NSBundle),
ERXApplication.setup(String[]),
bundleDidLoad(NSNotification)Copyright © 2002 – 2022 Project Wonder.