This document introduces the Database.com SDK for building Java applications that interact with Salesforce data. It discusses the key components of the SDK including the JPA provider, API connector, and OAuth authentication. It also provides an overview of how to deploy Java applications to Heroku, including using Git for deployment, configuring dynos, and other Heroku features.
4. PARX – ABOUT US Leading Google Enterprise and Salesforce.com consulting partner in German-speaking Europe comprehensive Cloud Computing Services from a single source servicesacrosstheentirevaluechain: consulting, conception, specifications, development, implementation, training, support, projectmanagement offices in Zurich, Munich, Dusseldorf and Vienna founded in 1998
5. PARX – ABOUT US Strategic alliances Google Enterprise Partner Salesforce.com Consultuing Partner Amazon Web Services, Box.net, GoodData & Signavio PARX was among the first salesforce.com, Google Enterprise, and Amazon Web Services partners in Europe
13. Database.com SDK Use Database.com to store your application data Interact with data already written to Database.com Leverage the Database.com user security model to manage data access for your application Extend existing Force.com applications with Java logic
14. Database.com SDK components API Connector JPA Provider OAuth Authentication and Authorization Spring Security Plugin Spring MVC Project Template Code Generation Plugin
15. JPA provider Implements a subset of the JPA 2.0 specification Based on DataNucleus platform Supports most of DN annotations + some custom. Supports additional functionality (SOQL, etc.) Based on Web Services API and Metadata API
21. Querying with JPQL Bulk Delete and Queries JPQL Date (Temporal) Functions JPQL Joins Implicit Joins Explicit Joins (SELECT p FROM Parent p JOIN p.childsc WHERE c.name = ‘examp’) IN Joins (SELECT p FROM Parent p IN (o.childs) c WHERE c.name = 'sample1') Semi-Joins and Anti-Joins Child-Map Joins Relationship Joins (SELECT c FROM Child c WHERE c.Parent.name in ('Parent1', 'Parent2')) MEMBER OF Comparison Operator
22. Querying with SOQL Returning Typed-Object Records String aQS= "SELECT Email, Phone FROM Account WHERE Name = ‘Apple'"; Query aQ= em.createNativeQuery(soqlQuery); List<SObject> results = q.getResultList(); Returning SObject Records Query aQuery= em.createNativeQuery(soqlQuery, User.class); List<User> results = aQuery.getResultList(); Relationship Queries String aQS= "SELECT id, name, (SELECT id, Name FROM Parent_Childs__r)” + + “FROM Parent__c"; Query aQuery= em.createNativeQuery(aQS, Parent.class); List<SObject> results = aQuery.getResultList(); ArrayList<ChildEntity> childs = (ArrayList<Child>) results.get(0).getChilds();
23. OAuth Authentication <filter> <filter-name>AuthFilter</filter-name> <filter-class>com.force.sdk.oauth.AuthFilter</filter-class> <init-param> <param-name>url</param-name> <param-value>URL or a ${Java system property} or ${environment variable}</param-value> </init-param> </filter> <filter-mapping> <filter-name>AuthFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
24. OAuth Authentication Filter parameters securityContextStorageMethod secure-key-file storeUsername logoutFromDatabaseDotCom logoutUrl Spring Security Support
25. Other Limits (DBDC, Force.com, SDK) Native connections Retrieving User Data Spring MVC Project Template Code Generation Plugin
27. Hello world Maven 3.0 Get Force.com/Database.com instance. Open API access to user, get security token mvnarchetype:generate -DarchetypeGroupId=com.force.sdk -DarchetypeArtifactId=springmvc-archetype FORCE_FORCEDATABASE_URL=force://login.salesforce.com?user=test@ciklumjava.com^&password=mypassAndSS mvntomcat:run-war
28. Hello world Add oAuth Add Entities files. Use Code Generation Plugin Perform SOQL/JPQL queries. Add/modify data using Transactions
29. Founded in 2008, Initially PaaS for Ruby. Now supports Ruby, Node.js, Clojure, Python, and Scala. Since September 2011 supports Java.
30. What do we need? Maven 3.0 JDK 1.6+ Heroku account Installed Herokuenv. (inc.Git, Foreman) Java application built on Maven.
31. Next step Configure application using pom.xml Configure Procfileto declare how you want your application executed web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war Run locally. “foreman start” “gitadd .” git commit -m “Are you sure???“ heroku create --stack cedar git push heroku master
32. Heroku is awesome Built-for-Deployment Applications Version Control is the Central Distribution Mechanism. No Need to Externalize Configuration From Your Code Deployment is a Highly Automated Pipeline Process How do Applications use JEE APIs Without a Container? Servlets and JSPs by Tomcat or Jetty. JSF and other rendering frameworks by Mojarra or MyFaces Mail services by SendGrid. JDBC to connect to HerokuPostgres service or Amazon RDS Hibernate or DataNucleus JPA to provide an ORM persistence
34. Something else about heroku Dyno??? Isolation by subvirtualization technologies One request at a time 512MB of memory Web/worker dynos. $0.05 per hour Payment Dynos Database Add-ons
35. THANK YOU! Database.com SDK HEROKU for Java by Alex Kruk Skype: alexandrkruk Email: alex.kruk@parx.com