Java tutorial
// // (c) 2006 DS Data Systems UK Ltd, All rights reserved. // // DS Data Systems and KonaKart and their respective logos, are // trademarks of DS Data Systems UK Ltd. All rights reserved. // // The information in this document is free software; you can redistribute // it and/or modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // package com.konakart; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.konakart.appif.KKEngIf; import com.konakart.appif.ManufacturerIf; /** * API Example */ public class ApiExample { /** logger */ public static Log log = LogFactory.getLog(ApiExample.class); /** The Application Engine - could be the direct java version or the SOAP version */ private static KKEngIf eng; /** * When -1 is passed as a parameter for the language id, the engine uses the default language. */ // private static final int DEFAULT_LANGUAGE = -1; /** Default credentials for accessing the KonaKart Application Engine */ //private static String DEFAULT_USERNAME = "root@localhost"; //private static String DEFAULT_PASSWORD = "password"; /** The session id returned by a successful login */ //private static String sessionId; /** The SOAP implementation of the engine */ private static String ws_engine_implementation = "com.konakart.app.KKWSEng"; /** The direct java implementation of the engine */ // private static String pojo_engine_implementation = "com.konakart.app.KKEng"; /** * @param args */ public static void main(String[] args) { try { /* * Instantiate a KonaKart Engine instance */ Class<?> engineClass = Class.forName(ws_engine_implementation); eng = (KKEngIf) engineClass.newInstance(); /* * Login with default credentials */ //sessionId = eng.login(DEFAULT_USERNAME, DEFAULT_PASSWORD); //log.info(DEFAULT_USERNAME + " logged in successfully and got session " + sessionId); log.info("Manufacturers:\n"); ManufacturerIf[] manus = eng.getAllManufacturers(); for (int m = 0; m < manus.length; m++) { log.info("\t" + manus[m].getName()); } } catch (Exception e) { e.printStackTrace(); } } }