Java Doc for Invocation.java in  » 6.0-JDK-Modules » j2me » javax » microedition » content » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.content 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.microedition.content.Invocation

Invocation
final public class Invocation (Code)
An Invocation contains the parameters that are passed from an invoking application to a content handler and the results that are returned to the application. The parameters are the type, URL, action, content handler ID, and responseRequired. The string and data arguments can be set using Invocation.setArgs setArgs and Invocation.setData setData methods. All of the parameters are provided to the content handler and are returned with the handlers response, if any. Invocation instances are not thread safe, the application must handle any synchronization necessary.

The values of content handler ID, type, URL, and action are used to identify the content handler when invoked by Registry.invoke Registry.invoke . If an Invocation contains an ID then it is used to identify the content handler to be invoked. The other parameters are input to the content handler.

If a type is present, it is used to find handlers that support that type. The application should supply the type if it is known. If the type is not set, then calling the Invocation.findType findType will find the type using the URL to the content.

Invocation Status

The status value indicates the next processing step of the invocation by the content handler. The status of an Invocation can be any of the following:

All status transitions occur only during method calls that involve the Invocation instance. The transitions that occur are specified in the methods that make the change visible. For example, when an invoking application creates a new Invocation, the status is Invocation.INIT INIT . When the application calls Registry.invoke Registry.invoke the status changes to Invocation.WAITING WAITING . When the Registry.getResponse method is invoked, the status will be updated to the appropriate Invocation.OK OK , Invocation.CANCELLED CANCELLED , Invocation.INITIATED INITIATED , or Invocation.ERROR ERROR status from the content handler.

A content handler calls ContentHandlerServer.getRequest ContentHandlerServer.getRequest to get the next request. The request always has the Invocation.ACTIVE ACTIVE status. When the handler is finished acting on the content, the status is set to either Invocation.OK OK , Invocation.CANCELLED CANCELLED , or Invocation.INITIATED INITIATED by the ContentHandlerServer.finish ContentHandlerServer.finish method.

If the handler is chaining, then the new Invocation follows the status transitions of invoke as described above. The status of the previous invocation being chained from is set to Invocation.HOLD HOLD by the Registry.invoke method. The status of the previous Invocation is restored to Invocation.ACTIVE ACTIVE by the Registry.getResponse Registry.getResponse method that returns the status for the new Invocation.

If the content handler application causes faults because it does not properly dequeue and respond to invocations as described in the ContentHandler class, then the status is set to Invocation.ERROR ERROR in the response queued back to the invoking application.

Access to Content

The implementation of the invocation mechanism may save or cache information about the request, the URL, the content type, or content during the invocation. The information may be utilized when the application accesses the content with the Invocation.open open method. The Invocation.getURL method MUST return the original URL unmodified by any implementation specific information.



Field Summary
final public static  intACTIVE
     This Invocation is a new request and is being handled by the content handler.
final public static  intCANCELLED
     The processing of the Invocation was cancelled by the ContentHandler.
final public static  intERROR
     The content handler failed to correctly process the Invocation request.
final public static  intHOLD
     This Invocation is on hold until a chained Invocation is completed.
final public static  intINIT
     This Invocation was just constructed and is being initialized.
final public static  intINITIATED
     The processing of the Invocation has been initiated and will continue.
final public static  intOK
     The content handler successfully completed processing the Invocation.
final public static  intWAITING
     This Invocation has been invoked and is waiting to be complete.

Constructor Summary
public  Invocation()
     Creates a new Invocation.
public  Invocation(String url, String type, String ID)
     Convenient alternative constructor with URL, type, and ID.
public  Invocation(String url, String type)
     Convenient alternative constructor with URL and type.
public  Invocation(String url)
     Convenient alternative constructor with a URL.
public  Invocation(String url, String type, String ID, boolean responseRequired, String action)
     Creates a new instance and initializes it from the specified parameters.
 Invocation(InvocationImpl impl)
     Creates a new Invocation to refer to an InvocationImpl.

Method Summary
public  StringfindType()
     Finds the type of the content in this Invocation. If the getType method return value is non-null, then the type is returned.
public  StringgetAction()
     Gets the action to be performed on the content.
public  String[]getArgs()
     Gets the argument list as an array of Strings.
public  byte[]getData()
     Gets the data for the Invocation.
public  StringgetID()
     Gets the content handler ID for this Invocation.
 InvocationImplgetInvocImpl()
     Gets the InvocationImpl for this Invocation.
public  StringgetInvokingAppName()
     Get the user-friendly name of the application that invoked the content handler.
public  StringgetInvokingAuthority()
     Gets the authority, if any, used to authenticate the application that invoked this request.
public  StringgetInvokingID()
     Gets the ID of the application that invoked the content handler.
public  InvocationgetPrevious()
     Gets the previous Invocation saved in this Invocation by Registry.invoke Registry.invoke or Registry.getResponse Registry.getResponse .
public  booleangetResponseRequired()
     Gets the responseRequired mode for this Invocation. If true, then the invoking application requires a response to the Invocation. the current value of the responseRequiredmode.
public  intgetStatus()
     Gets the status of this Invocation, which can be INIT, WAITING, HOLD, ACTIVE, OK, CANCELLED, INITIATED, or ERROR.
public  StringgetType()
     Gets the content type for the Invocation.
public  StringgetURL()
     Gets the URL for the invocation.
public  Connectionopen(boolean timeouts)
     Creates and opens a Connection to the content addressed by the URL in Invocation.getURL getURL .
public  voidsetAction(String action)
     Sets the action to be performed on the content.
public  voidsetArgs(String[] args)
     Sets the argument list to a new array of Strings.
public  voidsetCredentials(String username, char[] password)
     Provide the credentials needed to access the content.
public  voidsetData(byte[] data)
     Sets the data used for the Invocation.
public  voidsetID(String ID)
     Sets the ID of the content handler for this Invocation.
 voidsetInvocImpl(InvocationImpl invocImpl)
     Sets the InvocationImpl for this Invocation.
public  voidsetResponseRequired(boolean responseRequired)
     Sets the responseRequired mode for this Invocation.
public  voidsetType(String type)
     Sets the type for the Invocation.
public  voidsetURL(String url)
     Sets the URL for the invocation.

Field Detail
ACTIVE
final public static int ACTIVE(Code)
This Invocation is a new request and is being handled by the content handler.



CANCELLED
final public static int CANCELLED(Code)
The processing of the Invocation was cancelled by the ContentHandler. Invocations queued with ContentHandlerServer.finish ContentHandlerServer.finish will have this status.



ERROR
final public static int ERROR(Code)
The content handler failed to correctly process the Invocation request.



HOLD
final public static int HOLD(Code)
This Invocation is on hold until a chained Invocation is completed.
See Also:   Registry.invoke



INIT
final public static int INIT(Code)
This Invocation was just constructed and is being initialized.



INITIATED
final public static int INITIATED(Code)
The processing of the Invocation has been initiated and will continue. This status is only appropriate when the content handler can not provide a response when it is finished.



OK
final public static int OK(Code)
The content handler successfully completed processing the Invocation. Invocations queued with ContentHandlerServer.finish ContentHandlerServer.finish will have this status.



WAITING
final public static int WAITING(Code)
This Invocation has been invoked and is waiting to be complete.
See Also:   Registry.invoke




Constructor Detail
Invocation
public Invocation()(Code)
Creates a new Invocation. The status of the new Invocation object is INIT. The URL, type, ID, action, arguments, and data are set to empty arrays, and initialized to require a response.



Invocation
public Invocation(String url, String type, String ID)(Code)
Convenient alternative constructor with URL, type, and ID. The behavior is identical to new Invocation(url, type, ID, true, null).
Parameters:
  url - the URL of the content to be dispatched;may be null
Parameters:
  type - the content type; may be null
Parameters:
  ID - the ID of the content handler; may be null



Invocation
public Invocation(String url, String type)(Code)
Convenient alternative constructor with URL and type. The behavior is identical to new Invocation(url, type, null, true, null).
Parameters:
  url - the URL of the content to be dispatched;may be null
Parameters:
  type - the content type; may be null



Invocation
public Invocation(String url)(Code)
Convenient alternative constructor with a URL. The behavior is identical to new Invocation(url, null, null, true, null).
Parameters:
  url - the URL of the content to be dispatched;may be null



Invocation
public Invocation(String url, String type, String ID, boolean responseRequired, String action)(Code)
Creates a new instance and initializes it from the specified parameters. The status of the new Invocation is INIT. None of the values are checked until the Registry.invoke Registry.invoke method is called. String arguments or data can be set with Invocation.setArgs setArgs or Invocation.setData setData .
Parameters:
  url - the URL of the content to be dispatched;may be null
Parameters:
  type - the content type; may be null
Parameters:
  ID - the ID of the content handler; may be null
Parameters:
  responseRequired - true if a response isrequired; false otherwise
Parameters:
  action - the action that the content handler should perform on thecontent; may be null



Invocation
Invocation(InvocationImpl impl)(Code)
Creates a new Invocation to refer to an InvocationImpl. And makes the InvocationImpl refer to the new Invocation.
Parameters:
  impl - and InvocationImpl to be associated with this Invocation




Method Detail
findType
public String findType() throws IOException, ContentHandlerException, SecurityException(Code)
Finds the type of the content in this Invocation. If the getType method return value is non-null, then the type is returned.

If the type is null and the URL is non-null, then the content type will be found by accessing the content through the URL. When found, the type is set as if the setType method was called; subsequent calls to Invocation.getType getType and Invocation.findType findType will return the type. If an exception is thrown, the getType method will return null.

The calling thread blocks while the type is being determined. If a network access is needed there may be an associated delay. the non-null content type
exception:
  IOException - if access to the content fails
exception:
  ContentHandlerException - is thrown with a reason ofContentHandlerException.TYPE_UNKNOWNif the type is null and cannot be found from thecontent either because the URL is null or the type isnot available from the content
exception:
  IllegalArgumentException - if the content is accessed viathe URL and the URL is invalid
exception:
  SecurityException - is thrown if access to the contentis required and is not permitted
See Also:   Invocation.setType
See Also:   Invocation.getType




getAction
public String getAction()(Code)
Gets the action to be performed on the content. the content action or null if it has not been set
See Also:   Invocation.setAction



getArgs
public String[] getArgs()(Code)
Gets the argument list as an array of Strings. These values are passed to the content handler and are returned from the content handler. The array is not copied; modifications to array elements will be visible. the arguments array, which MUST NOT be null
See Also:   Invocation.setArgs



getData
public byte[] getData()(Code)
Gets the data for the Invocation. The data is passed to the content handler. The content handler may modify and return the data if it returns a response. the data array, which MUST NOT be null
See Also:   Invocation.setData



getID
public String getID()(Code)
Gets the content handler ID for this Invocation. the ID of the ContentHandler; may benull
See Also:   Registry.forID
See Also:   Invocation.setID



getInvocImpl
InvocationImpl getInvocImpl()(Code)
Gets the InvocationImpl for this Invocation. the InvocationImpl delgate.



getInvokingAppName
public String getInvokingAppName()(Code)
Get the user-friendly name of the application that invoked the content handler. This information is available only if the status is ACTIVE or HOLD. This information has been authenticated only if getInvokingAuthority is non-null. the application's name if status is ACTIVEor HOLD; null otherwise
See Also:   ContentHandler.getID



getInvokingAuthority
public String getInvokingAuthority()(Code)
Gets the authority, if any, used to authenticate the application that invoked this request. This value MUST be null unless the device has been able to authenticate this application. If non-null, it is the string identifying the authority. the authority used to authenticate this applicationand if the status is either ACTIVE or HOLD;otherwise it is null,the application has not been authenticated
See Also:   ContentHandler.getAuthority



getInvokingID
public String getInvokingID()(Code)
Gets the ID of the application that invoked the content handler. This information is available only if the status is ACTIVE or HOLD. This information has been authenticated only if getInvokingAuthority is non-null. the invoking application's ID if the Invocation statusis ACTIVEor HOLD; null otherwise
See Also:   Registry.getID



getPrevious
public Invocation getPrevious()(Code)
Gets the previous Invocation saved in this Invocation by Registry.invoke Registry.invoke or Registry.getResponse Registry.getResponse . Invocations returned by ContentHandlerServer.getRequest ContentHandlerServer.getRequest MUST return null. the previous Invocation, if any, saved when thisInvocation was invoked or returned as a response;may be null
See Also:   Registry.invoke
See Also:   Registry.getResponse



getResponseRequired
public boolean getResponseRequired()(Code)
Gets the responseRequired mode for this Invocation. If true, then the invoking application requires a response to the Invocation. the current value of the responseRequiredmode. Iftrue, then a response must be returned to theinvoking application.
See Also:   Invocation.setResponseRequired



getStatus
public int getStatus()(Code)
Gets the status of this Invocation, which can be INIT, WAITING, HOLD, ACTIVE, OK, CANCELLED, INITIATED, or ERROR. the status of this Invocation
See Also:   Registry.invoke
See Also:   Registry.getResponse
See Also:   ContentHandlerServer.getRequest
See Also:   ContentHandlerServer.finish



getType
public String getType()(Code)
Gets the content type for the Invocation. The type for this Invocation may be set by the application using Invocation.setType setType . The Invocation.findType findType method can be used by an application to find the type by accessing the content via the URL. When found, findType sets the type returned by getType. the content type or null if it has not been set
See Also:   Invocation.setType
See Also:   Invocation.findType



getURL
public String getURL()(Code)
Gets the URL for the invocation. The URL must be equal to the value set with Invocation.setURL setURL . the URL or null if it has not been set
See Also:   Invocation.setURL



open
public Connection open(boolean timeouts) throws IOException, SecurityException(Code)
Creates and opens a Connection to the content addressed by the URL in Invocation.getURL getURL . This method is similar to Connector.open(getURL(), READ, timeouts) but may deliver the content from a cache. The application should use this method to access the content of the URL so that any type or content information cached by the implementation can be utilized. The content is opened in read only mode. Regardless of whether or not the content is cached, the application or content handler must have permission to access the content via the URL.
Parameters:
  timeouts - a flag to indicate that the callerwants timeout exceptions a Connection object
exception:
  ConnectionNotFoundException - is thrown if:
  • the target URL can not be found, or
  • the requested protocol type is not supported

exception:
  NullPointerException - if the URL is null
exception:
  IllegalArgumentException - if a parameter is invalid.
exception:
  IOException - if some other kind of I/O error occurs
exception:
  SecurityException - is thrown if access to theprotocol handler is prohibited



setAction
public void setAction(String action)(Code)
Sets the action to be performed on the content.
Parameters:
  action - the action to be performed on the content;may be null
See Also:   Invocation.getAction



setArgs
public void setArgs(String[] args)(Code)
Sets the argument list to a new array of Strings. The arguments are used by the application to communicate to the content handler and return results from the content handler. The values of the arguments are not checked when they are set. Instead, they are checked during Registry.invoke Registry.invoke to check that none of the values are null.
Parameters:
  args - the String array; may be null.A nullargument is treated the same as a zero-length array
See Also:   Invocation.getArgs



setCredentials
public void setCredentials(String username, char[] password)(Code)
Provide the credentials needed to access the content. Use of the credential is protocol specific.
Parameters:
  username - the username; may be null
Parameters:
  password - the password for the username;may be null



setData
public void setData(byte[] data)(Code)
Sets the data used for the Invocation. The data is used by the application to communicate to the content handler and return data from the content handler. The array is not copied until the Invocation is invoked or finished; modifications to array elements will otherwise be visible.
Parameters:
  data - the byte data array; may be null.A null is treated the same as a zero-length array
See Also:   Invocation.getData



setID
public void setID(String ID)(Code)
Sets the ID of the content handler for this Invocation.
Parameters:
  ID - of the content handler; may be null
See Also:   Invocation.getID



setInvocImpl
void setInvocImpl(InvocationImpl invocImpl)(Code)
Sets the InvocationImpl for this Invocation.
Parameters:
  invocImpl - the InvocationImpl delgate.



setResponseRequired
public void setResponseRequired(boolean responseRequired)(Code)
Sets the responseRequired mode for this Invocation. If true, then the invoking application requires a response to the Invocation. The value in the request can be changed only if the status is INIT.
Parameters:
  responseRequired - true to require a response,false otherwise
exception:
  IllegalStateException - is thrown if the status is notINIT
See Also:   Invocation.getResponseRequired



setType
public void setType(String type)(Code)
Sets the type for the Invocation.
Parameters:
  type - the type to be set for the content; may be null
See Also:   Invocation.getType
See Also:   Invocation.findType



setURL
public void setURL(String url)(Code)
Sets the URL for the invocation.
Parameters:
  url - the URL to be set; may be null
See Also:   Invocation.getURL



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.