Download Setting Up An IDE For Use With Proven Practice

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Proven Practice
Setting Up An IDE For Use With
The IBM C8 SDK Samples
Product(s): IBM Cognos 8 BI
Area of Interest: Software Development Kit
Setting Up An IDE For Use With The
IBM C8 SDK Samples
2
Copyright
Copyright © 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC
is an IBM Company. While every attempt has been made to ensure that the
information in this document is accurate and complete, some typographical
errors or technical inaccuracies may exist. Cognos does not accept
responsibility for any kind of loss resulting from the use of information
contained in this document. This document shows the publication date. The
information contained in this document is subject to change without notice.
Any improvements or changes to the information contained in this document
will be documented in subsequent editions. This document contains
proprietary information of Cognos. All rights are reserved. No part of this
document may be copied, photocopied, reproduced, stored in a retrieval
system, transmitted in any form or by any means, or translated into another
language without the prior written consent of Cognos. Cognos and the
Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated)
in the United States and/or other countries. IBM and the IBM logo are
trademarks of International Business Machines Corporation in the United
States, or other countries, or both. All other names are trademarks or
registered trademarks of their respective companies. Information about
Cognos products can be found at www.cognos.com
This document is maintained by the Best Practices, Product and Technology
team. You can send comments, suggestions, and additions to
[email protected] .
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
3
Contents
1 INTRODUCTION ............................................................................................ 4
1.1 ........................................................................................................... PURPOSE... 4
1.2 ..................................................................................................... APPLICABILITY... 4
1.3 .................................................................................. EXCLUSIONS AND EXCEPTIONS... 4
2 STARTING OUT WITH THE COGNOS 8 SDK .................................................. 4
3 SDK SAMPLES USING THE ECLIPSE IDE ....................................................... 5
4 SDK SAMPLES USING THE NETBEANS IDE ................................................. 15
5 SDK SAMPLES IN VISUAL STUDIO.............................................................. 25
6 RESOURCES................................................................................................. 30
6.1 .....................................................................................JAVA TOOLS AND TRAINING. 30
6.2 ............................................................................................................. XPATH. 30
6.3 ........................................................................................................ JAVASCRIPT. 30
6.4 ............................................................................................................... SOAP. 30
6.5 ........................................................................ GENERAL WEB SERVICES REFERENCES. 30
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
4
1 Introduction
1.1
Purpose
This document is intended to help the reader become more comfortable with
the IBM Cognos 8 Software Development Kit (SDK) using the SDK samples in
conjunction with some of the Integrated Development Environments (IDE) that
are available today. The goal of this document is not to make the reader a
programmer but to make the SDK more accessible to those who want to work
their way through the samples, modify and run an existing program or as a self
training guide.
Please note that the IDE’s covered in this document do not construe an
endorsement over other IDE’s that are available. If the reader prefers to use
another IDE, the reader is encouraged to submit a document to the Cognos
Proven Practices group that shows how to use that IDE to set up, build and run
the IBM Cognos 8 SDK samples.
1.2
Applicability
To those new to working with the IBM Cognos 8 SDK on any of the supported
platforms.
1.3
Exclusions and Exceptions
No known exclusions or exceptions at this time.
2 Starting Out With The Cognos 8 SDK
There is extensive documentation available for the IBM Cognos 8 SDK. The
IBM Cognos 8 SDK Getting Started guide contains a comprehensive overview
of the IBM Cognos 8 SDK and it is recommended that the reader be familiar
with the contents of the Getting Started guide be read before continuing with
this document. The IBM Cognos 8 SDK Developer Guide is the comprehensive
reference for writing SDK applications. This document describes all the classes
and relationships that are exposed via the SDK.
The amount of documentation can be overwhelming to those new to the SDK
and it may be helpful to find a balance between reading documentation and
exploring sample code. There are several sample programs installed with the
IBM Cognos 8 SDK that can be used to learn and experiment with the SDK.
The samples can be found in separate directories for each language
underneath the directory <c8 location>/sdk. For example, the Java samples
are <c8 location>/sdk/java.
A Microsoft development environment is required to use the C# or Visual Basic
samples. The Java sample code can be built and run using slightly modified
versions of the scripts that are included with the samples. To use these scripts,
it may be necessary to edit the build and run scripts to point to your Cognos 8
installation and JDK location. The scripts are run from a command window.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
5
It is strongly recommended that an IDE be used for SDK development. The
remainder of this document will focus on setting up the samples using two
popular Java IDEs (Eclipse and NetBeans) and the Microsoft Visual Studio.
Once the samples set up inside the IDE, the steps required to run one of the
sample programs will be shown.
3 SDK Samples using the Eclipse IDE
Launch Eclipse.
The initial dialog will ask for the location where Eclipse can store information
associated with projects. This location is known as a workspace. Typically a
project’s source code will a part of the workspace but it is important to note
that if a project is created using existing source files, these source files will not
reside in the workspace.
Check the highlighted box if Eclipse should always use the same workspace on
startup and not present this dialog.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
If the Welcome screen appears, close the Welcome screen.
Cognos Proprietary Information
6
Setting Up An IDE For Use With The
IBM C8 SDK Samples
7
Eclipse comes with named sets of screens bundled together for particular
purposes. These sets are called perspectives. The Java perspective, shown
below, is the default. If, for some reason, the Java perspective is not
displayed, redisplay it by navigating to Window -> Open Perspective -> Java
Perspective.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
Create a project in Eclipse by navigating to File -> New -> Project -> Java
Project. Choose a Java Project, and press the Next button.
Cognos Proprietary Information
8
Setting Up An IDE For Use With The
IBM C8 SDK Samples
Name the project. In this example the project is named c8samples.
Select the ‘Create project from existing source’ option and navigate to the
directory in which you installed the IBM Cognos 8 SDK.
Press the Next button.
Cognos Proprietary Information
9
Setting Up An IDE For Use With The
IBM C8 SDK Samples
10
Eclipse will automatically build the project once it is defined. Note that there is
an option to specify the default output folder.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
11
Choose the Libraries tab. Notice that the IBM Cognos specific jar files have
been included in the project. Also note the buttons on the right hand side
which allows new libraries and jar files to be added to a project as required.
Press the Finish button.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
Eclipse has now built the project. From the Package Explorer, expand the
c8Samples project
Cognos Proprietary Information
12
Setting Up An IDE For Use With The
IBM C8 SDK Samples
13
As can be seen, there are a several individual programs contained within the
single project. In addition to being able to run theses programs from the
Eclipse IDE, these programs can also be run from from the command line using
run.bat in Windows or run.sh in Unix or Linux.
This example will run the runreport sample program from within the Eclipse
IDE.
Highlight runreport in the Package Explorer, right click and select Run As ->
Run
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
The Run dialog appears. To run the program, set the Main class field to
reportrunner and click the Run button.
Cognos Proprietary Information
14
Setting Up An IDE For Use With The
IBM C8 SDK Samples
15
The results of the program appear in the Console window on the lower part
of the page. The output shows the program connecting to a Cognos 8
dispatcher, running the report, and reporting the results.
4
SDK Samples using the NetBeans IDE
Launch NetBeans.
Create a new project by selecting File -> New Project. The New Project wizard
will appear.
Choose the project type Java Application with Existing Sources and click the
Next button.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
Cognos Proprietary Information
16
Setting Up An IDE For Use With The
IBM C8 SDK Samples
17
Name the project and specify the name of the directory where the project is to
be kept.
Press Next.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
18
In the Existing Sources dialog, press Add Folder. Navigate to the folder where
the Java SDK samples were installed and select it.
Press the Finish button.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
19
On the left hand side in the Projects pane, expand the project that was just
created. Right click on the project and select Properties item to open the
Project Properties window.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
20
Select the libraries category from the Project Properties window. Press the Add
Jar/Folder button on the right hand side, navigate to the directory <c8
install>/bin and select all of the .jar files that begin with CAM. Press Open.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
21
Select the libraries category from the Project Properties window. Press the Add
Jar/Folder button on the right hand side, navigate to <c8 install>/sdk/java/lib
and select all of the .jar files you find there. Press Open.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
Press the OK button.
Cognos Proprietary Information
22
Setting Up An IDE For Use With The
IBM C8 SDK Samples
23
To run the runreport program, select runreport in the Projects pane. From the
menu bar, choose Run –> Run Main Project
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
Look for the program’s output in the Output pane.
Cognos Proprietary Information
24
Setting Up An IDE For Use With The
IBM C8 SDK Samples
25
5 SDK Samples in Visual Studio
NOTE : If using Visual Studio 2003 and the .NET Framework 1.1, ensure that
the hotfix described in the Cognos Knowledge Base document 1016458 has
been applied.
Launch Visual Studio.
Select File- > Open -> Project and browse to the <c8 installation>/sdk/csharp
directory to select the solution AllSamples.sln.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
From the Build Menu, select Build Solution.
Cognos Proprietary Information
26
Setting Up An IDE For Use With The
IBM C8 SDK Samples
27
In the Solution Explorer pane, select the reportrunner program. Expand the
folder to see the csharp_reportrunner_Explain.html and click on it to view the
contents. This file contains instructions on how to build and run this sample
program.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
28
To execute the reportrunner program, open a command window, navigate
under the csharp directory of the sample structure, type reportrunner.exe
and press enter.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
29
Here the executing program reports the connect to the dispatcher, the report
being executed and the end result.
Cognos Proprietary Information
Setting Up An IDE For Use With The
IBM C8 SDK Samples
30
6 Resources
The reader may find that the following links contain information that is useful
when developing applications using the IBM Cognos 8 SDK.
6.1
Java Tools And Training
• www.eclipse.org
• www.netbeans.org
• http://java.sun.com
• http://java.sun.com/developer/onlineTraining/
6.2
XPATH
• http://www.w3schools.com/xpath/default.asp
• http://www.zvon.org/xxl/XPathTutorial/General/examples.html
6.3
JavaScript
• http://www.w3schools.com/js/default.asp
• http://www.ecma-international.org/publications/standards/Ecma262.htm
6.4
SOAP
•
•
•
6.5
http://www.w3schools.com/soap/default.asp
http://www.w3.org/TR/soap/
Microsoft SOAP Toolkit 3.0
General Web Services References
• http://www.looselycoupled.com/
• http://msdn.microsoft.com/webservices/
• http://java.sun.com/webservices/
Cognos Proprietary Information