User's Manual
Virtuoso 4.5 Application and Integration Reviewers Guide  
Copyright ©2006 OpenLink Software     
23 
Figure 29 – Testing CLR UDT and distance stored procedure 
Figure 30 - Testing the SOAP Operation, Distance 
3.3.2.1.2 User Defined Types and Java Classes 
The steps used to create a hosted module in Java are the same as the CLR. However, in 
order to access the Java class instances they have to be defined as Virtuoso types using 
CREATE TYPE and specifying LANGUAGE JAVA. Figure 122 and 123 shows the definition 
of the Point class written in Java and the UDT definition in Virtuoso. 
Figure 31 Java code – Point.java 
public class Point implements java.io.Serializable 
{ 
 public double x = 0; 
 public double y = 0; 
 public Point (double new_x, double new_y) 
 { 
  x = new_x; 
  y = new_y; 
 } 
 public double distance (Point p) 
 { 
  return Math.sqrt ((p.x - this.x) * (p.x - this.x) + (p.y - this.y) * (p.y - 
this.y)); 
 } 










