Oracle Fusion Middleware Java API Reference for Oracle Mobile Application Framework
2.0.0.0.0

E36392-01

oracle.adfmf.framework.api
Class AdfmfJavaUtilities

Object
  extended by oracle.adfmf.framework.api.AdfmfJavaUtilities

public class AdfmfJavaUtilities
extends Object


Field Summary
static String AES128
          Database password prefix to denote AES128 database encryption should be used.
static String AES256
          Database password prefix to denote AES256 database encryption should be used.
static int ApplicationDirectory
          Constant to be used to determine which directory path to obtain.
static int DatabaseAES128Encryption
          Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.
static int DatabaseAES256Encryption
          Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.
static int DatabaseDefaultEncryption
          Default database encryption algorithm
static int DatabaseNoEncryption
          Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.
static int DatabaseRC4Encryption
          Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.
static int DeviceOnlyDirectory
          Constant to be used to determine which directory path to obtain.
static int DownloadDirectory
          Constant to be used to determine which directory path to obtain.
static String RC4
          Database password prefix to denote RC4 database encryption should be used.
static int TemporaryDirectory
          Constant to be used to determine which directory path to obtain.
 
Constructor Summary
AdfmfJavaUtilities()
           
 
Method Summary
static int addDataControlProviders(String dcName, String providerKey, String keyAttribute, Object providers, boolean moreDataAvailable)
          Adds Objects as new data providers (i.e.
static int addDataControlProviders(String dcName, String providerKey, String keyAttribute, Object providers, boolean moreDataAvailable, boolean isWrappedResponse)
          Overload for (String dcName, String providerKey, String keyAttribute, Object providers, boolean moreDataAvailable) which adds a param to indicate the providers object is or is not a wrapped web service response object.
static void addWhiteListEntries(String fid, String[] entries)
          Add additional white list entries for the feature.
static void addWhiteListEntry(String fid, String entry)
          Add additional white list entry for the feature.
static void addWhiteListEntry(String fid, String entry, boolean updateApplicationInfo)
          Add additional white list entry for the feature.
static void clearPasswordCredential(String adfCredentialStoreKey, String username)
          Clear a password credential for the key from the credential store
static void clearSecurityConfigOverrides(String key)
          Clear the security configuration overrides associated with the given key.
static void decryptDatabase(java.sql.Connection db)
          Permanently decrypt a previously-encrypted database
static int encryptDatabase(java.sql.Connection db, String newPassword)
          Encrypt the database with the specified password.
static Object evaluateELExpression(String elExpression)
          Evaluates the expression and returns the resulting value.
static void flushDataChangeEvent()
          Flush any pending data change events NOTE: Can only be called from a background thread.
static String getActiveContextId()
          Get the active EL context name.
static AdfELContext getAdfELContext()
          Get the ADF EL context.
static DataControl getDataControlById(String dcName)
          Returns the DataControl instance for the specified data control name.
static Object getDataControlProvider(String dcName)
          Used to to get the root provider instance from a DataControl.
static String getDirectoryPathRoot(int typeOfPath)
          Gets the path to certain writable directory on the device
static Object getELValue(String elExpression)
          Gets a property resolved by an EL Expression to a value
static oracle.adfmf.framework.FeatureContext getFeatureContext()
          Get current FeatureContext instance.
static String getFeatureId()
          Get current feature id.
static String getFeatureName()
          Get current feature name.
static MethodExpression getMethodExpression(String expression, Class expectedReturnType, Class[] expectedParamTypes)
          Use this method for expressions that refer to methods.
static ValueExpression getValueExpression(String expression, Class expectedType)
          Use this method for expressions that refer to values.
static void invokeACS(String key, String optionalExtraPayload, boolean refreshApplicationState)
          Invokes ACS programmatically and updates feature context
static Object invokeDataControlMethod(String dcName, String instanceName, String methodName, java.util.List parameterNames, java.util.List parameters, java.util.List parameterTypes)
          Invoke a DC operation.
static boolean isBackgroundThread()
          Use it to test if the current thread is a background thread or not.
static boolean isEvaluationExpression(String elExpression)
          Checks if the passed in expression string is an evaluation expression.
static boolean isPrimaryRequestThread()
          Use it to test if the current thread is a primary thread or not.
static void loadXliffResourceBundle(String baseName, String varNameUsed)
          Used to load the resource bundle and store it as a map in the request scope.
static void logout()
          Logout the current authentication server
static void logoutFeature(String key)
          Logout the authentication server associated with key
static void overrideConnectionProperty(String connectionId, String node, String property, Object value)
          Overrides a connection reference property value with a new value.
static void setELValue(String elExpression, Object value)
          Sets a property resolved by an EL Expression to a value
static void updateApplicationInformation(boolean gotoDefaultFeature)
          Update the current application information based off the current environment and feature definitions.
static String updateSecurityConfigWithURLParameters(String configUrlParam, String key, String message, boolean showConfirmation)
          Update security configuration from URL parameters
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TemporaryDirectory

public static final int TemporaryDirectory
Constant to be used to determine which directory path to obtain. On iOS, this refers to the user specific temporary directory. On Android, it refers to the application's external cache directory.

See Also:
Constant Field Values

ApplicationDirectory

public static final int ApplicationDirectory
Constant to be used to determine which directory path to obtain. On iOS, this refers to the application's private Documents directory. On Android, this refers to the root of the application directory. This directory is not publicly accessible on either platform.

See Also:
Constant Field Values

DeviceOnlyDirectory

public static final int DeviceOnlyDirectory
Constant to be used to determine which directory path to obtain. On iOS, this refers to the Caches directory. On Android, it refers to the application's external cache directory.

See Also:
Constant Field Values

DownloadDirectory

public static final int DownloadDirectory
Constant to be used to determine which directory path to obtain. On iOS, this refers to the application's private Documents directory. This directory is not publicly accessible. On Android, it refers to a "download" directory in the external cache directory.

See Also:
Constant Field Values

DatabaseNoEncryption

public static final int DatabaseNoEncryption
Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.

See Also:
Constant Field Values

DatabaseAES128Encryption

public static final int DatabaseAES128Encryption
Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.

See Also:
Constant Field Values

DatabaseAES256Encryption

public static final int DatabaseAES256Encryption
Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.

See Also:
Constant Field Values

DatabaseRC4Encryption

public static final int DatabaseRC4Encryption
Constant returned by encryptDatabase(..) to denote what encryption algorithm will be used for the database.

See Also:
Constant Field Values

DatabaseDefaultEncryption

public static final int DatabaseDefaultEncryption
Default database encryption algorithm

See Also:
Constant Field Values

AES128

public static final String AES128
Database password prefix to denote AES128 database encryption should be used.

See Also:
Constant Field Values

AES256

public static final String AES256
Database password prefix to denote AES256 database encryption should be used.

See Also:
Constant Field Values

RC4

public static final String RC4
Database password prefix to denote RC4 database encryption should be used.

See Also:
Constant Field Values
Constructor Detail

AdfmfJavaUtilities

public AdfmfJavaUtilities()
Method Detail

addWhiteListEntry

public static void addWhiteListEntry(String fid,
                                     String entry)
Add additional white list entry for the feature.

Parameters:
fid - Feature id
entry - White list entry

addWhiteListEntry

public static void addWhiteListEntry(String fid,
                                     String entry,
                                     boolean updateApplicationInfo)
Add additional white list entry for the feature. Optionally updates application info.

Parameters:
fid - Feature id
entry - White list entry
updateApplicationInfo - If set to true, calls updateApplicationInfo.

addWhiteListEntries

public static void addWhiteListEntries(String fid,
                                       String[] entries)
Add additional white list entries for the feature.

Parameters:
fid - Feature id
entries - An array of white list entries

getDirectoryPathRoot

public static String getDirectoryPathRoot(int typeOfPath)
Gets the path to certain writable directory on the device

Parameters:
typeOfPath - the type of path
Returns:
  • returns the directory for storing temporary files, if typeOfPath is TemporaryDirectory
  • returns the directory storing Application files, if typeOfPath is ApplicationDirectory
  • returns the directory for storing cache files, if typeOfPath is DeviceOnlyDirectory
  • returns the directory for storing downloaded files, if typeOfPath is DownloadDirectory
See Also:
TemporaryDirectory, ApplicationDirectory, DeviceOnlyDirectory, DownloadDirectory

getFeatureContext

public static oracle.adfmf.framework.FeatureContext getFeatureContext()
Get current FeatureContext instance.

Returns:
the current FeatureContext instance.

getFeatureId

public static String getFeatureId()
                           throws AdfException
Get current feature id.

Returns:
the current feature's id
Throws:
AdfException

getFeatureName

public static String getFeatureName()
                             throws AdfException
Get current feature name.

Returns:
the current feature's name
Throws:
AdfException

getAdfELContext

public static AdfELContext getAdfELContext()
Get the ADF EL context.

Returns:
the ADF EL Context

getActiveContextId

public static String getActiveContextId()
Get the active EL context name.

Returns:
the name of the current feature's active EL context

getValueExpression

public static ValueExpression getValueExpression(String expression,
                                                 Class expectedType)
Use this method for expressions that refer to values. This method should perform syntactic validation of the expression. If in doing so it detects errors, it should raise an ELException.

Evaluations performed through this object are not inherently thread safe. It is recommended that developers use the thread safe evaluateELExpression and setELValue methods to get and set values if expressions in the same feature are accessed in multiple threads. If this is not possible, the developer should surround any usages of the returned expression object in a synchronized block, using the object returned by getAdfELContext() as the monitor.

Parameters:
expression - The expression to parse
expectedType - The type the result of the expression will be coerced to after evaluation.
Returns:
The parsed expression
Throws:
ELException - Thrown if there are syntactical errors in the provided expression.
NullPointerException - if paramTypes is null.
See Also:
getAdfELContext(), evaluateELExpression(String), setELValue(String, Object)

getMethodExpression

public static MethodExpression getMethodExpression(String expression,
                                                   Class expectedReturnType,
                                                   Class[] expectedParamTypes)
Use this method for expressions that refer to methods. If the expression is a String literal, a MethodExpression is created, which when invoked, returns the String literal, coerced to expectedReturnType. An ELException is thrown if expectedReturnType is void or if the coercion of the String literal to the expectedReturnType yields an error. This method should perform syntactic validation of the expression. If in doing so it detects errors, it should raise an ELException.

EL Resolution of the method to invoke through this object is not inherently thread safe. If expressions in the same feature are expected to be used in multiple threads, the developer should surround any usages of the returned expression object in a synchronized block, using the object returned by getAdfELContext() as the monitor.

Parameters:
expression - The expression to parse
expectedReturnType - The expected return type for the method to be found. After evaluating the expression, the MethodExpression must check that the return type of the actual method matches this type. Passing in a value of null indicates the caller does not care what the return type is, and the check is disabled.
expectedParamTypes - The expected parameter types for the method to be found. Must be an array with no elements if there are no parameters expected. It is illegal to pass null, unless the method is specified with arguments in the EL expression.
Returns:
The parsed expression
Throws:
ELException - Thrown if there are syntactical errors in the provided expression.
NullPointerException - if paramTypes is null.
See Also:
getAdfELContext()

evaluateELExpression

public static Object evaluateELExpression(String elExpression)
                                   throws AdfException
Evaluates the expression and returns the resulting value.

This method is thread safe, however generic underlying EL evaluation is not. It is recommended that developers use this method to evaluate EL expressions if expressions in the same feature are expected to be used in multiple threads.

Parameters:
elExpression - The expression to be evaluated.
Returns:
The result of the expression evaluation.
Throws:
NullPointerException - if context is null.
PropertyNotFoundException - if one of the property resolutions failed because a specified variable or property does not exist or is not readable.
ELException - if an exception was thrown while performing property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
AdfException
See Also:
getAdfELContext(), getValueExpression(String, Class), setELValue(String, Object)

setELValue

public static void setELValue(String elExpression,
                              Object value)
Sets a property resolved by an EL Expression to a value

This method is thread safe, however generic underlying EL resolution is not. It is recommended that developers use this method to set values through EL expressions if expressions in the same feature are expected to be used in multiple threads.

Parameters:
elExpression - The expression that resolves to the property on which to set the value.
value - The value to set the resolved expression to.
Throws:
NullPointerException - if context is null.
PropertyNotFoundException - if one of the property resolutions failed because a specified variable or property does not exist or is not readable.
ELException - if an exception was thrown while performing property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
See Also:
getAdfELContext(), evaluateELExpression(String), getValueExpression(String, Class)

getELValue

public static Object getELValue(String elExpression)
Gets a property resolved by an EL Expression to a value

This method is thread safe, however generic underlying EL resolution is not. It is recommended that developers use this method to get values through EL expressions if expressions in the same feature are expected to be used in multiple threads.

Parameters:
elExpression - The expression that resolves to the property on which to get the value.
Throws:
NullPointerException - if context is null.
PropertyNotFoundException - if one of the property resolutions failed because a specified variable or property does not exist or is not readable.
ELException - if an exception was thrown while performing property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
See Also:
getAdfELContext(), evaluateELExpression(String), getValueExpression(String, Class)

isEvaluationExpression

public static boolean isEvaluationExpression(String elExpression)
Checks if the passed in expression string is an evaluation expression.

Parameters:
elExpression -
Returns:
true if the el string is an evaluated expression, as opposed to literal text.

flushDataChangeEvent

public static void flushDataChangeEvent()
Flush any pending data change events NOTE: Can only be called from a background thread.


invokeDataControlMethod

public static Object invokeDataControlMethod(String dcName,
                                             String instanceName,
                                             String methodName,
                                             java.util.List parameterNames,
                                             java.util.List parameters,
                                             java.util.List parameterTypes)
                                      throws AdfInvocationException
Invoke a DC operation. The operation does not have to be explicitly added as a methodAction in a pagedef. Parameters do not have to be converted to GenericType. The method will perform the conversion automatically.

Examples of usage:

 public void changePlayerName(ActionEvent evt)
 {
   // call a method that takes an int as a parameter
   List pnames = new ArrayList();
   List params = new ArrayList();
   List ptypes = new ArrayList();
   pnames.add("name");
   ptypes.add(String.class);
   params.add("Bill");
   pnames.add("index");
   ptypes.add(int.class); // the class must be the primitive version for
                          // reflection to find the proper method
   params.add(new Integer(0)); // the value must be the object version here,
                               // reflection will auto unbox the value when
                               // passing
   try
   {
     AdfmfJavaUtilities.invokeDataControlMethod("TeamBean", null, "changePlayerName", pnames, params, ptypes);
   }
   catch (AdfInvocationException ex)
   {
     // If the web service is not available throw a nice exception
     if (AdfInvocationException.CATEGORY_WEBSERVICE.compareTo(ex.getErrorCategory()) == 0)
     {
       throw new RuntimeException("Error with the server.  Please try later.");
     }
   }
 }
 
 public void addNewPlayerAsObject(ActionEvent evt)
 {
   // call a method that takes a bean instance
 
   PlayerBean player = new PlayerBean(); // Application Bean
 
   List pnames = new ArrayList();
   List params = new ArrayList();
   List ptypes = new ArrayList();
 
   player.setName("Morris");
   player.setNumber("53");
   player.setPosition("RD");
 
   pnames.add("player");
   ptypes.add(PlayerBean.class);
   params.add(player);
 
   try
   {
     AdfmfJavaUtilities.invokeDataControlMethod("TeamBean", null, "addPlayer", pnames, params, ptypes);
   }
   catch (AdfInvocationException ex)
   {
     // If the web service is not available throw a nice exception
     if (AdfInvocationException.CATEGORY_WEBSERVICE.compareTo(ex.getErrorCategory()) == 0)
     {
       throw new RuntimeException("Error with the server.  Please try later.");
     }
   }
 }
 
 public void addNewPlayerAsGT(ActionEvent evt)
 {
 
   // call a method that takes a GenericType representation of a bean as a
   // parameter
   // use the GenericType serialization helper class to convert
 
   PlayerBean player = new PlayerBean(); // Application Bean
 
   GenericType gt = null;
   GenericType result = null;
 
   List pnames = new ArrayList();
   List params = new ArrayList();
   List ptypes = new ArrayList();
 
   player.setName("Morris");
   player.setNumber("53");
   player.setPosition("RD");
 
   gt = GenericTypeBeanSerializationHelper.toGenericType("test.mobile.PlayerBean", player);
 
   pnames.add("player");
   ptypes.add(gt.getClass());
   params.add(gt);
   try
   {
     result = (GenericType) AdfmfJavaUtilities.invokeDataControlMethod("TeamBean", null, "addPlayerAsGT", pnames,
                                                                       params, ptypes);
     Object provider = AdfmfJavaUtilities.getDataControlprovider("TeamBean");
 
     GenericTypeBeanSerializationHelper.fromGenericType(provider, result);
   }
   catch (AdfInvocationException ex)
   {
     // If the web service is not available throw a nice exception
     if (AdfInvocationException.CATEGORY_WEBSERVICE.compareTo(ex.getErrorCategory()) == 0)
     {
       throw new RuntimeException("Error with the server.  Please try later.");
     }
   }
 }
 

Parameters:
dcName - The name of the DataControl on which the method (or the nested object that declares the method) is declared.
instanceName - The name of the nested object on the DataControl that declares the method (can be null if the method is on the root DC).
methodName - The name of the method to invoke.
parameterNames - The names of any named parameters. Required, elements must be of type java.lang.String.
parameters - The parameter values. Elements can be of any type.
parameterTypes - The parameter types. Elements must be of type java.lang.Class. Can be null if the data control implementation does not require parameter types for invocation.
Returns:
The Object returned by the invoked method. null if the method returns void. In addition to the direct return, the returned object is also cached in the DataControl and can be resolved via EL of the following form : #{data.dcName.methodResults.methodName_result}, where dcName and methodName are their respective parameter values.
Throws:
AdfInvocationException - on invocation errors

addDataControlProviders

public static int addDataControlProviders(String dcName,
                                          String providerKey,
                                          String keyAttribute,
                                          Object providers,
                                          boolean moreDataAvailable)
Adds Objects as new data providers (i.e. rows) to the DataControl hierarchy. This is required to update the framework so that bindings and iterators based on the DataControl are updated and aware of the new data. This will also notify the View through data change events so that any bound components are rendered with the new data. This operation is typically used in conjunction with the rangeChange event and the invokeDataControl method.

An example implementation of rangeChange shows how this method s used -

 public void rangeChange(RangeChangeEvent rangeChangeEvent)
 {
   if (rangeChangeEvent.isDataExhausted())
   {
     List parameterNames = new ArrayList();
     List parameters = new ArrayList();
     List parameterTypes = new ArrayList();
 
     // populate params...
 
     // invoke the method that gets new data
     Object result = AdfmfJavaUtilities.invokeDataControlMethod("MyWebServiceDC", null, "fetchMoreRowsOfSomeType",
                                                                parameterNames, parameters, parameterTypes);
 
     boolean moreDataAvailable = // whatever the server uses to determine if more
                                 // data is available
 
     // add the new data to the DataControl
     AdfmfJavaUtilities.addDataControlProviders("MyWebServiceDC", rangeChangeEvent.getProviderKey(),
                                                rangeChangeEvent.getKeyAttribute(), result, moreDataAvailable);
   }
 }
 

Parameters:
dcName - The name of the DataControl
providerKey - The name the framework uses to locate the DataControl node on which to add the providers, which is a dot delimited string of accessor names, starting at the root DC (i.e. "root.products.categories"). This is passed in the RangeChangeEvent object in a rangeChange event.
keyAttribute - The name of the provider attribute that acts as the key, if one is defined. Can be null. This is passed in the RangeChangeEvent object in a rangeChange event.
providers - The actual providers to add. This can be a List or an array of provider Objects, or a GenericType that contains a list of providers (typical form of a web service response).
moreDataAvailable - flag to determine if more data is available from the service provider that has not already been loaded in to the data control hierarchy. The framework will use this value to determine whether or not to render links to load more rows on the view components associated with the indicated datacontrol. This should be set to false if the caller can determine there is no more available data to load from the service provider, otherwise should be set to true
Returns:
The number of providers successfully added to the DataControl.
See Also:
RangeChangeListener, RangeChangeEvent, invokeDataControlMethod(String, String, String, List, List, List)

addDataControlProviders

public static int addDataControlProviders(String dcName,
                                          String providerKey,
                                          String keyAttribute,
                                          Object providers,
                                          boolean moreDataAvailable,
                                          boolean isWrappedResponse)
Overload for (String dcName, String providerKey, String keyAttribute, Object providers, boolean moreDataAvailable) which adds a param to indicate the providers object is or is not a wrapped web service response object.

Parameters:
dcName - The name of the DataControl
providerKey - The name the framework uses to locate the DataControl node on which to add the providers, which is a dot delimited string of accessor names, starting at the root DC (i.e. "root.products.categories"). This is passed in the RangeChangeEvent object in a rangeChange event.
keyAttribute - The name of the provider attribute that acts as the key, if one is defined. Can be null. This is passed in the RangeChangeEvent object in a rangeChange event.
providers - The actual providers to add. This can be a List or an array of provider Objects, or a GenericType that contains a list of providers (typical form of a web service response).
moreDataAvailable - flag to determine if more data is available from the service provider that has not already been loaded in to the data control hierarchy. The framework will use this value to determine whether or not to render links to load more rows on the view components associated with the indicated datacontrol. This should be set to false if the caller can determine there is no more available data to load from the service provider, otherwise should be set to true
isWrappedResponse - defaults to true. If the response is not a List or an array, this indicates to the framework that the providers Object is a wrapped response. Can be set to false if the caller wishes to pass a single GenericType that does not have a 'result' attribute which defines the actual collection of data.
Returns:
The number of providers successfully added to the DataControl.
See Also:
RangeChangeListener, RangeChangeEvent, invokeDataControlMethod(String, String, String, List, List, List)

clearPasswordCredential

public static void clearPasswordCredential(String adfCredentialStoreKey,
                                           String username)
                                    throws AdfException
Clear a password credential for the key from the credential store

Parameters:
adfCredentialStoreKey - attribute associated with the login server reference that appears in the connections.xml file.
username - who's credentials will be removed.
Throws:
AdfException

logoutFeature

public static void logoutFeature(String key)
                          throws AdfException
Logout the authentication server associated with key

Parameters:
key - Credential store key
Throws:
AdfException

logout

public static void logout()
                   throws AdfException
Logout the current authentication server

Throws:
AdfException

clearSecurityConfigOverrides

public static void clearSecurityConfigOverrides(String key)
                                         throws AdfException
Clear the security configuration overrides associated with the given key.

Use this API to clear and remove any persisted connection configuration overrides that have been previously set using either overrideConnectionProperty or updateSecurityConfigWithURLParameters. This also clears the connections previously loaded from connections.xml and automatically persisted by framework. It is recommended to call this API in the application lifecycle listener's start method after the new connections.xml is installed. Since the connection overrides are persisted and take precedence over connections.xml it is important to clear the security config overrides prior to use.

Parameters:
key - adfCredentialStoreKey string attribute of the configuration to delete.
Throws:
AdfException

updateSecurityConfigWithURLParameters

public static String updateSecurityConfigWithURLParameters(String configUrlParam,
                                                           String key,
                                                           String message,
                                                           boolean showConfirmation)
                                                    throws AdfException
Update security configuration from URL parameters

NOTE:
Do not call this API from within feature lifecycle listener. Use application life cycle listener instead.

Parameters:
configUrlParam - URL encoded configuration parameter string. The string before encoding should have format below:

<scheme>://[host][:port]/?<parameter1>::=<value1> ;&< parameter2>::=<value2>&...&<parameterN>::=< ;valueN>

Note that the query string has to be of format shown below (parameter and value shall be separated using string "::="). All URL parameters have to be URL encoded using UTF8 Encoding. If URLs are not encoded, query parameters will not be parsed correctly.

Property NameValid ValuesMandatory/Optional
AuthServerTypeFederatedAuthentication
HTTPBasicAuthentication
OAMMSAuthentication
Mandatory
ApplicationNameMandatory
LoginURLMandatory (valid for Fed & HTTP Basic Auth only)
LogoutURLMandatory (valid for Fed & HTTP Basic Auth only)
LoginSuccessURLMandatory (valid for Fed Auth only)
LoginFailureURLMandatory (valid for Fed Auth only)
BrowserModeEmbeddedOptional (valid for Fed Auth only)
OfflineAuthAllowedtrue/falseOptional (valid for HTTP Basic & OAMMS Auth only)
AuthKeyAny valid string using which credentials will be storedOptional
CryptoSchemePlainText
SHA-1
SHA-224
SHA-256
SHA-384
SHA-512
SaltedSHA-1
SaltedSHA-224
SaltedSHA-256
SaltedSHA-384
SaltedSHA-512
AES
Optional (valid for HTTP Basic & OAMMS Auth only) This crypto scheme will be used for encrypting/hashing credentials
SessionTimeOutValuevalue in secondsOptional (valid for HTTP Basic & OAMMS Auth only)
IdleTimeOutValuevalue in secondsOptional (valid for HTTP Basic only)
RequiredTokens<Comma separated list of tokens>Optional (valid for Fed & HTTP Basic Auth only)
OAMMSURLMandatory for OAMMS authentication only
OAMMSServiceDomainMandatory for OAMMS authentication only
key - adfCredentialStoreKey string attribute of the configuration. This key should be used in all reference to the configuration, such as subsequent updates, feature credential key, etc..
message - Additional message to be shown in the confirmation dialog box.
showConfirmation - A boolean flag that defines the confirmation behavior of the API. If set true, a confirmation dialog box is shown and user is asked to accept the configuration change if the configuration for the key already exists in the system. If set false, the new configuration will update the existing configuration for the key unconditionally.
Returns:
new login URL if configuration is changed
Throws:
AdfException

isPrimaryRequestThread

public static boolean isPrimaryRequestThread()
Use it to test if the current thread is a primary thread or not.

Returns:
true if the current thread is the primary thread handling the request.

isBackgroundThread

public static boolean isBackgroundThread()
Use it to test if the current thread is a background thread or not.

Returns:
true if the current thread is a background thread (i.e. not the thread handling an incoming request)

encryptDatabase

public static int encryptDatabase(java.sql.Connection db,
                                  String newPassword)
Encrypt the database with the specified password.

NOTE:
For customers who would like to enforce a specific database encryption algorithm, they should programmatically prepend the proper database encryption prefix to the database driver's encrypt and getConnection calls. i.e.

  public String getDatabaseEncryptedAlgorithmPassword(String userPassword) {
    return (AdfmfJavaUtilities.AES256 + ":" + userPassword);
  }
  ...
  public void setDatabasePassword(String userPassword) {
   AdfmfJavaUtilties.encrypteDatabase(getDatabaseEncryptedAlgorithmPassword(userPassword));
 }
 ...
 public Connection openApplicationDatabaseConnection(String dataSource, String userPassword) {
     return new SQLite.JDBCDataSource(dataSource).getConnection(null, getDatabaseEncryptedAlgorithmPassword(userPassword));
 }
 

Parameters:
db - A previously-opened database connection. If the database is already encrypted, it must also have been opened with the correct password.
newPassword - New password to use when encrypting the database. A particular encryption algorithm may be selected by prefixing one of: 'aes128:', 'aes256:', or 'rc4:' to the password. Note that the entire password, including prefix, must subsequently be specified when opening this now-encrypted database. The default encryption mode AES128 is used when no prefix (or an invalid one) is specified. If no password is specified, the database is permanently decrypted, i.e. no password will be required to subsequently open the database.
Returns:
A constant indicating which encryption mode was used to encrypt the database. One of the Database*Encryption constants.
See Also:
DatabaseNoEncryption, DatabaseAES128Encryption, DatabaseAES256Encryption, DatabaseRC4Encryption, DatabaseDefaultEncryption, decryptDatabase(Connection)

decryptDatabase

public static void decryptDatabase(java.sql.Connection db)
Permanently decrypt a previously-encrypted database

Parameters:
db - A previously-opened database connection. If the database is already encrypted, it must also have been opened with the correct password.
See Also:
encryptDatabase(Connection, String)

loadXliffResourceBundle

public static void loadXliffResourceBundle(String baseName,
                                           String varNameUsed)
                                    throws AdfException
Used to load the resource bundle and store it as a map in the request scope. This allows you to access the message in AMX/HTML. This call is equivalent to amx declaration of: eg.

Parameters:
baseName - Base name where the bundle is present (relative to the project) eg. If ViewControllerBundle.xlf is located in /ViewController/src/mobile then baseName will be: "mobile.ViewControllerBundle"
varNameUsed - Name by which the we will refer this bundle. eg. viewcontrollerBundle
Throws:
AdfException
See Also:
"amx:loadBundle"

getDataControlById

public static DataControl getDataControlById(String dcName)
                                      throws AdfException
Returns the DataControl instance for the specified data control name. This will be the same instance used by the declarative bindings in the current feature.

Parameters:
dcName - The name of the DataControl
Throws:
AdfException - Thrown if cannot not find DataControl by name in the Binding Context.

getDataControlProvider

public static Object getDataControlProvider(String dcName)
                                     throws AdfException
Used to to get the root provider instance from a DataControl. From this, the developer can then navigate the actual datacontrol's provider hierarchy to get the instance (which is already hooked in) to populate.

Parameters:
dcName - The name of the DataControl
Returns:
The root provider instance from a DataControl
Throws:
AdfException - Thrown if cannot not find DataControl by name in the Binding Context.
See Also:
invokeDataControlMethod(String, String, String, List, List, List)

overrideConnectionProperty

public static void overrideConnectionProperty(String connectionId,
                                              String node,
                                              String property,
                                              Object value)
Overrides a connection reference property value with a new value.

Examples of usage:

 Suppose connections.xml defines the following connection:
    <Reference name="rest_server" className="oracle.adf.model.connection.url.HttpURLConnection"
             credentialStoreKey="rest_server" xmlns="" adfCredentialStoreKey="login_server">
      <Factory className="oracle.adf.model.connection.url.URLConnectionFactory"/>
      <RefAddresses>
        <XmlRefAddr addrType="rest_server">
          <Contents>
            <urlconnection name="rest_server" url="http://slc03gce.us.oracle.com:7101">
              <authentication style="challange">
                <type>basic</type>
                <realm>jazn.com</realm>
              </authentication>
            </urlconnection>
          </Contents>
        </XmlRefAddr>
        <SecureRefAddr addrType="username"/>
        <SecureRefAddr addrType="password"/>
      </RefAddresses>
    </Reference>
 
 Execute:
    AdfmfJavaUtilities.overrideConnectionProperty(
                "rest_server",                        // name of the connection reference
                "urlconnection",                      // node name
                "url",                                // attribute name
                "https://slc05zpo.us.oracle.com:7001" // new value
                );
 
 The resulting connection endpoint URL defined in connections.xml ("http://slc03gce.us.oracle.com:7101) 
 will be overridden with "https://slc05zpo.us.oracle.com:7001".
 

Parameters:
connectionId - The name of the connection reference to be updated.
node - name for the node of the overridden property.
property - name for the overridden property.
value - value for the overridden property.
See Also:
updateSecurityConfigWithURLParameters(String, String, String, boolean)

updateApplicationInformation

public static void updateApplicationInformation(boolean gotoDefaultFeature)
Update the current application information based off the current environment and feature definitions. If 'gotoDefaultFeature' is true then the container will also be instructed to navigate to the default feature.

Parameters:
gotoDefaultFeature - set to true if container should go to default feature

invokeACS

public static void invokeACS(String key,
                             String optionalExtraPayload,
                             boolean refreshApplicationState)
Invokes ACS programmatically and updates feature context

Parameters:
key - Credential store key
optionalExtraPayload - Not used (for future use)
refreshApplicationState - When true, re-evaluate access rights (roles and privileges)

Oracle Fusion Middleware Java API Reference for Oracle Mobile Application Framework
2.0.0.0.0

E36392-01

Copyright © 2014 Oracle. All Rights Reserved.