All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.flowable.engine.impl.webservice.WSService Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
/* Licensed 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 org.flowable.engine.impl.webservice;

import java.util.HashMap;
import java.util.Map;

import org.flowable.common.engine.impl.util.ReflectUtil;
import org.flowable.engine.impl.bpmn.webservice.BpmnInterface;
import org.flowable.engine.impl.bpmn.webservice.BpmnInterfaceImplementation;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;

/**
 * Represents a WS implementation of a {@link BpmnInterface}
 * 
 * @author Esteban Robles Luna
 */
public class WSService implements BpmnInterfaceImplementation {

    protected String name;

    protected String location;

    protected Map operations;

    protected String wsdlLocation;

    protected SyncWebServiceClient client;

    public WSService(String name, String location, String wsdlLocation) {
        this.name = name;
        this.location = location;
        this.operations = new HashMap<>();
        this.wsdlLocation = wsdlLocation;
    }

    public WSService(String name, String location, SyncWebServiceClient client) {
        this.name = name;
        this.location = location;
        this.operations = new HashMap<>();
        this.client = client;
    }

    public void addOperation(WSOperation operation) {
        this.operations.put(operation.getName(), operation);
    }

    SyncWebServiceClient getClient() {
        if (this.client == null) {
            // TODO refactor to use configuration
            SyncWebServiceClientFactory factory = (SyncWebServiceClientFactory) ReflectUtil.instantiate(ProcessEngineConfigurationImpl.DEFAULT_WS_SYNC_FACTORY);
            this.client = factory.create(this.wsdlLocation);
        }
        return this.client;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public String getLocation() {
        return this.location;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy