Part VIII Appendixes
•
To retrieve a delivery context for ALL devices where a specified attribute matches a specified
value:
DeliveryContextFactory.getDeliveryContexts(deliveryContextStor
e, "attributeName","attributeValue")
where deliveryContextStore indicates the established delivery context store to query,
attributeName indicates the device store attribute to match on, and attributeValue indicates
the value of the indicated Device Repository attribute to match on. For example, to retrieve a
delivery context for all devices profiled as PDAs you could use the following:
DeliveryContext[] deliveryContexts =
DeliveryContextFactory.getDeliveryContext(deliveryContextStore,
"isPDA","true")
•
To retrieve a delivery context for ALL devices matching a specified "where" expression:
DeliveryContextFactory.getDeliveryContexts(deliveryContextStor
e, "whereExpression")
where deliveryContextStore indicates the established delivery context store to query and
whereExpression indicates the where expression to evaluate and return all matching devices
for. For example, an alternative way to retrieve a delivery context for all PDA devices would
be:
DeliveryContext[] deliveryContexts =
DeliveryContextFactory.getDeliveryContext(deliveryContextStore
,"IsPDA")
•
Once the DeliveryContextStore is no longer needed it should be destroyed to free up any
resources it may be holding onto (for example, Database connections):
deliveryContextStore.destroy();
The following code block illustrates the use of these methods to establish a Delivery Context
Store and subsequently request a Delivery Context for the SonyEricsson P900.
import java.sql.*;
import com.mobileaware.deliverycontext.*;
public final class DeliveryContextExternalQuery{
public static void main(String args[]){
DeliveryContextStore deliveryContextStore =
DeliveryContextStoreFactory.getDeliveryContextDBStore(
"jdbc:mysql://test7/madb?user=root&password=",
"org.gjt.mm.mysql.Driver");
try{
//Gets the matching device whose Unique Name is root^wml
DeliveryContext deliveryContext1 =
deliveryContextStore,
"DeviceUniqueName",
"root^xhtmlmp^ericsson(xhtml)^sonyericssonp900");
System.out.println("DeviceUniqueName: " +
deliveryContext1.getAttribute("DeviceUniqueName"));
System.out.println("ImgGIFSupported: " +
deliveryContext1.getAttribute("ImgGIFSupported"));
System.out.println("IsPDA: " + deliveryContext1.getAttribute("IsPDA"));
System.out.println("CharsetSupported: " +
deliveryContext1.getAttribute("UAProf.SoftwarePlatform.CcppAccept-Charset"));
194 - BEA WebLogic Mobility Server User Guide
DeliveryContextFactory.getDeliveryContext(
Need help?
Do you have a question about the WebLogic and is the answer not in the manual?