Exp 1-3
Exp 1-3
Exp 1-3
Theory:
App Engine (GAE) is a platform-as-a-service product that provides web app developersand
enterprises with access to Google's scalable hosting and tier 1 internet service.
GAE requires that applications be written in Java or Python, store data in Google Bigtable and
use the Google query language. Noncompliant applications require modification to use GAE.
GAE provides more infrastructure than other scalable hosting services, such as Amazon Elastic
Compute Cloud (EC2). GAE also eliminates some system administration and development
tasks to make writing scalable applications easier.
Google provides GAE free up to a certain amount of use for the following resources:
● processor (CPU)
● storage
● application programming interface (API) calls
● concurrent requests
Users exceeding the per-day or per-minute rates can pay for more of these resources.
Code:
1. Install Google Plugin for Eclipse
Read this guide – how to install Google Plugin for Eclipse. If you install the Google App
Engine Java SDK together with “Google Plugin for Eclipse“, then go to step 2, Otherwise,
fget the Google App Engine Java SDK and extract it.
3. Hello World
Review the generated project directory.
Nothing special, a standard Java web project structure.
HelloWorld/
src/
...Java source code...
META-INF/
...other configuration...
war/
...JSPs, images, data files...
WEB-INF/
...app configuration...
lib/
...JARs for libraries...
classes/
...compiled classes...
The extra is this file “appengine-web.xml“, Google App Engine need this to run and
deploy the application.
File : appengine-web.xml
</appengine-web-app>
4. Run it local
Right click on the project and run as “Web Application“.
Eclipse console :
//...
INFO: The server is running at http://localhost:8888/
30 Mac 2012 11:13:01 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at http://localhost:8888/_ah/admin
File : appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>mkyong123</application>
<version>1</version>
</appengine-web-app>
Figure 1.2 – Sign in with your Google account and click on the Deploy button.
Figure 1.3 – If everything is fine, the hello world web application will be deployed to this
URL – http://mkyong123.appspot.com/
Output:
Experiment-3
Aim:Creating an application in SalesForce.com using Apex Programming Language.
Theory:
Salesforce provides software and services aimed at creating relevant customer
experiences. Businesses can use Salesforce services to better connect with partners,
customers, and potential. Companies can track customer activity, market to customers,
and perform many other tasks using Salesforce CRM customers.
Code:
Sign up to the Salesforce using the following link:
https://developer.salesforce.com/signup
Now, in Developer Console click on File -> New -> Apex Class and Name it as Demo1
Note: If your Apex Class is disabled then signup through the given link:
https://developer.salesforce.com/signup
1. Write the code to create an account.
Similarly, you can add number of records. To retrieve the records go to Query Editor
and type the query language and Execute it.
Follow the same steps: File -> New -> Apex Class and name it as Demo2.
Again click on Debug -> Open Execute Anonymous Window and write the code.
To view the records in Salesforce
Follow the above steps: File -> New -> Apex Class and name it as Demo3.
Again click on Debug -> Open Execute Anonymous Window and write the code.
To view the records in Salesforce go to Setup and search for Accounts and click on it.
Output:
Experiment-2
Aim: The aim of this simplified example is to create a basic inventory tracking system using
Salesforce, allowing you to add and subtract quantities of products in a warehouse.
Theory:
In Salesforce, you can create custom objects to represent entities. In this case, you'd create a
custom object called "Product" and another called "Inventory." The Product object will store
details about each product, and the Inventory object will track the quantity of each product in the
warehouse.
Code:
Product Object:
Here's an Apex trigger that updates the Inventory object when a shipment is received.
if(inventory != null) {
// Update the quantity on hand
inventory.Quantity_On_Hand__c += line.Quantity__c;
inventoryToUpdate.add(inventory);
}
}
}
if(!inventoryToUpdate.isEmpty()) {
update inventoryToUpdate;
}
}
Output:
We have the following data:
When a new shipment with the above details is created, the trigger will update the
corresponding Inventory record. If the initial quantity on hand for product P1 was 50, it would
now be updated to 60, reflecting the addition of the 10 units from the shipment.