Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Virtualization Demoette… Custom Java Procedures

Similar presentations


Presentation on theme: "Data Virtualization Demoette… Custom Java Procedures"— Presentation transcript:

1 Data Virtualization Demoette… Custom Java Procedures
Hello, and welcome to the Demoette series for Cisco Information Server, or CIS. In this Demoette, we demonstrate the use of Custom Java Procedures.

2 Agenda What are they and why do they matter? A basic demo Summary
Here is our agenda. We begin by defining custom java procedures and outlining their importance for our customers. Next we walk through a very basic demo of building and using a custom java procedure Finally, we summarize the contents of this demoette.

3 Agenda What are they and why do they matter? A basic demo Summary
Let’s begin by discussing what custom java procedures are, and why they are important for our customers.

4 What are they? Custom Java Procedures (CJP)
An API that enables Java code to interact with CIS CIS provides a set of interfaces to be implemented The CJP is installed as a data source in CIS CIS provides an API that enables java programmers to write code that interacts with CIS. The API is an interface that the java programmer implements. A custom java procedure, or CJP, is installed in CIS as a type of data source.

5 Why do they matter? Custom Java Procedures (CJP)
Interface custom applications with CIS Add functional capabilities to CIS Flexible usage patterns: Stand-alone procedure Rendered as a view Seamless interaction with SQL Script procedures Custom function Cached and published like any other CIS resource Custom java procedures are important to our customers for three reasons. First, they provide a way to connect CIS to custom applications that do not provide a standards-based API. Second, they enable customers to add functional capabilities to CIS, such as complex validation logic or other algorithms. Third, they allow java code to be used in CIS in very flexible ways. CJPs may be used as stand-alone procedures, or embedded in views. They can be called by CIS SQL Script procedures, and promoted to custom functions. Like any other CIS resource, CJPs may be cached and published.

6 Agenda What are they and why do they matter? A basic demo Summary
Next, let’s walk through a very basic demo that shows the use of a custom java procedure.

7 Demo: Here is the business problem…
Customers CIS Magic 8 Ball: Answers any question Corporate Warehouse: Stores questions Here is the business problem that we illustrate in this demo. This company earns revenue by answering questions asked by its customers. To answer these questions, the company has developed a Magic 8 Ball application, which can provide an answer to any question. The questions themselves are stored in a corporate data warehouse. This company would like to use CIS to provide a federated view of questions and answers. However, the Magic 8 Ball application does not provide any type of standard interface, such as JDBC, ODBC, ADO.NET, ODATA, or web services, that would allow CIS to access it as a standard data source. We’ll use a custom java procedure to integrate the Magic 8 Ball with CIS.

8 Demo: Before you begin…
Install Node.js Download Magic8Ball.js Import .CAR file Some setup is required before you begin this demo. First, we need to install Node.js, which is a Javascript server. Our Magic 8 Ball is implemented in Javascript. Next, download the Magic 8 Ball application and set it up to run in Node. Finally, import the .CAR file for this demoette into CIS. This will install the custom java procedure, define the data source connection to the data warehouse, and install a set of CIS resources that use the Magic 8 Ball. The data warehouse is hosted on a web site, and should run without any additional configuration when you import the .CAR file. Complete instructions for these steps are found in the additional resources that accompany this demoette.

9 Demo: Examine the CJP code
Now we are ready to begin our demo. Let’s begin by examining the structure of the java code that makes up the CJP. In this example, we use the NetBeans IDE to develop our code. <CLICK> Our development process involves creation of a java class… <CLICK> … which uses a library supplied by CIS. <CLICK> The final product is a Jar file that we can import into CIS.

10 Demo: Examine the CJP code
CustomProcedure is the interface we must implement. Some of its methods are called when CIS introspects the CJP, and others are called at execution time.

11 Demo: Examine the CJP Introspection methods
Let’s examine the methods that are called at introspection time. GetParameterInfo() returns information about the procedure’s input and output parameters. <CLICK> GetName() returns a short name for the procedure. <CLICK> GetDescription() returns a description of the procedure.

12 Demo: Examine the CJP Execution methods
Now let’s examine the methods that are called at execution time. The invoke method runs the procedure. <CLICK> For this basic demo, we simply execute the Magic 8 Ball javascript as a new process, passing the question as a command-line parameter. <CLICK> The Magic 8 Ball writes its answer to the standard output, and it is piped back to the java code. <CLICK> CIS can then call GetOutputValues() to retrieve the response from the Magic 8 Ball. <CLICK> The GetNumAffectedRows() method returns the number of rows that were updated, inserted, or deleted. Since the Magic 8 Ball only returns data, we return zero here. <CLICK> CIS calls the Close() method when the procedure is no longer needed. The CustomProcedure interface also includes a set of methods for data sources that implement transactional behavior. These methods are beyond the scope of this introductory demo.

13 Demo: Prepare the CJP for CIS import
Our code is complete, and now we can prepare it for import into CIS. To do this, we compile the code using the same java version that CIS is using. Note that we include the location of the csext.jar file in the classpath. <CLICK> After compilation, we jar the class file. The jar is what we will import into CIS.

14 Demo: Define the CJP in CIS
Now we can define the Custom Java Procedure in CIS. We select New Data Source, and choose Custom Java Procedure as the Data Source Adapter. <CLICK> We have placed the CJP jar in CIS’s conf/customjars directory. This is a convenient place to put it, because it is the same location that CIS will choose if we later export the CJP as a .CAR and import it into another CIS system. <CLICK> Now we see the M8B resource, which is the “short name” we used in the CJP code. We select it and introspect it. <CLICK> When introspection is complete, the CIS Studio namespace shows the Magic8Ball data source with the M8B procedure.

15 Demo: Using the CJP… as a stand-alone Procedure
If we open M8B and execute it as a stand-alone procedure, we can enter a question… <CLICK> … and receive an answer.

16 Demo: Using the CJP… as a View
We can also create a View by dragging M8B onto a View palette. When we create the view, we enter a question. <CLICK> As the SQL tab shows, this question is permanently embedded in the view… <CLICK> … which is a valuable approach for questions with constantly-changing answers.

17 Demo: Using the CJP… as a helper Procedure
Next, we’ll use M8B as a helper Procedure. This procedure accepts a question, calls M8B to get an answer, and then embellishes the answer with additional text. <CLICK> We pass in a question… <CLICK> … and our response is returned. Notice how SQL Script and Java code can freely interact in CIS.

18 Demo: Using the CJP… in a Transformation
We can also use our Custom Java Procedure in a Transformation. We drag it into the transformation… <CLICK> … feed it a question… <CLICK> … and use the response as part of a new data structure.

19 Demo: Using the CJP… as a Custom Function
Because our custom java procedure returns a single scalar output, we can promote it to a Custom Function in CIS. To do this, open the Administration menu in Studio, select Custom Functions, and select the checkbox for M8B. Now we can use our custom java procedure in even more interesting ways.

20 Demo: Using the CJP… as a Custom Function
As we noted earlier, our corporate data warehouse holds a repository of questions. Let’s modify this view so it contains both questions and answers. <CLICK> On the Grid Panel, we create a new column. This column simply repeats the Question column, but we wrap it with the new M8B function, which will transform the question into an answer. <CLICK> Now when we execute, our virtual view presents both questions and answers. This makes our data warehouse appear to be much bigger and more powerful than its actual physical contents would indicate.

21 Demo: Using the CJP… as a Custom Function
Our custom function also has interesting implications for transformations. Our earlier transformation used M8B as a Resource. Here we make a new transformation that uses a slightly different approach. Instead of using M8B as a resource, we use it as a Function in an Expression that wraps the input parameter. <CLICK> We enter the parameter, which is passed to the expression… <CLICK> … and the answer is returned. Our demo is complete.

22 Agenda What are they and why do they matter? A basic demo Summary
Let’s summarize what we have seen in this presentation.

23 Summary An API that enables Java code to interact with CIS
CIS provides a set of interfaces to be implemented The CJP is installed as a data source in CIS Interface custom applications with CIS Add functional capabilities to CIS Flexible usage patterns: Stand-alone procedure Rendered as a view Seamless interaction with SQL Script procedures Custom function Cached and published like any other CIS resource CIS provides an API that enables java programmers to write code that interacts with CIS. The API is an interface that the java programmer implements. A custom java procedure, or CJP, is installed in CIS as a type of data source. Custom java procedures are important to our customers for three reasons. First, they provide a way to connect CIS to custom applications that do not provide a standards-based API. Second, they enable customers to add functional capabilities to CIS, such as complex validation logic or other algorithms. Third, they allow java code to be used in CIS in very flexible ways. CJPs may be used as stand-alone procedures, or embedded in views. They can be called by CIS SQL Script procedures, and promoted to custom functions. Like any other CIS resource, CJPs may be cached and published. Thank you.

24 TOMORROW starts here.


Download ppt "Data Virtualization Demoette… Custom Java Procedures"

Similar presentations


Ads by Google