Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2017 the original author or authors.
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sf.jkniv.camel.sap.jco3;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.impl.DefaultProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoField;
import com.sap.conn.jco.JCoFieldIterator;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoStructure;
import com.sap.conn.jco.JCoTable;
/**
* Supports communication with the SAP Server in inbound calls (Java calls ABAP) using JCo.
*
*/
public class SapJcoProducer extends DefaultProducer
{
private static final Logger LOG = LoggerFactory.getLogger(SapJcoProducer.class);
private SapJcoEndpoint endpoint;
private static final Set> SUPPORTED_TYPES = new HashSet>();
static
{
SUPPORTED_TYPES.add(String.class);
SUPPORTED_TYPES.add(boolean.class);
SUPPORTED_TYPES.add(char.class);
SUPPORTED_TYPES.add(byte.class);
SUPPORTED_TYPES.add(short.class);
SUPPORTED_TYPES.add(int.class);
SUPPORTED_TYPES.add(long.class);
SUPPORTED_TYPES.add(float.class);
SUPPORTED_TYPES.add(double.class);
SUPPORTED_TYPES.add(Boolean.class);
SUPPORTED_TYPES.add(Character.class);
SUPPORTED_TYPES.add(Byte.class);
SUPPORTED_TYPES.add(Short.class);
SUPPORTED_TYPES.add(Integer.class);
SUPPORTED_TYPES.add(Long.class);
SUPPORTED_TYPES.add(Float.class);
SUPPORTED_TYPES.add(Double.class);
SUPPORTED_TYPES.add(Void.class);
SUPPORTED_TYPES.add(Date.class);
SUPPORTED_TYPES.add(Calendar.class);
SUPPORTED_TYPES.add(LocalDate.class);
SUPPORTED_TYPES.add(LocalDateTime.class);
SUPPORTED_TYPES.add(LocalTime.class);
SUPPORTED_TYPES.add(Duration.class);
SUPPORTED_TYPES.add(Instant.class);
}
public SapJcoProducer(SapJcoEndpoint endpoint)
{
super(endpoint);
this.endpoint = endpoint;
}
public void process(Exchange exchange) throws Exception
{
JCoDestination destination = JCoDestinationManager.getDestination(endpoint.getSapDestName());
JCoFunction function = destination.getRepository().getFunction(endpoint.getSapFunction());
setParams(exchange, function);
function.execute(destination);
JCoTable codes = function.getTableParameterList().getTable(endpoint.getSapJcoTable());
List