The following illustration shows the JCnfDemo architecture:

Note: To keep the illustration clear, not all of the links are shown. Conf, Channel, and JCnfDemo implement most of the J*Def interfaces.
The jninmss library uses native code through Java. It provides a link between classes and C structures, and forwards the commands to the Natural Access libraries.
The JCnfDemo consists of the following packages:
|
Package |
Files |
Description |
|---|---|---|
|
GUI files |
Contains the graphical user interface, conf, and channel classes. | |
|
cnfdemo |
JCnfDemo.java |
JCnfDemo is the main class. It provides the GUI and launches the conf and channel threads. |
|
cnfdemo |
Conf.java |
Conf is a thread that listens and sends conference events. |
|
cnfdemo |
Channel.java |
Channel is a thread that listens and sends channel events. |
|
JAdiDef.java, JAdiApi.java, JNccDef.java, JNccApi.java, JCnfDef.java, JCnfApi.java, JVceDef.java, JVceApi.java, JSwiDef.java, JSwiApi.java, JCtaDef.java, JCta.java, JNMSSLoader.java, JNccApi.java, JNccDef.java, JSwiApi.java, JSwiDef.java, JVceApi.java, JVceDef.java, common.cpp, common.h, jadiapi.cpp, jcnfapi.cpp, jcta.cpp, jnccapi.cpp, jswiapi.cpp, jvceapi.cpp |
The J*Def.java files are interface files that wrap the structures defined in *def.h. The J*Api.java files consist of the J*Api class definition that wrap the *api library from Natural Access. *.cpp files are native wrappers of Natural Access libraries. |
A java class, a java interface, and a native wrapper represent each Natural Access service.
The following illustration shows the architecture of the cnfdemo package:

The following table describes the classes:
|
Class/interface |
Description |
|---|---|
|
JCnfDemo |
Entry point. Launches the graphical user interface for NaturalConference and the channels with Natural Access services. |
|
Conf |
Thread to receive Natural Access events. |
|
Channel |
Thread corresponding to a line. |
|
Cst_channel |
Interface. |
|
DemoImages |
Loads images. |
|
JcnfViewer |
Conference activity viewer. |
|
CnfMutableTreeNode |
Node from the tree to represent resource, conference, or member. |
|
BoardConfig |
Class to read/write configuration. |
|
JAboutDialog |
Dialog box when asking about information. |
|
JOpenResDlg |
Dialog box when opening resource. |
|
JCreateConference |
Dialog box when creating conference. |
|
JResizeConference |
Dialog box when resizing conference. |
|
JJoinConference |
Dialog box when joining a conference. |
|
JBoardConfig |
Dialog box when configuring the demo. |
Cnfdemo package implements interfaces of the jninmss package because Conf and Channel use the jninmss package.
Java conferencing belongs to the jninmss package. jninmss consists of two files:
JCnfDef.java
JCnfApi.java
Because JCnfDef.java implements an interface, java classes should implement JCnfDef.java to use the CNF API.
JCnfDef contains all the constants relative to the CNF API, and all the definitions of classes that wrap the C structures used in the C CNF API.
The following code sample is an extract from the JCnfDef.java file:
public interface JCnfDef
{
// Constants definition
/*------------------------------------------------------------------------
CNF Service ID.
*/
public static int CNF_SVCID = 0x1A;
/*
* Base number for defining other keys
*/
public static int CNF_BASEID = 0x001A0000;
// Other constants definition
[...]
// C structures wrapped by java classes:
/* Conference parameters (used in cnfCreateConference)
*/
final public class CNF_CONFERENCE_PARMS
{
// Object size
public int size;
// Conference creation flags
public int flags;
// Number of allocated members
public int allocated_members;
// User value.
public int user_value;
};
// Other C Structures definition...
[...]
}
JCnfApi.java wraps the Natural Conference (CNF) API and contains the definition of the class JCnfAPI. It can also access CnfApi through JCnfApi, forwarding calls to Natural Access.
The following code sample is an extract from the JcnfApi.java file:
public class JCnfApi implements JCnfDef, JCtaDef
{
/**
* jcnfOpenResource native interface wrapper.
*
* @param cta_handles CTA_HANDLE object.
* @param cnf_handles CNF_HANDLES object.
* @param resourcenum Resource number.
* @return int iRet, cnfOpenResource native return value.
*/
public int jcnfOpenResource ( CTA_HANDLES cta_handles ,
CNF_HANDLES cnf_handles , int resourcenum )
{
int iRet;
iRet = cnfOpenResource ( cnf_handles , cta_handles.ctahd ,
resourcenum );
return (iRet);
}
[....]
/////// PRIVATE NATIVE INTERFACE ...
/**
* cnfOpenResource native interface.
*
* @param cnf_handles CNF_HANDLES object.
* @param ctahd CTA context handle.
* @param resourcenum Resource number.
* @return int iRet, cnfOpenResource native return value.
*/
private native int cnfOpenResource ( CNF_HANDLES cnf_handles , int ctahd ,
int resourcenum );
// <<native>> means that the Virtual Machine will call cnfOpenResource
// from C Library jcnfapi
[...]
}
The javah program creates a header file from the JcnfApi.java file, called jninmss_JcnfApi.h. This file describes the entry points of the jninmss library.
The JCnfApi library links with cnfapi. It forwards all calls to the C library after transferring data from objects to structures.