Custom class
Last updated
Last updated
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
}
}