com
EX.No.:
Date :
Choosing a Container
1. Choose File > New Project. Select Web Application from the Java Web category or
EJB Module from the Java EE category.
2. Name the project CalculWSApplication. Select a location for the project. Click Next.
3. Select your server and Java EE version and click Finish.
1. Right-click the CalculatorWSApplication node and choose New > Web Service.
2. Name the web service CalculatorWS and type org.me.calculator in Package. Leave
Create Web Service from Scratch selected.
3. Click Finish. The Projects window displays the structure of the new web service and
the source code is shown in the editor area.
1. Find the web service's node in the Projects window. Right-click that node.
2. Click Add Operation in either the visual designer or the context menu.
3. In the upper part of the Add Operation dialog box, type add in Name and type int in
the Return Type drop-down list.
4. In the lower part of the Add Operation dialog box, click Add and create a
parameter of type int named i.
5. Click Add again and create a parameter of type int called j.
6. Click OK at the bottom of the Add Operation dialog box. You return to the editor.
7. Similar to sub, mul and div for the above steps.
8. Click Source and view the code that you generated.
package org.me.Calcul;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.ejb.Stateless;
/**
*
* @author 4itb21
www.vidyarthiplus.com
www.Vidyarthiplus.com
*/
@WebService(serviceName="CalculWSApplication")
@Stateless()
public class CalculWSApplication {
/**
* Web service operation
*/
@WebMethod(operationName = "Add")
public int Add(@WebParam(name = "i")
int i, @WebParam(name = "j")
int j) {
//TODO write your implementation code here:
int a=i+j;
return a;
}
/**
* Web service operation
*/
@WebMethod(operationName = "Sub")
public int Sub(@WebParam(name = "i")
int i, @WebParam(name = "j")
int j) {
//TODO write your implementation code here:
int s=i-j;
return s;
}
/**
* Web service operation
*/
@WebMethod(operationName = "Mul")
public int Mul(@WebParam(name = "i")
int i, @WebParam(name = "j")
int j) {
//TODO write your implementation code here:
int m=i*j;
return m;
}
/**
* Web service operation
*/
@WebMethod(operationName = "Div")
public int Div(@WebParam(name = "i")
int i, @WebParam(name = "j")
www.vidyarthiplus.com
www.Vidyarthiplus.com
int j) {
//TODO write your implementation code here:
int d=i/j;
return d; } }
To invoke an operation, fill the method parameter(s) input boxes and click on the
button labeled with the method name.
Methods :
public abstract int org.me.calcul.CalculWSApplication.add(int,int)
( , )
Method parameter(s)
Type Value
int 30
int 5
Method returned
int : "25"
www.vidyarthiplus.com
www.Vidyarthiplus.com
SOAP Request
SOAP Response
1. Choose File > New Project. Select Java Application from the Java category. Name
the project CalculatorWS_Client_Application. Leave Create Main Class selected and
accept all other default settings. Click Finish.
2. Right-click the CalculatorWS_Client_Application node and choose New > Web Service
Client. The New Web Service Client wizard opens.
3. Select Project as the WSDL source. Click Browse. Browse to the CalculatorWS web
service in the CalculatorWSApplication project. When you have selected the web
service, and Leave the other settings at default and click Finish.
4. Double-click your main class so that it opens in the Source Editor. Drag the nodes
below the main() method.
5. Right-click the project node and choose Run
/*
www.vidyarthiplus.com
www.Vidyarthiplus.com
/**
*
* @author 4itb21
*/
public class CalculWS_Client_Application {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i = 3;
int j = 4;
int result = add(i, j);
System.out.println("Result = " + result);
result = sub(i, j);
System.out.println("Result = " + result);
result = mul(i, j);
System.out.println("Result = " + result);
result = div(i, j);
System.out.println("Result = " + result);
}}
compile:
run:
Result = 7
Result = -1
Result = 12
Result = 0
BUILD SUCCESSFUL (total time: 1 second)
Result:
Thus the creation of webservice for calculator application has been executed
successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
EX.No.:
Date :
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.ejb.Stateless;
/**
*
* @author 4itb21
*/
@WebService(serviceName="FactorialWS")
@Stateless()
public class FactorialWS {
/**
* Web service operation
*/
@WebMethod(operationName = "Fact")
public int Fact(@WebParam(name = "Fact")
int Fact) {
//TODO write your implementation code here:
int i,fact=1;
int number=5;//It is the number to calculate factorial
for(i=1;i<=number;i++){
fact=fact*i;
}
System.out.println("Factorial of "+number+" is: "+fact);
return fact; } }
www.vidyarthiplus.com
www.Vidyarthiplus.com
To invoke an operation, fill the method parameter(s) input boxes and click on the
button labeled with the method name.
Methods :
public abstract int org.mefactorial.FactorialWS.fact(int)
5
( )
Method parameter(s)
Type Value
int 5
Method returned
int : "120"
SOAP Request
SOAP Response
www.vidyarthiplus.com
www.Vidyarthiplus.com
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.meFactorial;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.ejb.Stateless;
/**
* @author 4itb21
*/
@WebService(serviceName="FactorialWS")
@Stateless()
public class FactorialWS {
/**
* Web service operation
*/
@WebMethod(operationName = "Fact")
public int Fact(@WebParam(name = "Fact")
int Fact) {
//TODO write your implementation code here:
int i,fact=1;
int number=5;//It is the number to calculate factorial
for(i=1;i<=number;i++){
fact=fact*i; }
System.out.println("Factorial of "+number+" is: "+fact);
return fact;
}}
compile:
run:
Factorial of 5 is: 120
BUILD SUCCESSFUL (total time: 1 second)
Result:
Thus the creation of webservice for Factorial has been verified and executed
successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.no. :
Date :
Creating a Web Application
Aim:
To develop a web application.
Procedure:
www.vidyarthiplus.com
www.Vidyarthiplus.com
SV construction is a genral contracter and offers superior quality to your buildings and
also guarantee<br>
<br></br>
<a href="SV groups is an industry leader in property development.html">SV groups is an
industry leader in property development</a>
<br>
The sv groups of construction is an industry leader in property development. Our
construction is a successful team to complete more then hundred projects sucessfully.
<br></br>
<a href="SV construction ltd.html">SV construction ltd</a>
<br>
Reference<br> Mr.A.Ajur Ravi
Kumar<br>web:www.svconstruction.ac.in<br>email:ajursvconstruction.gmail.com
<br></br>
<a href="Residential.html">Residential construction model</a>
<br>The workforce development arm of the National Association of the Home
Builders.<br>The Employment and Training Administration has worked with industry
leadrs to develop a comprehensive compentery model for residential construction industry
<br></br>
<a href="Replica.html">Replica Models</a>
<br>The Replica Models are constructed from scaled plans drawn from
photograph.<br>The different scales allow for the large exhibits to fit into the display area.
<br></br>
<a href="Branch.html">Our Branches</a><br>
Our branches are held in many places in Tamilnadu.
</body>
</html>
www.vidyarthiplus.com
www.Vidyarthiplus.com
www.vidyarthiplus.com
www.Vidyarthiplus.com
www.vidyarthiplus.com
www.Vidyarthiplus.com
www.vidyarthiplus.com
www.Vidyarthiplus.com
www.vidyarthiplus.com
www.Vidyarthiplus.com
www.vidyarthiplus.com
www.Vidyarthiplus.com
Replica.html
<html>
<head>
<title><h1><i><font color="Brown">The Replica Models </font></i></h1>
</title>
<body>
The Replica Models are constructed from scaled plans drawn from photograph.<br>The
different scales allow for the large exhibits to fit into the display area.
<br></br>
Sign up to
<form method="post" action=" ">
<p><label>Full Name: <input name="Full name" type="text" size="15"
maxlength="25"/></label></p>
<p><label>Email address: <input name="Email address" type="text" size="15"
maxlength="25"/></label></p>
<p><input type="Submit" value="Submit"/>
<input type="reset" value="Cancel"/></p>
</form></body></html>
www.vidyarthiplus.com
www.Vidyarthiplus.com
Branch.html
<html>
<head><Title>Our Branches</title></head>
<Body>
<h1>Our Branches</h1>
<table border="1" width="40%">
<caption><b><font color="rose">Branch Details</font></b></caption>
<thead>
<tr>
<font type="arial" size="6" color="blue">
<th>Address</th>
<th>contact number</th>
</font>
</tr>
</thead>
<tbody>
<tr>
<td>36/38s West street,Shajub road,Ernakulam</td>
<td>8012870616</td>
</tr>
<tr>
<td>47,North Akraharam,Sri rangam,Trichy</td>
<td>9566996531</td>
</tr>
<tr>
<td>South road,Thiruvambur,Kollam</td>
<td>9688738400</td>
</tr>
<tr>
<td>Vellore highways,Chennai-27</td>
<td>9899666531</td>
</tr>
</tbody></table>
</html>
www.vidyarthiplus.com
www.Vidyarthiplus.com
Result:
Thus the creation of web application has been verified and executed successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.no. :
Date :
CREATION OF VIRTUAL MACHINE
Aim:
To create a Virtual Machine.
Procedure:
To install
1. Install a software that can be downloaded.
2. For extension
a) Go to file, click on preferences, then click on extensions, the wizard will be open.
b) Click an add symbol, with the file name & click agree to install.
www.vidyarthiplus.com
www.Vidyarthiplus.com
1. Connect a USB.
2. Go to drive in VM and click USB drives & select a USB device which can be connected.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Result:
Thus the creation of Virtual Machine has been verified and executed successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.no.:
Date :
The basic POM for the project should be similar to the following.
Modify the parent pom.xml to add the following elements. Save your changes.
www.vidyarthiplus.com
www.Vidyarthiplus.com
<dependencyManagement><dependencies><dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
<scope>provided</scope>
</dependency></dependencies></dependencyManagement></project>
The Maven category in the New Projects wizard includes an OSGi Bundle archetype
for creating OSGi bundle projects. When you create an OSGi bundle project, the generated
POM declares the org.osgi.core JAR as a dependency and specifies the maven-bundle-plugin for
building the project.
In this exercise you will use the New Project wizard to create an OSGi bundle project
that will provide a simple interface that will be implemented by other bundles. After you
create the bundle and interface, you will modify the POM to update the dependency on the
org.osgi.core artifact that you specified in the parent POM project.
Choose File > New Project to open the New Project wizard.
Choose OSGi Bundle from Maven category. Click Next.
Type MavenHelloServiceApi for the Project Name.
Click Browse and select the MavenOSGiCDIProject POM project as the Location. Click
Finish.
Right-click the MavenHelloServiceApi project node in the Projects window and choose
Properties.
Select the Sources category in the Project Properties dialog box.
Set the Source/Binary Format to 1.6 and confirm that the Encoding is UTF-8. Click OK.
Right-click Source Packages node in the Projects window and choose New > Java Interface.
Type Hello for the Class Name.
Select com.mycompany.mavenhelloserviceapi as the Package. Click Finish.
Add the following sayHello method to the interface (in bold) and save your changes.
public interface Hello {
String sayHello(String name);
}
Right-click the project node in the Projects window and choose Build.
Choose File > New Project to open the New Project wizard.
Choose OSGi Bundle from the Maven category. Click Next.
Type MavenHelloServiceImpl for the Project Name.
Click Browse and select the MavenOSGiCDIProject POM project as the Location (if not
selected). Click Finish.
Right-click the project node in the Projects window and choose Properties.
www.vidyarthiplus.com
www.Vidyarthiplus.com
An OSGi bundle does not require a bundle activator class, but you can use the start()
method in the activator class, for example, to initialize services or other resources that are
required by the bundle. In this exercise you will add some lines of code to the class that will
print messages to the Output window. This will make it easier for you to identify when the
bundle starts and stops.
Modify the start() and stop() methods in the bundle activator class to add the following lines
(in bold).
www.vidyarthiplus.com
www.Vidyarthiplus.com
Right-click the MavenOSGiCDIProject node in the Projects window and choose Clean and
Build.
Start the GlassFish server if not already started.
Copy the MavenHelloServiceApi-1.0-SNAPSHOT.jar to the
glassfish/domains/domain1/autodeploy/bundles/ directory of your GlassFish installation.
Right-click the GlassFish server node in the Services window and choose View Domain
Server Log if the server log is not visible in the Output window.
Repeat the steps to copy the MavenHelloServiceImpl-1.0-SNAPSHOT.jar to the
autodeploy/bundles directory.
OUTPUT:
HelloActivator :: Start
HelloActivator :: registration of Hello Service successful.
HelloActivator :: Stopped.
Result:
Thus the implementation of new OGSA-complaint has been verified and executed
successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.No.:
Date :
Then, select File --> New –-> Other and choose Web Service.
Select the FirstWebService class as service implementation and to make sure that the
Configuration is setup correctly click on Server runtime.
There set the Web Service runtime as Axis2 (Default one is Axis) and click Ok.
Click Next and make sure Generate a default service.xml file is selected.
Click Next and Start the Server and after server is started you can Finish if you do
not want to publish the Web service to a test UDDI repository.
www.vidyarthiplus.com
www.Vidyarthiplus.com
OUTPUT:
www.vidyarthiplus.com
www.Vidyarthiplus.com
First number : 5
Second number : 7
Result:
Thus the implementation of a Grid service using apache axix has been executed
successfully.
Ex.no. :
Date :
www.vidyarthiplus.com
www.Vidyarthiplus.com
Aim:
To implement a adding two numbers in c using Virtual Machine.
Procedure:
To install
3. Install a software that can be downloaded.
4. For extension
c) Go to file, click on preferences, then click on extensions, the wizard
will be open.
d) Click an add symbol, with the file name & click agree to install.
www.vidyarthiplus.com
www.Vidyarthiplus.com
To compile a c program:
1. Go to “Terminal” which is located in a desktop of virtual machine.
2. To run a program as “gcc add.c”.
3. To compile a program as “./a.out”.
4. Output will be Display in virtual machine screen.
www.vidyarthiplus.com
www.Vidyarthiplus.com
www.vidyarthiplus.com
www.Vidyarthiplus.com
Result:
Thus the implementation of adding two numbers in c by using virtual
machine has been verified and executed successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.no. :
Date :
Aim:
Procedure:
ksriet@ksrietcsevb:~$ su hduser
hduser@ksrietcsevb:/home/ksriet$ cd /usr/local/hadoop/sbin
prerequirement :
create a text file called bala.txt with some line in home directory
create hduser in home directory
save filestream.java in hduser
create fscat directory in hduser directory
create filestream.java in hduser folder(directory create newly in home directory)
mkdir /home/hduser/fscat
/home/hduser/hadoopcore1.2.1.jar d /home/hduser/fscat
/home/hduser/filestream.java
hduser@ksrietcsevb:/usr/local/hadoop/sbin$ ls /home/hduser/fscat
www.vidyarthiplus.com
www.Vidyarthiplus.com
fstream.class
/user/input/bala.txt
Program:
import java.io.InputStream;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
try{
www.vidyarthiplus.com
www.Vidyarthiplus.com
} finally{
IOUtils.closeStream(inputStream);
}}}
INPUT:
(itvcet.txt)
OUTPUT:
Result:
Thus the implementation of reading the content from the file has been executed
successfully.
Ex.No. :
Date :
www.vidyarthiplus.com
www.Vidyarthiplus.com
Aim:
To Write a Word count program that demonstrate the use of Map and Reduce
tasks.
Procedure:
Go to Oracle virtual Box (-> file-> import->select location hadoop ova file and
import)
ksriet@ksrietcsevb:~$ su hduser
Password: hduser
Compile
hduser@ksrietcsevb:/usr/local/hadoop/sbin$ sudo
/usr/lib/jvm/java-8-oracle/bin/javac -classpath/home/hduser/hadoop-core-1.2.1.jar -d
/home/hduser/wc /home/hduser/WordCount.java[sudo] password for hduser:
Found 2 items
www.vidyarthiplus.com
www.Vidyarthiplus.com
“cloud computing and grid computing are newer concepts compared to other large computing
solutions”
Execute
/user/output
PROGRAM:
WordCount.java
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class WordCount {
public static class TokenizerMapper
extends Mapper<Object, Text, Text, IntWritable>{
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
StringTokenizer itr = new StringTokenizer(value.toString());
while (itr.hasMoreTokens()) {
word.set(itr.nextToken());
context.write(word, one);
}}}
www.vidyarthiplus.com
www.Vidyarthiplus.com
Context context
) throws IOException, InterruptedException {
int sum = 0;
for (IntWritable val : values) {
sum += val.get();
}
result.set(sum);
context.write(key, result);
}}
OUTPUT:
Found 2 items
www.vidyarthiplus.com
www.Vidyarthiplus.com
cloud 1
computing 3
and 1
grid 1
are 1
newer 1
concepts 1
compared 1
to 1
other 1
large 1
solutions 1
RESULT:
Thus the implementation of a Word count program that demonstrate the use of Map and
Reduce tasks has been verified and executed successfully.
Ex.no. :
Date :
www.vidyarthiplus.com
www.Vidyarthiplus.com
Output
Result:
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.no. :
Date :
Implementation of virtual machine migration based on the certain condition from
one node to the other
Aim:
To show the virtual machine migration based on the certain condition from one
node to the other.
Procedure:
Existing images can be cloned to a new one. This is useful to make a backup of an
Image before you modify it, or to get a private persistent copy of an image shared by
other user.
To clone an image, execute
$ oneimage clone Ubuntu new_image
Listing Available Images
You can use the oneimage list command to check the available images in the
repository.
$ oneimage list
Result:
Thus the Implementation of virtual machine migration based on the certain
condition from one node to the other has been verified and executed successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.no. :
Date :
Result:
Thus the Implementation of Mount the one node Hadoop cluster using FUSE
has been verified and executed successfully.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Ex.No. :
Date :
Aim:
To write a procedure for installing a storage controller and interacting with it.
Procedure:
VirtualBox Configuration:
1. Check “Enable USB Controller” check box. If the device is USB 2.0 complaint check
“Enable USB 2.0 (EHCI) Controller check box that is Basic USB Configuration
Without Any Filters
2. Click on “Add Filter From Device”.This will bring the pop-up menu with all USB
devices connected to the host.
3. In the pop-up menu scroll down the device you want to access and click on it. Filter
is added for selected device.
1. As soon as you start the virtual machine, Windows will pop-up a Found New
Hardware Wizard.
2. Select “No, Not this time” radio button and click on next, this time wizard will ask
you to choose between installation method.
3. Select “Install the software automatically” and click on next, This will start the driver
installation process.
4. You will get the successful completion dialog box for the driver installation, close that
dialog box and your virtual machine will continue with booting operation. You might
have to do this again if you connect the same device to some other USB port on the
computer.
www.vidyarthiplus.com
www.Vidyarthiplus.com
Result:
Thus the installation of Storage Controller and interacting with that has been done
successfully.
www.vidyarthiplus.com