intra-mart Accel Platform / External Software Connection Module Specifications

«  Overview   ::   Contents

Sample Programs

Sample contents

This sample is a sample source to obtain URL to request a page from Java executing environment out side intra-mart Accel Platform system. It creates URL to request "sample/chart/default_graph" page created with the script development model.

Structuring environment required for the operations

For external software connection, follow the procedures below to create environment required for the connection.
  1. Copy a class archive file "imaca_client-XXX-main.jar" included in the external connection module to the environment that the application to be connected is operating.
    ( the jar file is located in "WEB-INF/libar" in WAR file.
  2. Configure a class path against the copied archive file "imaca_client-XXX-main.jar"


For jar files with different versions, the connection operation may not work correctly. Pay enough attentions when patches are applied or updated the revisions. If any patches are applied for intra-mart Accel Platform, copy and overwrite "imaca_client-XXX-main.jar" included in the patch.

Program source

package jp.co.intra_mart.sample.service.client.application;

import java.io.IOException;

import jp.co.intra_mart.foundation.service.client.application.HTTPActionEventHandler;
import jp.co.intra_mart.foundation.service.client.application.HTTPActionEventHandlerException;
import jp.co.intra_mart.foundation.service.client.application.HTTPActionEventURL;
import jp.co.intra_mart.foundation.service.client.application.PasswordSecurityHTTPActionEventFilterHandler;
import jp.co.intra_mart.foundation.service.client.application.WebApplicationHTTPActionEventHandler;
import jp.co.intra_mart.foundation.service.client.application.content.AccessibleLinkHTTPActionEventFilterHandler;
import jp.co.intra_mart.foundation.service.client.application.content.PresentationPageHTTPActionEventHandler;

public class JSSPConnectURLCreator {

    /**
     * method executed when designated as the main class from the command prompt. 
     * @param args Command line coefficient
     */
    public static void main(final String[] args) {
        try {
            // Obtain URL to request script a screen of the development model
            final String jsspURL = createJSSPURL();
            // Display the result
            System.out.println("URL: " + jsspURL);
        } catch (final Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * It creates the menu screen and returns the source in the security session environment by the designated account password.
     * @return page URL
     * @throws IOException It is thrown when input/output error occurs.
     * @throws HTTPActionEventHandlerException It is thrown when an exception occurs at event execution.
     */
    public static String createJSSPURL() throws IOException, HTTPActionEventHandlerException {
        // Creating event execution handler
        final String path = "sample/chart/default_graph";
        HTTPActionEventHandler handler = new PresentationPageHTTPActionEventHandler(path);

        // Definition to link with an absolute path
        handler = new AccessibleLinkHTTPActionEventFilterHandler(handler);

        // Structuring login/ security environments
        final String userCd = "user";
        final String password = "password";
        handler = new PasswordSecurityHTTPActionEventFilterHandler(handler, userCd, password);

        // Obtaining URL
        final String url = "http://localhost:8080/imart/HTTPActionEventListener";
        final HTTPActionEventURL result = WebApplicationHTTPActionEventHandler.getURL(handler, url);
        return result.getURL();
    }

}

Column

To compile this source, congure "imaca_client-XXX-main.jar" as the class path.
When executing, save the class file created after compiling the source to the location that can be used from the executing Java process environment.

Structuring login/ security environments

In order to execute an event in the login session environment, one of the following ActionEventFilterHandler needs to be used.
  • jp.co.intra_mart.foundation.service.client.application.GroupSecurityHTTPActionEventFilterHandler

    It executes the event as Anonymous user.

  • jp.co.intra_mart.foundation.service.client.application.AccountSecurityHTTPActionEventFilterHandler

    It executes login authorization as a user of designated user code and execute the event.

  • jp.co.intra_mart.foundation.service.client.application.PasswordSecurityHTTPActionEventFilterHandler

    It executes login authorization with designated user code and password and execute  the event.

Column

GroupSecurityHTTPActionEventFilterHandler or AccountSecurityHTTPActionEventFilterHandler can not be used in the standard status.
in order to use them, designate "true" for the value of  "use.account.security", init-param of  HTTPActionEventListener.

Authorization settings when connecting with external software

In order to execute access control with the authorization system when executing events using the external software module, configure the following ActionEventFilterHandler before ActionEventFilterHandler for login/ login security.

  • jp.co.intra_mart.foundation.service.client.application.AuthorizationHTTPActionEventFilterHandler

    It executes access control with designated authorization URI.


Implementation example

In order to allow users with access rights to the authorization URI "service://sample/chart/default_graph" to execute, implementation
should be made as below.

// Creating event execution handler
final String path = "sample/chart/default_graph";
HTTPActionEventHandler handler = new PresentationPageHTTPActionEventHandler(path);

// Definition to link with an absolute path

// Definition to execute access control
handler = new AuthorizationHTTPActionEventFilterHandler(handler, "service://sample/chart/default_graph", "execute");

// Structuring login/ security environments
final String userCd = "user";
final String password = "password";
handler = new PasswordSecurityHTTPActionEventFilterHandler(handler, userCd, password);

// Obtaining URL
final String url = "http://localhost:8080/imart/HTTPActionEventListener";
final HTTPActionEventURL result = WebApplicationHTTPActionEventHandler.getURL(handler, url);
return result.getURL();

Column

When using access control by the authorization system, URI resource should be set in advance.

«  Overview   ::   Contents