/public/javascripts/dojo/release/dojo/dojox/data/s3/README

http://enginey.googlecode.com/ · #! · 41 lines · 32 code · 9 blank · 0 comment · 0 complexity · acdf81bd745454e0a7893f61ac8df3c8 MD5 · raw file

  1. Using Amazon S3 with Dojo has the following prerequisites:
  2. * You must be signed up to use Amazon S3. You can sign up for Amazon S3 at http://aws.amazon.com/s3.
  3. * Use the provided proxy (/dojox/rpc/s3/proxy.php) with PHP 5.
  4. * proxy.php requires the following modules:
  5. o Crypt_HMAC
  6. o HTTP_Request
  7. To use S3 from Dojo, you need a proxy. You can use the provided proxy example file by renaming
  8. proxy.example-php to proxy.php and then you must enter your Amazon access key and secret access key
  9. into the proxy.php file on line 3 and 4:
  10. $accessKey = "access key";
  11. $secretAccessKey = "secret access key";
  12. You then use the Dojo RPC service with the "PROXIED-PATH" envelope:
  13. dojo.require("dojox.rpc.Service");
  14. dojo.require("dojox.rpc.ProxiedPath");
  15. var s3Buckets = new dojox.rpc.Service({
  16. target:"http://s3.amazonaws.com/",
  17. proxyUrl:"../s3/proxy.php", // the path to the proxy
  18. transport:"REST",
  19. envelope:"PROXIED-PATH",
  20. contentType:"application/json",
  21. services:{
  22. myBucket:{
  23. target:"myBucket",
  24. parameters:[{type:"string"}]
  25. }
  26. }
  27. });
  28. To use the S3 as a Dojo data store you can use the S3JsonRestStore module. First setup an RPC service
  29. as shown above and then pass the RPC service to the S3JsonRestStore:
  30. dojo.require("dojox.data.S3JsonRestStore");
  31. s3Store = new dojox.data.S3JsonRestStore({service:s3Buckets.myBucket}); // and create a store for it
  32. You can then use the s3Store as a normal Read/Write Dojo Data store.