Java Doc for PaymentModule.java in  » 6.0-JDK-Modules » j2me » com » sun » j2me » payment » 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 » com.sun.j2me.payment 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.j2me.payment.PaymentModule

All known Subclasses:   com.sun.j2me.payment.CldcPaymentModule,
PaymentModule
abstract public class PaymentModule implements TransactionProcessor(Code)
This class represents a payment module. An instance of this class accepts payment requests from transaction modules. For each payment request it creates an instance of the Transaction class, set itself as an initial transaction processor of this transaction and adds it to the internal queue.

The internal queue is processed by a background thread created by the instance of the payment module. This thread iterates through the queued transactions and calls their process methods. This changes the internal states of the transactions until they are fully processed and are removed from the queue.

The process method of a transaction delegates the call to the associated transaction processor. This is initially the payment module. That allows him to show a provider selection form. After the user selects the provider for the transaction, the payment module changes the transaction processor of the transaction to the provider's payment adapter. This adapter gets the control over the transaction till it finishes the transaction and returns the control over it back to the payment module. The payment module finally removes the transaction from the transaction queue and notifies the application about the result of the payment.

The notification is done by creating a new transaction record for the finished transaction and adding it to the transaction notification queue which is processed by an extra thread which handles the notifications. Each transaction record is automatically added to the transaction store, so it can be obtained after crashing of the emulator.
version:
  




Constructor Summary
protected  PaymentModule()
     Creates a new instance of PaymentModule.

Method Summary
final public synchronized  intaddTransaction(TransactionModuleImpl transactionModule, int featureID, String featureTitle, String featureDescription, byte[] payload)
     Creates a new transaction from the given payment requests.
final  voidaddTransactionForNotification(TransactionRecord record, TransactionModuleImpl module)
     Adds the given transaction record to the transaction notification queue and associates it with the given payment module.
final  voidaddTransactionsForNotification(TransactionRecord[] records, TransactionModuleImpl module)
     Adds the given transaction records to the transaction notification queue and associates them with the given payment module.
protected  voidassignTransaction(Transaction transaction, int providerID)
     Assigns the given transaction to the provider identified by its identification number.
final  voidcontinueProcessing()
     Signals the transaction processing thread to continue processing of the queued transactions.
protected  PaymentAdaptercreateAdapter(String adapter, String configuration)
     Creates the payment adapter for the given registered adapter name and the adapter configuration string.
abstract public  TransactionModuleImplcreateTransactionModule(Object object)
     It's a factory method for TransactionModuleImpl.
 PaymentAdaptergetAdapter(String name, String configuration)
     Returns the payment adapter for the given registered adapter name and the adapter configuration string.
public static  PaymentModulegetInstance()
     Returns an instance of the PaymentModule class.
final public  intgetNextApplicationID()
     Returns a new application ID, which can be used to store transaction records to the transaction store.
protected static  PaymentInfogetPaymentInfo(Transaction transaction)
     Returns the associated payment information for the given transaction.
abstract protected  TransactionStoregetTransactionStore()
     Returns an instrance of the TransactionStore wich is used for storing of all transaction records produced in the payment module. There is only one such instance, which is returned each time the method is called.
abstract protected  UtilsgetUtilities()
     Returns an instance of Utils subclass.
final protected  int[]getValidProviders(PaymentInfo paymentInfo)
     Returns an array of provider identifiers, which could be used to pay for features.
protected  booleanhandleAutoRequestMode(Transaction transaction)
     Handles the auto request debug mode for the given transaction.
protected  booleanhandleTransactionDebugMode(Transaction transaction)
     Handles the success/failure/random debug mode for the given transaction.
public  booleanisSupportedAdapter(String name)
     Indicates if the given adapter is supported by the device.
abstract protected  voidpreemptDisplay(SecurityToken token, Displayable nextDisplayable)
     Replaces the current Displayable with the new one if the nextDisplayable is not null or it recovers the previous Displayable if the nextDisplayable is null.
public  Transactionprocess(Transaction transaction)
     A method which is responsible for processing of transactions which are not yet assigned to the provider specific adapters or they are finished and need to be removed from the transaction processing queue.
protected static  voidsavePaymentInfo(Transaction transaction)
     Saves the payment information for the given transaction into storage.


Constructor Detail
PaymentModule
protected PaymentModule()(Code)
Creates a new instance of PaymentModule.




Method Detail
addTransaction
final public synchronized int addTransaction(TransactionModuleImpl transactionModule, int featureID, String featureTitle, String featureDescription, byte[] payload) throws TransactionModuleException(Code)
Creates a new transaction from the given payment requests. It sets the payment module as a transaction processor and adds the new transaction to the transaction queue. Returns a generated identification number, which identifies the new transaction.
Parameters:
  transactionModule - the transaction module, which called the method
Parameters:
  featureID - the identifier of the feature to be paid for
Parameters:
  featureTitle - the title of the feature
Parameters:
  featureDescription - the description of the feature
Parameters:
  payload - the payload to be transfered as a part of the payment ornull if no such payload required the identification number of the transaction
throws:
  TransactionModuleException - if there is no more space to storethe new transaction



addTransactionForNotification
final void addTransactionForNotification(TransactionRecord record, TransactionModuleImpl module)(Code)
Adds the given transaction record to the transaction notification queue and associates it with the given payment module. The payment module holds a reference to the listener, which should be notified.
Parameters:
  record - the transaction record
Parameters:
  module - the transaction module



addTransactionsForNotification
final void addTransactionsForNotification(TransactionRecord[] records, TransactionModuleImpl module)(Code)
Adds the given transaction records to the transaction notification queue and associates them with the given payment module. The payment module holds a reference to the listener, which should be notified.
Parameters:
  records - an array of the transaction records
Parameters:
  module - the transaction module



assignTransaction
protected void assignTransaction(Transaction transaction, int providerID)(Code)
Assigns the given transaction to the provider identified by its identification number. It sets the transaction processor of the transaction to the provider's payment adapter.
Parameters:
  transaction - the transaction
Parameters:
  providerID - the provider id



continueProcessing
final void continueProcessing()(Code)
Signals the transaction processing thread to continue processing of the queued transactions. It means that there is at least one transaction in the queue, which is not waiting for some event (an user action, finishing of some payment adapter's thread, etc.).



createAdapter
protected PaymentAdapter createAdapter(String adapter, String configuration) throws PaymentException(Code)
Creates the payment adapter for the given registered adapter name and the adapter configuration string. It returns null if no such adapter can be created.
Parameters:
  adapter - the registered adapter name
Parameters:
  configuration - the adapter configuration string the instance of the payment adapter or null
throws:
  PaymentException - if the adapter configuration stringhas an invalid format



createTransactionModule
abstract public TransactionModuleImpl createTransactionModule(Object object) throws TransactionModuleException(Code)
It's a factory method for TransactionModuleImpl.
Parameters:
  object - the application MIDlet initiating a payment transaction a new instance of a TransactionModuleImpl subclass.
throws:
  TransactionModuleException - indicates a creation failure



getAdapter
PaymentAdapter getAdapter(String name, String configuration) throws PaymentException(Code)
Returns the payment adapter for the given registered adapter name and the adapter configuration string. It either returns an adapter created before for the given combination of name and providerString or creates a new instance if the old one doesn't exist. It returns null if no adapter of the given parameters can be created.
Parameters:
  name - the registered adapter name
Parameters:
  configuration - the adapter configuration string the instance of the payment adapter or null
throws:
  PaymentException - if the adapter configuration stringhas an invalid format



getInstance
public static PaymentModule getInstance()(Code)
Returns an instance of the PaymentModule class. It creates only one instance and reuses it each time the method is called. the instance



getNextApplicationID
final public int getNextApplicationID() throws IOException(Code)
Returns a new application ID, which can be used to store transaction records to the transaction store. the new application ID
throws:
  IOException - if there is a I/O failure while working with thestore



getPaymentInfo
protected static PaymentInfo getPaymentInfo(Transaction transaction)(Code)
Returns the associated payment information for the given transaction.
Parameters:
  transaction - the transaction the payment information



getTransactionStore
abstract protected TransactionStore getTransactionStore()(Code)
Returns an instrance of the TransactionStore wich is used for storing of all transaction records produced in the payment module. There is only one such instance, which is returned each time the method is called. This instance is used from both internal threads of the payment module (TransactionProcessingThread and TransactionNotificationThread) and it is left to an implementation of the TransactionStore to be thread safe. the transaction store



getUtilities
abstract protected Utils getUtilities()(Code)
Returns an instance of Utils subclass. the instance



getValidProviders
final protected int[] getValidProviders(PaymentInfo paymentInfo)(Code)
Returns an array of provider identifiers, which could be used to pay for features.
Parameters:
  paymentInfo - the payment information for the MIDlet whichinitiated the payment the array of provider identifiers



handleAutoRequestMode
protected boolean handleAutoRequestMode(Transaction transaction)(Code)
Handles the auto request debug mode for the given transaction. It's called from the parts of the PaymentModule code where this mode can be applied. If the auto request mode is in effect the transaction state is set accordingly and the method returns true.
Parameters:
  transaction - the transaction true if the transaction is handled in the method(= the auto request mode is in effect)



handleTransactionDebugMode
protected boolean handleTransactionDebugMode(Transaction transaction)(Code)
Handles the success/failure/random debug mode for the given transaction. It's called from the parts of the PaymentModule code where this mode can be applied. If the debug mode is in effect the transaction state is set accordingly and the method returns true.
Parameters:
  transaction - the transaction true if the transaction is handled in the method



isSupportedAdapter
public boolean isSupportedAdapter(String name)(Code)
Indicates if the given adapter is supported by the device.
Parameters:
  name - the name of the adapter true if the given adapter is supported



preemptDisplay
abstract protected void preemptDisplay(SecurityToken token, Displayable nextDisplayable)(Code)
Replaces the current Displayable with the new one if the nextDisplayable is not null or it recovers the previous Displayable if the nextDisplayable is null.
Parameters:
  token - a security token, which allows preempting
Parameters:
  nextDisplayable - the Displayable to show ornull if the recovery of the oldDisplayable is requested



process
public Transaction process(Transaction transaction)(Code)
A method which is responsible for processing of transactions which are not yet assigned to the provider specific adapters or they are finished and need to be removed from the transaction processing queue.
Parameters:
  transaction - the transaction to be processed the processed transaction or null if the transactionshould be removed from the transaction queue



savePaymentInfo
protected static void savePaymentInfo(Transaction transaction)(Code)
Saves the payment information for the given transaction into storage.
Parameters:
  transaction - the transaction



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.