## JSDAI Tutorial

# Hello SDAI

Now let us see how to welcome SDAI. For this an implementation of Java-SDAI, conformance level 3 needs be installed on your computer. Before any operation with SDAI can be performed an SdaiSession must first be opened and closed at the end. Only one object of SdaiSession can exist at a time.

## Example program

    import jsdai.lang.*;                                               // (1)

    public class HelloSDAI {

        public static void main(String argv[]) throws SdaiException { // (2)

            SdaiSession session = SdaiSession.openSession();          // (3)

            Implementation imp = session.getSdaiImplementation();    // (4)

            System.out.println("Hello " + imp.getName() );            // (5)

            session.closeSession();                                   // (6)

        }

    }

1. Import of the Java-package "jsdai.lang" with the kernel SDAI-classes and interfaces so that they can be used by HelloSDAI.
2. In case of errors most SDAI operations throw exceptions of type SdaiException. These exceptions must either be caught or further transferred to the next higher level.
3. The static method openSession of class SdaiSession is invoked to create and open an object of type SdaiSession.
4. SdaiSession has an attribute sdai_implementaion of type Implementation. To retrieve the value of this attribute an application has to invoke the Get Attribute method getSdaiImplementation.
5. The Implementation object supply information of the underlying implementation (see below). The String attribute name can retrieve with the getName method.
6. When the SdaiSession is no longer needed it is closed with closeSession.

## Running the example

`C:\LKSoft\tutorial>javac HelloSDAI.java`

`C:\LKSoft\tutorial>java HelloSDAI`
`Hello J-SDAI SINGLE`

`C:\LKSoft\tutorial>`

Copyright 1998-2000, LKSoftWare GmbH