public class ResourceCache
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ADDRESS |
static int |
APPLICATION |
static int |
COMMAND |
static int |
DEVICE |
static int |
GROUP |
static int |
LANGUAGE |
static int |
OBSOLETE |
static int |
PLATFORM |
static int |
PROVIDER |
static int |
ROLE |
static int |
UNKNOWN
Resource types
|
static int |
USER |
Constructor and Description |
---|
ResourceCache() |
Modifier and Type | Method and Description |
---|---|
static void |
addToCache(java.lang.String id,
Resource res)
Add a resource object to the temporary resource cache.
|
static void |
clearCache()
Empty resource cache
|
void |
commit()
Commit database connection.
|
java.sql.Statement |
createStatement()
Return a newly created SQL Statement object
|
static java.util.Enumeration |
elements(int type)
Return an Enumeration object containing all cached objects
|
static Resource |
get(int type,
java.lang.String id)
Retrieve a cached resource object.
|
boolean |
getAutoCommit()
Get auto commit flag.
|
java.sql.Connection |
getConnection()
Return the current database connection.
|
static java.lang.String[] |
getConnectionInfo(java.lang.String conn)
Helper method to extract User Name, Password and JDBC URL from the
connection string.
|
static Resource |
getFromCache(java.lang.String id)
Retrieve a resource object from the temporary resource cache
|
static boolean |
isEmpty(int type)
Check if the cache for a specific resource type is empty or not.
|
static java.util.Vector |
objects(int type)
Return a
java.util.Vector object containing sorted
Resource objects. |
static void |
print(int type)
Print the content of a cache table.
|
static void |
put(int type,
Resource res)
Put a new resource object in the cache.
|
static void |
put(int type,
java.lang.String id,
Resource res)
Put a new resource object in the cache.
|
static void |
remove(int type,
java.lang.String id)
Remove a Resource object from the cache.
|
static void |
removeFromCache(java.lang.String id)
Remove a resource object from the temporary resource cache
|
void |
setAutoCommit(boolean enable)
Enable/Disbale database connection 'commit'.
|
void |
synchronize(java.lang.String proxyHost,
int proxyPort)
Synchronize resource cache of all running instances of mobile servers.
|
public static final int ADDRESS
public static final int APPLICATION
public static final int COMMAND
public static final int DEVICE
public static final int GROUP
public static final int LANGUAGE
public static final int OBSOLETE
public static final int PLATFORM
public static final int PROVIDER
public static final int ROLE
public static final int UNKNOWN
public static final int USER
public static void addToCache(java.lang.String id, Resource res)
id
- Resource's unique identifier.res
- Resource objectpublic static void clearCache()
public void commit() throws ResourceException
false
, this method will not commit transactions.ResourceException
public java.sql.Statement createStatement() throws java.sql.SQLException
java.sql.Statement
object.java.sql.SQLException
java.sql.SQLException
public static java.util.Enumeration elements(int type)
type
- Resource typepublic static Resource get(int type, java.lang.String id) throws ResourceException
type
- Resource typeid
- Resource IdResourceException
public boolean getAutoCommit()
true
if auto commit is on.public java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.Connection
classjava.sql.SQLException
- in case of an error.java.sql.SQLException
public static java.lang.String[] getConnectionInfo(java.lang.String conn) throws java.lang.IllegalArgumentException
java.String[]
containing User Name, Password and JDBC URLjava.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Resource getFromCache(java.lang.String id)
id
- Resource's unique identifier.public static boolean isEmpty(int type)
type
- Resource typepublic static java.util.Vector objects(int type)
java.util.Vector
object containing sorted
Resource objects.type
- Resource typepublic static void print(int type)
public static void put(int type, Resource res)
type
- Resource typeres
- Resource objectpublic static void put(int type, java.lang.String id, Resource res)
type
- Resource typeid
- Resource Idres
- Resource objectpublic static void remove(int type, java.lang.String id)
type
- Resource typeid
- Resource Idpublic static void removeFromCache(java.lang.String id)
id
- Resource's unique identifier.public void setAutoCommit(boolean enable)
enable
- true
to turn on the auto-commit.public void synchronize(java.lang.String proxyHost, int proxyPort) throws ResourceException
proxyHost
- Proxy server's host name (or IP address)proxyPort
- Proxy server's port numberoracle.lite.resource.ResourceException
ResourceException