|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile 11g Release 2 (11.1.2.4.0) E27204-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.adfmf.framework.api.AdfmfJavaUtilities
public class AdfmfJavaUtilities
Field Summary | |
---|---|
static java.lang.String |
AES128 Database password prefix to denote AES128 database encryption should be used. |
static java.lang.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 java.lang.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 void |
clearPasswordCredential(java.lang.String adfCredentialStoreKey, java.lang.String username) Clear a password credential for the key from the credential store |
static void |
decryptDatabase(java.sql.Connection db) Permanently decrypt a previously-encrypted database |
static int |
encryptDatabase(java.sql.Connection db, java.lang.String newPassword) Encrypt the database with the specified password. |
static java.lang.Object |
evaluateELExpression(java.lang.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 java.lang.String |
getActiveContextId() Get the active EL context name. |
static AdfELContext |
getAdfELContext() Get the ADF EL context. |
static java.lang.Object |
getDataControlProvider(java.lang.String dcName) Used to to get the root provider instance from a DataControl. |
static java.lang.String |
getDirectoryPathRoot(int typeOfPath) Gets the path to certain writable directory on the device |
static oracle.adfmf.framework.FeatureContext |
getFeatureContext() Get current FeatureContext instance. |
static java.lang.String |
getFeatureName() Get current feature name. |
static MethodExpression |
getMethodExpression(java.lang.String expression, java.lang.Class expectedReturnType, java.lang.Class[] expectedParamTypes) Use this method for expressions that refer to methods. |
static ValueExpression |
getValueExpression(java.lang.String expression, java.lang.Class expectedType) Use this method for expressions that refer to values. |
static java.lang.Object |
invokeDataControlMethod(java.lang.String dcName, java.lang.String instanceName, java.lang.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(java.lang.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(java.lang.String baseName, java.lang.String varNameUsed) Used to load the recourse bundle and store it as a map in the request scope. |
static void |
logout() Logout the current authentication server |
static void |
setELValue(java.lang.String elExpression, java.lang.Object value) Sets a property resolved by an EL Expression to a value |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TemporaryDirectory
getDirectoryPathRoot
, Constant Field Valuespublic static final int ApplicationDirectory
getDirectoryPathRoot
, Constant Field Valuespublic static final int DeviceOnlyDirectory
getDirectoryPathRoot
, Constant Field Valuespublic static final int DownloadDirectory
getDirectoryPathRoot
, Constant Field Valuespublic static final int DatabaseNoEncryption
encryptDatabase
, Constant Field Valuespublic static final int DatabaseAES128Encryption
encryptDatabase
, Constant Field Valuespublic static final int DatabaseAES256Encryption
encryptDatabase
, Constant Field Valuespublic static final int DatabaseRC4Encryption
encryptDatabase
, Constant Field Valuespublic static final int DatabaseDefaultEncryption
DatabaseAES128Encryption
, Constant Field Valuespublic static final java.lang.String AES128
encryptDatabase
, Constant Field Valuespublic static final java.lang.String AES256
encryptDatabase
, Constant Field Valuespublic static final java.lang.String RC4
encryptDatabase
, Constant Field ValuesConstructor Detail |
---|
public AdfmfJavaUtilities()
Method Detail |
---|
public static java.lang.String getDirectoryPathRoot(int typeOfPath)
typeOfPath
- If the value is:
TemporaryDirectory
, ApplicationDirectory
, DeviceOnlyDirectory
, DownloadDirectory
public static oracle.adfmf.framework.FeatureContext getFeatureContext()
public static java.lang.String getFeatureName() throws AdfException
AdfException
public static AdfELContext getAdfELContext()
public static java.lang.String getActiveContextId()
public static ValueExpression getValueExpression(java.lang.String expression, java.lang.Class expectedType)
expression
- The expression to parseexpectedType
- The type the result of the expression will be coerced to after evaluation.ELException
- Thrown if there are syntactical errors in the provided expression.java.lang.NullPointerException
- if paramTypes is null.getAdfELContext
, evaluateELExpression
, setELValue
public static MethodExpression getMethodExpression(java.lang.String expression, java.lang.Class expectedReturnType, java.lang.Class[] expectedParamTypes)
expression
- The expression to parseexpectedReturnType
- 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.ELException
- Thrown if there are syntactical errors in the provided expression.java.lang.NullPointerException
- if paramTypes is null.getAdfELContext
public static java.lang.Object evaluateELExpression(java.lang.String elExpression) throws AdfException
elExpression
- The expression to be evaluated.java.lang.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
getAdfELContext
, getValueExpression
, setELValue
public static void setELValue(java.lang.String elExpression, java.lang.Object value)
elExpression
- The expression that resolves to the property on which to set the value.value
- The value to set the resolved expression to.java.lang.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.getAdfELContext
, evaluateELExpression
, getValueExpression
public static boolean isEvaluationExpression(java.lang.String elExpression)
elExpression
-public static void flushDataChangeEvent()
public static java.lang.Object invokeDataControlMethod(java.lang.String dcName, java.lang.String instanceName, java.lang.String methodName, java.util.List parameterNames, java.util.List parameters, java.util.List parameterTypes) throws AdfInvocationException
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.AdfInvocationException
- on invocation errorspublic 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."); } } }
public static void clearPasswordCredential(java.lang.String adfCredentialStoreKey, java.lang.String username) throws AdfException
adfCredentialStoreKey
- attribute associated with the login server reference that appears in the connections.xml file.username
- who's credentials will be removed.AdfException
public static void logout() throws AdfException
AdfException
public static boolean isPrimaryRequestThread()
public static boolean isBackgroundThread()
public static int encryptDatabase(java.sql.Connection db, java.lang.String newPassword)
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.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)); }
DatabaseNoEncryption
, DatabaseAES128Encryption
, DatabaseAES256Encryption
, DatabaseRC4Encryption
, DatabaseDefaultEncryption
, decryptDatabase
public static void decryptDatabase(java.sql.Connection db)
db
- A previously-opened database connection. If the database is already encrypted, it must also have been opened with the correct password.encryptDatabase
public static void loadXliffResourceBundle(java.lang.String baseName, java.lang.String varNameUsed) throws AdfException
baseName
- Base name where the bundle is present (relative to the project) eg. If ViewControllerBundle.xlf is located in <Application>/ViewController/src/mobile then baseName will be: "mobile.ViewControllerBundle"varNameUsed
- Name by which the we will refer this bundle. eg. viewcontrollerBundleAdfException
amx:loadBundle
public static java.lang.Object getDataControlProvider(java.lang.String dcName) throws AdfException
dcName
- The name of the DataControlAdfException
- Thrown if cannot not find DataControl by name in the Binding Context.invokeDataControlMethod
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile 11g Release 2 (11.1.2.4.0) E27204-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |