The XIQS Java Library

From IQsimWiki

Jump to: navigation, search

Contents

Documentation

Online

The XIQS framework library documentation for Java can be consulted online here.

Download

See the Download section

Examples

Below is a sample of use of the XIQS Communication Framework. This sample can be downloaded from the Download section.

package com.iqsim.protocol.example;

import java.io.IOException;
import com.iqsim.protocol.xiqs.*;
import com.iqsim.protocol.xiqs.XParam.PAR_TYPE;

public class Program {

    public static void main String[] args ) {
        try {
            final String XIQS_SRV_HOST = "localhost";
            IXConnection con = XConnectionManager.createConnectionXIQS_SRV_HOST );
            con.connect();
            //send necessary login command to server
            sendCommandcon, "loginXIQS""administrator""admin_pass" );
            // create a new object list filter
            IXSimplefilter filter = XiqsFactory.createSimplefilter();
            //limit list view to 10 objects
            filter.setLimit10 );
            //get 10 sim objects from partition of id 2 (admin) using filter
            sendCommandcon, "getXIQSCardList"2, filter );
            //close connection
            con.close();
        }
        catch Exception e ) {
            e.printStackTrace();
        }
    }
    
    private static void sendCommand IXConnection con, String cmdname, Object ... params )
        throws IOException, FilterExistException, InvalidArgumentTypeException {
        //create a new command object
        IXCommand cmd = XiqsFactory.createCommandcmdname, params );
        //send command to xiqs server
        con.sendCommandcmd );
        //read xiqs server answer
        IXEvent evt = con.readEventtrue );
        //print result on screen output
        printlnevt );
    }
    
    private static void println IXEvent evt ) {
        System.out.println"XiqsEvent[type=" + evt.getEventType() "] {" );
        
        for int i = ; i < evt.getParamListSize() ; i++ ) {
            if PAR_TYPE.PAR_OBJECT != evt.getParamType) )
                System.out.println" " + evt.getParamName"=" + evt.getParamValue) );
            else {
                IXEvent obj = evt.getParamObject);
                System.out.println" " + obj.getName() " {" );
                
                for int j = ; j < obj.getParamListSize() ; j++ )
                    System.out.println"  " + obj.getParamName"=" + obj.getParamValue) );

                System.out.println" }" );
            }
        }
        
        System.out.println"}" );
    }
}

Personal tools
Namespaces
Variants
Views
Actions
Navigation
XIQS XML Protocol
XIQS Framework Libraries
XIQS Command List