Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Transactional File System in Java – commons transaction Albert Guo [email_address]
Agenda <ul><li>CMCS Scenario </li></ul><ul><li>Commons Transaction </li></ul><ul><li>Commons Transaction Implementation </...
CMCS Scenario
System Architecture CIS Green Windchill Project Management Document Management Change Management Pro/E Wildfire Pro/E Work...
Scenario
Commons Transaction
Commons Transaction <ul><li>http://commons.apache.org/transaction/ </li></ul>
What is Commons Transaction <ul><li>Whenever you have concurrent access to resources and want to protect them with locks, ...
Commons Transaction Features <ul><li>Commons Transaction might be useful for you when you </li></ul><ul><li>need transacti...
Commons Transaction Implementation
Implementation Steps
1. Initialize FileResourceManager
2. Initialize FileResourceManager  <ul><ul><li>storeDir String - JavaDoc says: &quot;directory where main data should go a...
3. Start FileResourceManager & Start Transaction
4. Modify Resources <ul><li>With the transaction started, you can begin file manipulation. You can perform following opera...
4. Modify Resources
5. Transaction Management
Conclusion
Conclusion <ul><li>If you have to operate on files and cannot afford to loose data, seriously consider using commons-trans...
Upcoming SlideShare
Loading in …5
×

Transactional File System In Java - Commons Transaction

3,671 views

Published on

Published in: Business, Technology
  • Be the first to comment

Transactional File System In Java - Commons Transaction

  1. 1. Transactional File System in Java – commons transaction Albert Guo [email_address]
  2. 2. Agenda <ul><li>CMCS Scenario </li></ul><ul><li>Commons Transaction </li></ul><ul><li>Commons Transaction Implementation </li></ul><ul><li>Conclusion </li></ul>
  3. 3. CMCS Scenario
  4. 4. System Architecture CIS Green Windchill Project Management Document Management Change Management Pro/E Wildfire Pro/E Work Space Pro/E PDMLink Supplier Management GSM Product Management (Part /BOM) Interface Table SAP ERP ProjectLink ODBC xmls, files
  5. 5. Scenario
  6. 6. Commons Transaction
  7. 7. Commons Transaction <ul><li>http://commons.apache.org/transaction/ </li></ul>
  8. 8. What is Commons Transaction <ul><li>Whenever you have concurrent access to resources and want to protect them with locks, Commons Transaction can be right for you. </li></ul><ul><li>Providing lightweight, standardized, well tested and efficient implementations of utility classes commonly used in transactional Java programming. </li></ul><ul><li>The 1.x component is compatible to JDK1.2 . </li></ul>
  9. 9. Commons Transaction Features <ul><li>Commons Transaction might be useful for you when you </li></ul><ul><li>need transactional file access (i.e. ACID transactions on a set of files) </li></ul><ul><li>have resources that need locking - lock managers can do that for you: </li></ul><ul><ul><li>be sure you never forget to release a lock again </li></ul></ul><ul><ul><li>let your code have a timer for a whole block of locks </li></ul></ul><ul><ul><li>have an out-of-the-box solution for hierarchical locks </li></ul></ul><ul><ul><li>plug in your own custom or advanced solutions </li></ul></ul>
  10. 10. Commons Transaction Implementation
  11. 11. Implementation Steps
  12. 12. 1. Initialize FileResourceManager
  13. 13. 2. Initialize FileResourceManager <ul><ul><li>storeDir String - JavaDoc says: &quot;directory where main data should go after commit&quot;. </li></ul></ul><ul><ul><li>workDir String - JavaDoc says: directory where transactions store temporary data. </li></ul></ul><ul><ul><li>next parameter is a boolean that indicates if the path should be URL encoded. In our example it is false, indicating that we have simple path with no spaces or i18n characters in it. </li></ul></ul><ul><ul><li>sLogger LoggerFacade - JavaDoc says: the logger to be used by this store. </li></ul></ul>
  14. 14. 3. Start FileResourceManager & Start Transaction
  15. 15. 4. Modify Resources <ul><li>With the transaction started, you can begin file manipulation. You can perform following operations: </li></ul><ul><ul><li>copyResource </li></ul></ul><ul><ul><li>createResource </li></ul></ul><ul><ul><li>deleteResource </li></ul></ul><ul><ul><li>moveResource </li></ul></ul><ul><ul><li>writeResource </li></ul></ul><ul><li>In our example, we’ll demo createResource and writeResource </li></ul>
  16. 16. 4. Modify Resources
  17. 17. 5. Transaction Management
  18. 18. Conclusion
  19. 19. Conclusion <ul><li>If you have to operate on files and cannot afford to loose data, seriously consider using commons-transactions package. </li></ul><ul><li>It is probably better then any custom mechanism you can come up with. It supports 2 phase commit. </li></ul><ul><li>With a little work, you could probably make it into an XA compliant resource. </li></ul>

×