/*
 * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. 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 io.siddhi.core.stream;

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

/**
 * Service related information to the deployment
 */
public class ServiceDeploymentInfo {

    private ServiceProtocol serviceProtocol = ServiceProtocol.TCP;
    private boolean secured = false;
    private int port;
    private Map<String, String> deploymentProperties = new HashMap<>();

    /**
     * Service related information to the deployment
     *
     * @param serviceProtocol the protocol used by the service
     * @param port            the port of the service
     * @param secured         is the service protocol secured
     */
    public ServiceDeploymentInfo(ServiceProtocol serviceProtocol, int port, boolean secured) {
        this.serviceProtocol = serviceProtocol;
        this.port = port;
        this.secured = secured;
    }

    /**
     * Service related information to the deployment
     *
     * @param secured is the service protocol secured
     * @param port    the port of the service
     */
    public ServiceDeploymentInfo(int port, boolean secured) {
        this.port = port;
        this.secured = secured;
    }

    public ServiceProtocol getServiceProtocol() {
        return serviceProtocol;
    }

    public void setServiceProtocol(ServiceProtocol serviceProtocol) {
        this.serviceProtocol = serviceProtocol;
    }

    public boolean isSecured() {
        return secured;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public void setSecured(boolean secured) {
        this.secured = secured;
    }

    public Map<String, String> getDeploymentProperties() {
        return deploymentProperties;
    }

    public void addDeploymentProperties(Map<String, String> deploymentProperties) {
        for (Map.Entry<String, String> entry : deploymentProperties.entrySet()) {
            this.deploymentProperties.putIfAbsent(entry.getKey(), entry.getValue());
        }
    }

    /**
     * Service protocols
     */
    public enum ServiceProtocol {
        TCP, UDP, SCTP,
    }
}

@@ -907,16 +907,81 @@
 ol.TCP;%0A
+    private SourceStrategy sourceStrategy = SourceStrategy.PULL;%0A
     priv
@@ -1009,16 +1009,16 @@
  false;%0A
-
     priv
@@ -1104,16 +1104,579 @@
 p%3C%3E();%0A%0A
+    /**%0A     * @param serviceProtocol the protocol used by the service%0A     * @param port            the port of the service%0A     * @param secured         is the service protocol secured%0A     * @param sourceStrategy  the source strategy%0A     */%0A    public ServiceDeploymentInfo(ServiceProtocol serviceProtocol, int port, boolean secured,%0A                                 SourceStrategy sourceStrategy) %7B%0A        this.serviceProtocol = serviceProtocol;%0A        this.port = port;%0A        this.secured = secured;%0A        this.sourceStrategy = sourceStrategy;%0A    %7D%0A%0A
     /**%0A
@@ -2122,32 +2122,475 @@
 secured;%0A    %7D%0A%0A
+    /**%0A     * Service related information to the deployment%0A     *%0A     * @param port           the port of the service%0A     * @param secured        is the service protocol secured%0A     * @param sourceStrategy the source strategy%0A     */%0A    public ServiceDeploymentInfo(int port, boolean secured, SourceStrategy sourceStrategy) %7B%0A        this.port = port;%0A        this.secured = secured;%0A        this.sourceStrategy = sourceStrategy;%0A    %7D%0A%0A
     /**%0A     * S
@@ -2868,32 +2868,320 @@
 secured;%0A    %7D%0A%0A
+    /**%0A     * Service related information to the deployment%0A     *%0A     * @param sourceStrategy the source strategy%0A     */%0A    public ServiceDeploymentInfo(SourceStrategy sourceStrategy) %7B%0A        this.sourceStrategy = sourceStrategy;%0A    %7D%0A%0A    public ServiceDeploymentInfo() %7B%0A    %7D%0A%0A
     public Servi
@@ -3643,32 +3643,238 @@
 secured;%0A    %7D%0A%0A
+    public SourceStrategy getSourceStrategy() %7B%0A        return sourceStrategy;%0A    %7D%0A%0A    public void setSourceStrategy(SourceStrategy sourceStrategy) %7B%0A        this.sourceStrategy = sourceStrategy;%0A    %7D%0A%0A
     public Map%3CS
@@ -4303,16 +4303,16 @@
 tocol %7B%0A
-
         
@@ -4332,11 +4332,109 @@
 P,%0A    %7D
+%0A%0A    /**%0A     * Source strategy%0A     */%0A    public enum SourceStrategy %7B%0A        PUSH, PULL%0A    %7D
 %0A%7D%0A

Add source strategy to Service Deployment Information