ISM Manual
  • Overview
  • Features
  • Components
  • Directory Structure
  • Startup/Shutdown
  • ISM Admin UI
    • Dashboard
    • Flow
    • Job
      • Schedule
    • Channel
      • AMQP
      • Mqtt
      • sFTP
    • Interface
      • System
      • Data Structure
      • Field Group
      • Field
    • Web Service
    • Utility
    • Admin
    • Result
  • Tasks
    • Control Task
      • Route
      • Split/Join
      • Mapping
    • FTP
      • FTP Input
      • FTP Output
      • FTP Transfer
    • DB
      • SQL Executor
      • SQL Batch Executor
    • File
      • File Input
      • File Output
      • File Validator
      • Record Extractor
    • Excel
      • Excel Reader
      • Excel Writer
    • Flow
      • Flow Execution
      • Wait Sub
    • Web Service
      • REST Client
      • Web service Client
    • PGP
      • Encrypt
      • Decrypt
    • Cloud
      • SharePoint
      • Amazon S3
      • Google Cloud Storage
    • Others
      • Email Sender
      • LDAP Client
      • Function
      • Script
      • Java Class
  • REST Service
  • Trouble Shooting
  • Logging Configuration
  • Implementing a Task
  • Custom Class
  • Frequently Asked Questions (FAQ)
    • What is XNARUM Integration Service Mastery (ISM)?
    • What is the purpose of XNARUM?
    • Can XNARUM be customized to specific integration requirements?
    • Is XNARUM scalable?
    • Does XNARUM provide support and maintenance?
Powered by GitBook
On this page
  • Custom authentication
  • Mapping Function

Custom Class

PreviousImplementing a TaskNextFrequently Asked Questions (FAQ)

Last updated 1 year ago

Custom authentication

Mapping Function

package com.xnarum.custom;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
            
import org.apache.commons.codec.binary.Base64;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
            
import lombok.extern.slf4j.Slf4j;
            
@Slf4j
public class MyAuthenticator {
            
    public List execute(HashMap map, String id, String password, String authUrl) throws Exception {
        ArrayList rtn = new ArrayList();
            
            
        rtn.add(new BasicNameValuePair("X-Auth-Token", getToken(id, password, authUrl)));
        return rtn;
    }
                
    public String getToken(String id, String password, String url) throws Exception {
                    
        return new String(Base64.encodeBase64(String.format("%s.%s", id, password).getBytes()));
    }
            
}
                
import com.ism.common.exception.ErrorCode;
import com.ism.transformer.converter.IConverter;
import com.ism.transformer.converter.IConverterListener;
import com.ism.transformer.converter.IConverterLocker;
import com.ism.transformer.exception.ConvertException;

import lombok.extern.slf4j.Slf4j;


@Slf4j
public class ToLower implements IConverter {

	@Override
	public void initialize(IConverterLocker converterlocker,
			IConverterListener converterlistener) {
		// TODO Auto-generated method stub

	}

	@Override
	public Object execute(Object[] inputs) throws ConvertException {
		// TODO Auto-generated method stub
		
		if ( inputs == null || inputs.length < 1 ) {
			throw new ConvertException( ErrorCode.TRNS_CUSTOMFUNCTION_CONVERT_FAIL, "Not enough parameters. 1 parameter is required.");
		}
		String input = inputs[0].toString();
		String lower = input.toLowerCase();
		log.info("Converted input {} to {}", input, lower);
		return lower;
	}

	@Override
	public void terminate() {
		// TODO Auto-generated method stub

	}
	
}