|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.panama.messaging.push.Push
A client of Push Server, which sends out messages to Push Server and
queries delivery status from Push Server.
Push Server may be configured in two ways:
1. Public Push gateway: Push gateway provides messaging services to Internet/intranet users.
The communication between Push client and Push gateway is powered by SOAP technology.
Push client must have the URL of Push gateway. It must provide a valid username/password
combination to get services, if the gateway asks so.
For example: Push myPushClient = new Push("http://messenger.oracle.com/push/webservices", "user","passwd");
2. Private Local Push Server: Push client and Push server are running on the same machine.
Push client calls Push server class through java methods call directly without using SOAP or
RPC. No SOAP gateway or authentication is needed for local installation. Push Server provides
services to that Push client only. When constructing Push client for local Push server,
pass 'null' as Push messaging gateway URL in the constructor. Access to Push Server is granted to
local Push client automatically. It's a good idea to provide a user name
for logging and reporting purpose, though it's not required.
For example: Push myPushClient = new Push(null, "user",null);
All APIs are identical for local and SOAP Push gateway.
The following example sends out 'hello world' message to two email recipients and one SMS recipient.
// Email recipients AddressData emailRecipients[] = new AddressData[2]; emailRecipients[0] = new EmailAddressData("john@company.com","to"); emailRecipients[1] = new EmailAddressData("mary@company.com","cc"); // SMS recipient AddressData smsRecipients[] = new AddressData[1]; smsRecipients[0] = new PhoneAddressData("1-333-5551234"); // Packet object Packet pkt = new Packet(); AddressData emailSender = new EmailAddressData("sender@company.com"); AddressData smsSender = new PhoneAddressData("1-222-1234567"); pkt.setFrom(TransportType.EMAIL, emailSender); pkt.setFrom(TransportType.SMS, smsSender); pkt.addRecipients(TransportType.EMAIL, emailRecipients); pkt.addRecipients(TransportType.SMS, smsRecipients); Message msg = new Message(); msg.setContent("Hello World!"); // message body msg.setContentType("text/plain"); msg.setSubject("Hello"); // subject pkt.setMessage(msg); String gatewayURL = "http://messenger.oracle.com/push/webservices"; // create a push client instance Push push = null; try{ push = new Push(gatewayURL,"user name","password"); } catch(PushException e) { e.printStackTrace();} WorkOrder wo[] = null; try { // send message packet to the server wo = push.send(pkt); } catch(PushException e) { System.out.println("**** PushException caught "); e.printStackTrace(); } if(wo != null) { for(int i=0;i< wo.length;i++) System.out.println(wo[i]); // get sending statuses Status status[] = null; try { status = push.getStatus(wo); } catch(PushException e) { e.printStackTrace(); } if(status != null) { for(int i=0;i< status.length;i++) System.out.println(status[i]); } }
PushLite
Constructor Summary |
Push(java.lang.String messagingGatewayURL,
java.lang.String username,
java.lang.String password)
Construct a new Push client instance for an OracleMobile SOAP Messaging push gateway or local Push Server. |
Method Summary |
Type | Method |
---|---|
Status |
getStatus(WorkOrder workOrder)
Get current status of a work order. |
Status[] |
getStatus(WorkOrder[] workOrders)
Get current status of a set of work orders. |
java.lang.String[] |
getSupportedTransports()
Get names of available transport types from Push server. |
java.lang.String |
getVersion()
Get version of Push API. |
void |
removeStatusListener()
Unregister the status listener if any is registered. |
WorkOrder[] |
send(Packet pkt)
Send out message. |
void |
setProxy(java.lang.String host,
int port)
If Push client machine is inside firewall and Push Server is outside firewall, user may need to tell Push client his/her HTTP proxy settings. |
void |
setStatusListener(StatusListener listener)
Set status listener of this Push. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Push(java.lang.String messagingGatewayURL, java.lang.String username, java.lang.String password) throws PushException
messagingGatewayURL
- Complete URL of OracleMobile Push messaging gateway(SOAP).
For example: "http://messenger.oracle.com/push/webservices"username
- username of OracleMobile messaging gateway or local Push Server. null if no username is needed.password
- password of OracleMobile messaging gateway. null if no password is needed.Method Detail |
public void setProxy(java.lang.String host, int port)
host
- host name of proxy For example: proxy.company.comport
- port number of the proxy. For example: 80public WorkOrder[] send(Packet pkt) throws PushException
pkt
- The message packet to be delivered.public java.lang.String[] getSupportedTransports() throws PushException
public Status getStatus(WorkOrder workOrder) throws PushException
public Status[] getStatus(WorkOrder[] workOrders) throws PushException
public java.lang.String getVersion()
public void setStatusListener(StatusListener listener)
listener
- the status listener.public void removeStatusListener()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |