public class Device extends Resource
AUTH_TYPE, CONN_MAX_EXCEEDED, DEVICE_DELETE, DEVICE_REGISTER, EMPTY_STR, INVALID_ADDRESS, INVALID_DEVICE, INVALID_DIR, INVALID_ID, INVALID_INF, INVALID_NAME, INVALID_PARAM, INVALID_PLATFORM, INVALID_PROVIDER, INVALID_RESOURCE, INVALID_TYPE, INVALID_URL, NOT_FOUND, NOT_INITIALIZED, NOTIFY_CLASS, NOTIFY_ON_STATUS, NOTIFY_ON_VERIFY, RESOURCE_ENABLED, RESOURCE_VALID, SEP, STR_ANY, STR_BASE_NAME, STR_DMC, STR_EMPTY, STR_FALSE, STR_INF, STR_INF_EXT, STR_ONE, STR_TRUE, STR_WILD, STR_ZERO, SYSTEM_ID, TIME, UPDATE_MAJOR, UPDATE_MINOR, UPDATE_SOFTWARE, UPDATE_SOFTWARE_APPS, UPDATE_SOFTWARE_DMC| Constructor and Description |
|---|
Device(java.lang.String name,
Platform platform,
java.lang.String type)
Create a new logical device in the Mobile Server Repository.
|
Device(java.lang.String name,
Platform platform,
java.lang.String type,
java.lang.String udid,
byte[] token,
java.lang.String pushMagic,
byte[] unlockToken)
Create a new logic device in the repository.
|
Device(java.lang.String name,
java.lang.String type,
User user)
Create an in memory logical device.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLog(java.lang.String desc,
java.sql.Timestamp time,
java.lang.String msg)
Add a new entry in the device log table.
|
boolean |
canUpdate()
Check if this device has enough privilege for software/data update
|
Address |
createAddress(java.lang.String addr,
java.lang.String provId)
Create a new address for this device.
|
long |
getAccessCount()
Get access count.
|
java.sql.Timestamp |
getAccessTime()
Get last access time.
|
Address |
getAddress(java.lang.String addr)
Retrieve a device address from the repository.
|
java.util.Enumeration |
getAddresses()
Retrieve all adresses of this device.
|
java.lang.String |
getClientId()
Get device generated client id.
|
DeviceCommand |
getCommand(java.lang.String cmdId)
Retrieve a specific device command from the repository.
|
java.util.Vector |
getCommands()
Retrieve device command objects from the repository.
|
java.lang.String |
getDirectory(boolean create)
Retrieve device' directory path.
|
long |
getLastSequence()
Get last sequence id.
|
java.util.Enumeration |
getLogs()
Retrieve Device log from the repository.
|
java.lang.String |
getName()
Get device name
|
Platform |
getPlatform()
Retrieve Platform object
|
java.lang.String |
getPlatformVersion()
Retrieve current version of the Oracle Lite Platform installed on
the device.
|
java.lang.String |
getPushMagic() |
java.util.Vector |
getQueuedMessages()
Retrieve all queued message for this device.
|
java.lang.String |
getServerId()
Get system generated server id.
|
byte[] |
getToken() |
java.lang.String |
getType()
Retrieve device type.
|
java.lang.String |
getUdid() |
byte[] |
getUnlockToken() |
User |
getUser()
Return owner 'User' object.
|
java.lang.String |
getUserId()
Get User Id (or device Owner's Id).
|
boolean |
isType(java.lang.String type)
Check if the device type matches given type.
|
void |
queueMessage(java.lang.String msg,
java.lang.String type,
long expire)
Put a message in the device queue.
|
void |
resetDeviceSeqHistory(long seq) |
void |
saveProfile(java.lang.String name,
byte[] value)
Save profile information in the repository.
|
void |
setAccessTime()
Modifiy the last access time of the device.
|
void |
setAccessTime(java.lang.String ver)
Modifiy the last access time of the device.
|
void |
setEnabled(boolean val)
Enable or Disable device object.
|
void |
setName(java.lang.String name)
Set a new device name.
|
void |
setPlatform(Platform platform)
Set
Platform for this device. |
void |
setPrimaryAddress(Address addr)
Set the given address as the primary address of the device.
|
void |
setPushMagic(java.lang.String pm) |
void |
setTemporary()
Temporariliy enable the device.
|
void |
setToken(byte[] token) |
void |
setType(java.lang.String type)
Change device type.
|
void |
setUdid(java.lang.String udid) |
void |
setUnlockToken(byte[] ut) |
boolean |
updateType()
Update the device type if the curernt platform is obsoleted.
|
void |
validate()
Check if the device is enabled or not.
|
boolean |
verifyRequest(long time,
java.lang.String agent,
java.lang.String ctxt)
Check if the request is valid or not.
|
boolean |
verifyRequest(long currentSeq,
java.lang.String agent,
java.lang.String ctxt,
boolean seqBased) |
delete, equals, getAttribute, getId, getKey, hashCode, isEnabled, isSystemResource, isValid, removeAttribute, save, setAttribute, setNew, validateAttributepublic Device(java.lang.String name,
Platform platform,
java.lang.String type)
throws ResourceException
oracle.lite.resource.User.getDeviceByName() or
oracle.lite.resource.ResourceManager.getDevice()name - Device nameplatform - Device platformtype - Device typeoracle.lite.resource.ResourceExceptionResourceExceptionpublic Device(java.lang.String name,
Platform platform,
java.lang.String type,
java.lang.String udid,
byte[] token,
java.lang.String pushMagic,
byte[] unlockToken)
name - Device nameplatform - Device platformtype - Device typeudid - Unique device idtoken - push notification tokenpushMagic - push notificationunlockToken - send ClearPasscode commandpublic Device(java.lang.String name,
java.lang.String type,
User user)
name - Device nametype - Device typeuser - Device userpublic void addLog(java.lang.String desc,
java.sql.Timestamp time,
java.lang.String msg)
throws ResourceException
desc - Short description of the log message.time - Log timemsg - Log message.oracle.lite.resource.ResourceExceptionResourceExceptionpublic boolean canUpdate()
throws ResourceException
oracle.lite.resource.ResourceExceptionResourceExceptionpublic Address createAddress(java.lang.String addr, java.lang.String provId) throws ResourceException
addr - Address string (phone number, URL etc)provId - Id of the Provider (MUST be pre-registered).oracle.lite.resource.Address object.oracle.lite.resource.ResourceExceptionResourceExceptionpublic long getAccessCount()
public java.sql.Timestamp getAccessTime()
java.sql.Timestamp objectpublic Address getAddress(java.lang.String addr) throws ResourceException
addr - Address string.oracle.lite.resource.ResourceExceptionResourceExceptionpublic java.util.Enumeration getAddresses()
throws ResourceException
java.util.Enumeration object containing all
adresses.oracle.lite.resource.ResourceExceptionResourceExceptionpublic java.lang.String getClientId()
Stringpublic DeviceCommand getCommand(java.lang.String cmdId) throws ResourceException
cmdId - Device Command's idoracle.lite.resource.dm.DeviceCommand objectoracle.lite.resource.ResourceExceptionResourceExceptionpublic java.util.Vector getCommands()
throws ResourceException
java.util.Vector object containing all
oracle.lite.resource.dm.DeviceCommand objects.oracle.lite.resource.ResourceExceptionResourceExceptionpublic java.lang.String getDirectory(boolean create)
create - Create directory name if it does not existpublic long getLastSequence()
long objectpublic java.util.Enumeration getLogs()
throws ResourceException
oracle.lite.resource.ResourceExceptionResourceExceptionpublic java.lang.String getName()
public Platform getPlatform() throws ResourceException
oracle.lite.resource.Platform objectoracle.lite.resource.ResourceExceptionResourceExceptionpublic java.lang.String getPlatformVersion()
throws ResourceException
oracle.lite.resource.ResourceExceptionResourceExceptionpublic java.lang.String getPushMagic()
public java.util.Vector getQueuedMessages()
throws ResourceException
java.util.Vector object containing queued messages.oracle.lite.resource.ResourceExceptionResourceExceptionpublic java.lang.String getServerId()
Stringpublic byte[] getToken()
public java.lang.String getType()
public java.lang.String getUdid()
public byte[] getUnlockToken()
public User getUser() throws ResourceException
ResourceExceptionpublic java.lang.String getUserId()
public boolean isType(java.lang.String type)
type - Type string to be checkedpublic void queueMessage(java.lang.String msg,
java.lang.String type,
long expire)
throws ResourceException
msg - Message stringtype - Message typeexpire - Expiration time (in minutes)oracle.lite.resource.ResourceExceptionResourceExceptionpublic void resetDeviceSeqHistory(long seq)
seq - public void saveProfile(java.lang.String name,
byte[] value)
name - Name of the profile informationvalue - Profile information as an array of bytespublic void setAccessTime()
throws ResourceException
ResourceExceptionpublic void setAccessTime(java.lang.String ver)
throws ResourceException
ver - Oracle Lite version numberoracle.lite.resource.ResourceExceptionResourceExceptionpublic void setEnabled(boolean val)
throws ResourceException
setEnabled in class Resourceval - true to enable the deviceoracle.lite.resource.ResourceExceptionResourceExceptionpublic void setName(java.lang.String name)
throws ResourceException
name - Device nameoracle.lite.resource.ResourceExceptionResourceExceptionpublic void setPlatform(Platform platform) throws ResourceException
Platform for this device.platform - Platform objectoracle.lite.resource.ResourceExceptionResourceExceptionpublic void setPrimaryAddress(Address addr) throws ResourceException
addr - oracle.lite.resource.Address object.oracle.lite.resource.ResourceExceptionResourceExceptionpublic void setPushMagic(java.lang.String pm)
public void setTemporary()
public void setToken(byte[] token)
public void setType(java.lang.String type)
throws ResourceException
type - Device type stringResourceExceptionpublic void setUdid(java.lang.String udid)
public void setUnlockToken(byte[] ut)
public boolean updateType()
public void validate()
throws ResourceException
ResourceException - if device is not enabled.ResourceExceptionpublic boolean verifyRequest(long time,
java.lang.String agent,
java.lang.String ctxt)
time - Request timeagent - Name of the request originatorctxt - Context Id of the request
Modifiy the last access time of the device.public boolean verifyRequest(long currentSeq,
java.lang.String agent,
java.lang.String ctxt,
boolean seqBased)