Getting Started With Java

jzhen
  • jzhen's picture
Getting Started With Java

The LogLogic Web Services Development Kit for Java (aka "Java DevKit") can be downloaded from the Google Code Project Hosting website.

Required Software

The following software is required to use the Java DevKit:

Note:The essential Java libraries are included within the DevKit directory under /devkit/java/lib/. The neccessary jar files are:

  • activation.jar
  • jaxrpc.jar
  • mail.jar
  • wsdl4j-1.5.1.jar
  • axis.jar
  • commons-discovery-0.2.jar
  • commons-logging.jar
  • saaj.jar

LogLogic Web Services Library

LogLogic provides a client side library for simplifying Java Client development. LogLogicWebServices.jar provides all the Web Service client side proxy implementations for accessing the LogLogic appliance Web Services.

The classes and methods provided by the Client Side library are documented in /devkit/java/java_lib_javadoc.

Java Client Samples Overview

The Java DevKit provides a number of Sample client programs to demonstrate typical appliance integration capabilities.
The Java samples can be found in the DevKit under /devkit/java/sample_source/. These samples have been pre-compiled for the DevKit, however you can modify and rebuild these programs using the scripts found in /devkit/java/sample_build_scripts/.

Admin Services - Alert Rules, Device, Message Routing, Search Filter, and User Account Management Java Samples

The Admin Services Java Samples are located in /devkit/java/sample_source/:

  • com/loglogic/examples/webservices/alert/AlertServiceClient.java
  • com/loglogic/examples/webservices/device/DeviceServiceClient.java
  • com/loglogic/examples/webservices/msgrouting/MsgRoutingServiceClient.java
  • com/loglogic/examples/webservices/searchfilter/SearchFilterServiceClient.java
  • com/loglogic/examples/webservices/user/UserServiceClient.java

Report and Search Services Java Samples

The Report and Search Services Java Samples are located in /devkit/java/sample_source/:

  • com/loglogic/examples/webservices/reporting/R1_RunSimpleReport.java
  • com/loglogic/examples/webservices/reporting/R1_RunSimpleReportWithFilters.java
  • com/loglogic/examples/webservices/reporting/R2_RunCustomReport.java
  • com/loglogic/examples/webservices/reporting/R3_ListReports.java
  • com/loglogic/examples/webservices/reporting/R4_RunCustomReportSpecificTime.java
  • com/loglogic/examples/webservices/reporting/R5_RunSearchReport.java
  • com/loglogic/examples/webservices/reporting/util/ReportUtil.java

Java Support Code for the Samples

  • com/loglogic/examples/webservices/LLCommon.java

Running Java Samples

Grant Web Services Access

All LogLogic Web Service APIs require authentication with the appliance using a valid User Account on the appliance. To enable a User Account to connect using Web Services, you must set Web Services the user on the LogLogic appliance.

  1. Log on to the LogLogic appliance with administrator privileges.
  2. In the navigation menu, click Administration > Manage Users.
  3. Click the "admin" user to view/edit details.
  4. Select the "Allow this user account to connect to the Appliance via Web Services" checkbox to grant Web Service access for the "admin" user.
  5. Click the Update button to save the changes

Enable Web Services Access Screenshot

Set Up Your Environment

You can run the sample Admin scripts as-is or you can make modifications to suit your needs. Note that you may want to make
a copy backup of the sample script before making changes. The following steps outline the environment setup for building and running Java Web Service client samples using the DevKit.

  1. Open a command window.
  2. Change directories (cd to the devkit/java/sample_build_scripts/)
  3. You will need to set the JAVA_HOME environment variable to your location where Java is installed. For example:

    set JAVA_HOME=C:/java

  4. Modify the setenv.bat and make changes as needed to suit your environment and appliance. You must set the IP address of your appliance, and the login/password of the User Account used for the Web Service connections.

Running the Samples

To simplify running the samples, DOS wrapper scripts are provided to verify all the neccessary environment variables and parameters for Java. The wrapper scripts are:

  • Admin_Alert_Service.bat
  • Admin_Device_Service.bat
  • Admin_MsgRouting_Service.bat
  • Admin_SearchFilter_Service.bat
  • Admin_User_Service.bat
  • R1_RunSimpleReport.bat
  • R1_RunSimpleReportWithFilters.bat
  • R1_RunSimpleReportWithSummarization.bat
  • R2_RunCustomReport.bat
  • R3_ListReports.bat
  • R4_RunCustomReportSpecificTime.bat
  • R5_RunSearchReport.bat
  • R5_RunSearchReportPredefinedFilter.bat

Developing Client Applications

Java client applications can be developed using any IDE.
Additionally, the DevKit includes a DOS compileall.bat file that
enables you to quickly get started with building client programs based on the LogLogic Java sample clients.

Note:To get compileall.bat to build new classes you define, simply add your source file paths to the allclasses.txt.

The sample clients can be used as a starting point for developing your own clients. Also, code snippets of the sample clients can be included in a larger Java application requiring Web Service access to the LogLogic appliance.

To simplify LogLogic Client development, LogLogic provides a pre-built Axis-based proxy library for invoking LogLogic Appliance Services. This library is in the LogLogicWebServices.jar file.See the LogLogic Web Services Javadoc for descriptions of the classes and methods in the LogLogicWebService.jar file.

Building Clients from WSDLs

The LogLogicWebServices.jar is pre-built to simplify developing LogLogic java web service clients. If you wish to build your own client proxys from wsdl, e.g. using wsdl2java, the LogLogic WSDL files can be found on your appliance by visiting the URL https://<appliance-ip>/logapp20/services.
The Java WSDP v2.0 is required for wsdl2java.

For more information on developing LogLogic Web Service client applications using Java, including specific API operations and parameters, see the LogLogic Web Services Implementation Guide.

0
Your rating: None