The BusinessObjects Enterprise SDK


As described in Table 30.3, the BusinessObjects Enterprise SDK provides the developer with the ability to create client and administrative applications leveraging the entire functionality of the suite. Here you'll begin to learn how to install and use the Enterprise SDK.

Installing the Java SDK

The BusinessObjects Enterprise Java SDK consists of a set of Java classes packaged up in a set of JAR files. These JAR files can be found in the following directory:

C:\Program Files\Common Files\Business Objects\3.0\java\lib


Most Java application servers have the following folder structure for web applications:

\ApplicationFolder     \WEB-INF         \lib         \classes         \src


To make the classes contained in these JAR files available for use, copy them to the lib folder of your web application.

The naming convention for the Java SDK is almost exactly the same as the COM SDK, which makes it easy for developers working on multiple development platforms. The exception to the naming is that rather than dealing with Java objects directly, interfaces are exposed. These interfaces begin with the letter I, for instance, IEnterpriseSession, IInfoStore, and so forth.

Note

BusinessObjects Enterprise XI represents the next generation of the Crystal Enterprise 10 infrastructure. For backward compatibility, program management decided to keep "Crystal" in existing API and package names. New packages for XI will use the "BusinessObjects" namespace.


Business Objects product documentation is actually quite good. Deploying_webintelligence_applications.pdf is beneficial for deployment and customizing_webintelligence.pdf is good for general application development. Please note that not all documentation is actually installed with the product (to make for a faster and smaller footprint install); go to the docs directory on the CD to find the rest! Additionally, Java developers ought to consider consulting the COM windows Help file. This format facilitates finding information fast and the API calls are quite similar to those used in Java.

Installing the .NET SDK

Business Objects has been supporting Microsoft's .NET development platform since its inception. BusinessObjects Enterprise XI provides full .NET support through COM interop assemblies. Fully managed .NET code is planned for future releases. This SDK is intended for use within Microsoft Visual Studio .NET but can also work in other tools, such as Borland C# Builder.

The .NET SDK consists of a set of .NET classes. Like Java, these classes are organized into namespaces. The BusinessObjects Enterprise .NET SDK is contained in the CrystalDecisions.Enterprise namespace. The naming of all the objects is exactly the same as the COM SDK; for instance, SessionMgr and EnterpriseSession. The .NET assemblies (.dll files) that make up the SDK can be found in the following folder:

\Program Files\Common Files\Business Objects\3.0\managed


Unlike Java, these files don't need to be copied anywhere in order to be able to program with them. A developer simply needs to bring up the Project References dialog and select which assemblies he wants to use. Although there is only a single namespace, there are multiple physical DLL files. The naming convention is CrystalDecisions.Enterprise.Module.dll where Module is one of a set of modules that comprise the full Crystal Enterprise SDK. Following are the common assemblies a developer uses:

  • CrystalDecisions.Enterprise.Framework.dll

  • CrystalDecisions.Enterprise.InfoStore.dll

  • CrystalDecisions.Web.dll

CrystalDecisions.Web.dll does not conform to the naming convention of the other assemblies. This is because it is a shared component across Crystal Reports and Crystal Enterprise.

Note

The examples provided in this chapter use the Java SDK. The syntax for .NET SDK is very similar. For .NET developers, many of the snippets shown here have been translated and are available for download at www.usingcrystal.com. Before coding from scratch, .NET developers ought to investigate the .NET component libraries covered in Chapter 31 and in the excellent product documentation.


Creating an Enterprise Session

Accessing the BusinessObjects Enterprise SDK begins with the Session Manager object, SessionMgr, that returns a valid session. The user must authenticate against one or more directory services, including the default, built-in directory whose authentication plugin is called secEnterprise. When using the secEnterprise authentication plugin, user credentials (passwords) are stored as encrypted strings in users' respective InfoObject files in the BusinessObjects Enterprise repository. Excepting secEnterprise, authentication occurs against the directory service, and users and groups flagged for replication within the CMS are replicated on-demand with corresponding objects in the BusinessObjects Enterprise repository.

  • secEntrprise No external directory required

  • secLDAP Customizable LDAP directory adapter

  • secNT Under Internet Information Server (IIS)/COM/.NET, transparent Single Sign-On from the user's Windows desktop is supported

  • secAD Works the same way as with secNT

In step with the drive to provide transparent cross-platform Single Sign-On (SSO), BusinessObjects Enterprise XI also supports CA SiteMinder. In the future, Business Objects plans to support other vendors such as RSA ClearTrust and Tivoli WebSeal. These can be used today through simple modifications of the InfoView application using the SDK.

Additional security plugins, such as secSAP and secPeopleSoft, are installed with the various BusinessObjects Enterprise solution kits for Enterprise Resource Planning (ERP) packages.

Note

These authentication snippets, as well as other code listed or described in this chapter, can be found at www.usingcrystal.com in the Java SDK white-box portal. Authentication code is in a file called _check_authentication.jsp.


The following code logs in the user and captures her BusinessObjects Enterprise session token.

ISessionMgr sm = CrystalEnterprise.getSessionMgr(); IEnterpriseSession es = sm.logon( "Joe", "password", "MY_CMS_NAME",  "secEnterprise" );


Enterprise sessions may also be recreated from a token created from an active session. Typically, such a token is created immediately after logging in the user, subsequently storing it in session or in a token, as shown in the following code.

ILogonTokenMgr ltm = es.getLogonTokenMgr(); logonToken = ltm.createLogonToken("", 8*60, 100);


The logon token can theoretically be used by anyone to access the BusinessObjects Enterprise system, so there are some controls on how long and how many times it can be used. The first argument is the number of seconds the token should live (here, 8 minutes) and the number of times it can be used to reinstantiate the session (here, 100 times). By keeping the EnterpriseSession in application server session memory, the logon token need not be used at all.

The following code shows how to log back onto BusinessObjects Enterprise with the token. This technique is especially useful when session management is on one platform (or application server context) and the BI application is on another. Additionally, as described in Chapter 31, this token can be used to view a document using openDocument without prompting for credentials.

IEnterpriseSession es = sm.logonWithToken(logonToken);


After a user is logged on using either the logon or logonWithToken methods, you need to persist the Enterprise Session in application server memory and then create and persist a logon token in a cookie.

Note

In your application, you might not have a logon page at all. Rather, you have some kind of SSO logic that grabs a username and/or password from the environment and uses it to create a new BusinessObjects Enterprise session. If no password is available, one work-around is to reset the users' password with every logon attemptthereby making entry through a backdoor impossible.


Retrieving Services

After logging on to the SessionMgr with a user credential, the current users' EnterpriseSession object is returned. EnterpriseSession is the key that unlocks the rest of the system. From it, several services may be instantiated by calling the getService method:

  • PSServer Crystal Page Server, the highest performance option for serving reports on demand

  • RASReportService Crystal RAS Server, most useful for introspecting report file (parameters, for example)

  • ReportEngine WebIntelligence Reporting Server

  • InfoStore The BusinessObjects Enterprise repository, which is queried using the Query method, returning InfoObjects

A best practice is to retrieve and cache these services in session during the logon routine if you intend on using them more than once in your code. Otherwise, be sure to cache the service upon creation and check for it the next time as follows:

IReportSourceFactory factoryPS = (IReportSourceFactory)session.getAttribute("PSReportFactory");'  if (factoryPS==null){         factoryPS = (IReportSourceFactory) es.getService("PSReportFactory");         session.setAttribute("PSReportFactory",factoryPS);  }


After you have created a BusinessObjects Enterprise session, the entire SDK is open for business. The EnterpriseSession created with the previous code exposes several useful getter methods for returning the PluginManager, the SystemInfo (which includes descriptive and diagnostic properties), and the current UserInfo (which contains the user profile and related information), as seen in the previous code sample.




Crystal Reports XI(c) Official Guide
Crystal Reports XI Official Guide
ISBN: 0672329174
EAN: 2147483647
Year: N/A
Pages: 365

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net