{
        this.validationState = validationState;
        return this;
    }

package com.sequenceiq.mock.swagger.model;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.sequenceiq.mock.swagger.model.ValidationState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;

/**
 * Model for a configuration parameter.  When an entry's <i>value</i> property is not available, it means the entry is not configured. This means that the default value for the entry, if any, will be used. Setting a value to <i>null</i> also can be used to unset any previously set value for the parameter, reverting to the default value (if any).
 */
@ApiModel(description = "Model for a configuration parameter.  When an entry's value property is not available, it means the entry is not configured. This means that the default value for the entry, if any, will be used. Setting a value to null also can be used to unset any previously set value for the parameter, reverting to the default value (if any).")
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-10-26T08:01:08.932+01:00")
public class ApiConfig {

    @JsonProperty("name")
    private String name = null;

    @JsonProperty("value")
    private String value = null;

    @JsonProperty("required")
    private Boolean required = null;

    @JsonProperty("default")
    private String _default = null;

    @JsonProperty("displayName")
    private String displayName = null;

    @JsonProperty("description")
    private String description = null;

    @JsonProperty("relatedName")
    private String relatedName = null;

    @JsonProperty("sensitive")
    private Boolean sensitive = null;

    @JsonProperty("validationState")
    private ValidationState validationState = null;

    @JsonProperty("validationMessage")
    private String validationMessage = null;

    @JsonProperty("validationWarningsSuppressed")
    private Boolean validationWarningsSuppressed = null;

    public ApiConfig name(String name) {
        this.name = name;
        return this;
    }

    /**
     * Readonly. The canonical name that identifies this configuration parameter.
     * @return name
     */
    @ApiModelProperty(value = "Readonly. The canonical name that identifies this configuration parameter.")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ApiConfig value(String value) {
        this.value = value;
        return this;
    }

    /**
     * The user-defined value. When absent, the default value (if any) will be used. Can also be absent, when enumerating allowed configs.
     * @return value
     */
    @ApiModelProperty(value = "The user-defined value. When absent, the default value (if any) will be used. Can also be absent, when enumerating allowed configs.")
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public ApiConfig required(Boolean required) {
        this.required = required;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. Whether this configuration is required for the object. If any required configuration is not set, operations on the object may not work.
     * @return required
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. Whether this configuration is required for the object. If any required configuration is not set, operations on the object may not work.")
    public Boolean isRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public ApiConfig _default(String _default) {
        this._default = _default;
        return this;
    }

    @ApiModelProperty(value = "Readonly. Requires \"full\" view. The default value.")
    public String getDefault() {
        return _default;
    }

    public void setDefault(String _default) {
        this._default = _default;
    }

    public ApiConfig displayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A user-friendly name of the parameters, as would have been shown in the web UI.
     * @return displayName
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A user-friendly name of the parameters, as would have been shown in the web UI.")
    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public ApiConfig description(String description) {
        this.description = description;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A textual description of the parameter.
     * @return description
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A textual description of the parameter.")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public ApiConfig relatedName(String relatedName) {
        this.relatedName = relatedName;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. If applicable, contains the related configuration variable used by the source project.
     * @return relatedName
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. If applicable, contains the related configuration variable used by the source project.")
    public String getRelatedName() {
        return relatedName;
    }

    public void setRelatedName(String relatedName) {
        this.relatedName = relatedName;
    }

    public ApiConfig sensitive(Boolean sensitive) {
        this.sensitive = sensitive;
        return this;
    }

    /**
     * Readonly. Whether this configuration is sensitive, i.e. contains information such as passwords, which might affect how the value of this configuration might be shared by the caller.  Available since v14.
     * @return sensitive
     */
    @ApiModelProperty(value = "Readonly. Whether this configuration is sensitive, i.e. contains information such as passwords, which might affect how the value of this configuration might be shared by the caller.  Available since v14.")
    public Boolean isSensitive() {
        return sensitive;
    }

    public void setSensitive(Boolean sensitive) {
        this.sensitive = sensitive;
    }

    public ApiConfig validationState(ValidationState validationState)

    /**
     * Readonly. Requires \"full\" view. State of the configuration parameter after validation.
     * @return validationState
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. State of the configuration parameter after validation.")
    @Valid
    public ValidationState getValidationState() {
        return validationState;
    }

    public void setValidationState(ValidationState validationState) {
        this.validationState = validationState;
    }

    public ApiConfig validationMessage(String validationMessage) {
        this.validationMessage = validationMessage;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A message explaining the parameter's validation state.
     * @return validationMessage
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A message explaining the parameter's validation state.")
    public String getValidationMessage() {
        return validationMessage;
    }

    public void setValidationMessage(String validationMessage) {
        this.validationMessage = validationMessage;
    }

    public ApiConfig validationWarningsSuppressed(Boolean validationWarningsSuppressed) {
        this.validationWarningsSuppressed = validationWarningsSuppressed;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. Whether validation warnings associated with this parameter are suppressed. In general, suppressed validation warnings are hidden in the Cloudera Manager UI. Configurations that do not produce warnings will not contain this field.
     * @return validationWarningsSuppressed
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. Whether validation warnings associated with this parameter are suppressed. In general, suppressed validation warnings are hidden in the Cloudera Manager UI. Configurations that do not produce warnings will not contain this field.")
    public Boolean isValidationWarningsSuppressed() {
        return validationWarningsSuppressed;
    }

    public void setValidationWarningsSuppressed(Boolean validationWarningsSuppressed) {
        this.validationWarningsSuppressed = validationWarningsSuppressed;
    }

    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ApiConfig apiConfig = (ApiConfig) o;
        return Objects.equals(this.name, apiConfig.name) && Objects.equals(this.value, apiConfig.value) && Objects.equals(this.required, apiConfig.required) && Objects.equals(this._default, apiConfig._default) && Objects.equals(this.displayName, apiConfig.displayName) && Objects.equals(this.description, apiConfig.description) && Objects.equals(this.relatedName, apiConfig.relatedName) && Objects.equals(this.sensitive, apiConfig.sensitive) && Objects.equals(this.validationState, apiConfig.validationState) && Objects.equals(this.validationMessage, apiConfig.validationMessage) && Objects.equals(this.validationWarningsSuppressed, apiConfig.validationWarningsSuppressed);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, value, required, _default, displayName, description, relatedName, sensitive, validationState, validationMessage, validationWarningsSuppressed);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ApiConfig {\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    value: ").append(toIndentedString(value)).append("\n");
        sb.append("    required: ").append(toIndentedString(required)).append("\n");
        sb.append("    _default: ").append(toIndentedString(_default)).append("\n");
        sb.append("    displayName: ").append(toIndentedString(displayName)).append("\n");
        sb.append("    description: ").append(toIndentedString(description)).append("\n");
        sb.append("    relatedName: ").append(toIndentedString(relatedName)).append("\n");
        sb.append("    sensitive: ").append(toIndentedString(sensitive)).append("\n");
        sb.append("    validationState: ").append(toIndentedString(validationState)).append("\n");
        sb.append("    validationMessage: ").append(toIndentedString(validationMessage)).append("\n");
        sb.append("    validationWarningsSuppressed: ").append(toIndentedString(validationWarningsSuppressed)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}


package com.sequenceiq.mock.swagger.model;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.sequenceiq.mock.swagger.model.ValidationState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;

/**
 * Model for a configuration parameter.  When an entry's <i>value</i> property is not available, it means the entry is not configured. This means that the default value for the entry, if any, will be used. Setting a value to <i>null</i> also can be used to unset any previously set value for the parameter, reverting to the default value (if any).
 */
@ApiModel(description = "Model for a configuration parameter.  When an entry's value property is not available, it means the entry is not configured. This means that the default value for the entry, if any, will be used. Setting a value to null also can be used to unset any previously set value for the parameter, reverting to the default value (if any).")
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-10-26T08:01:08.932+01:00")
public class ApiConfig {

    @JsonProperty("name")
    private String name = null;

    @JsonProperty("value")
    private String value = null;

    @JsonProperty("required")
    private Boolean required = null;

    @JsonProperty("default")
    private String _default = null;

    @JsonProperty("displayName")
    private String displayName = null;

    @JsonProperty("description")
    private String description = null;

    @JsonProperty("relatedName")
    private String relatedName = null;

    @JsonProperty("sensitive")
    private Boolean sensitive = null;

    @JsonProperty("validationState")
    private ValidationState validationState = null;

    @JsonProperty("validationMessage")
    private String validationMessage = null;

    @JsonProperty("validationWarningsSuppressed")
    private Boolean validationWarningsSuppressed = null;

    public ApiConfig name(String name) {
        this.name = name;
        return this;
    }

    /**
     * Readonly. The canonical name that identifies this configuration parameter.
     * @return name
     */
    @ApiModelProperty(value = "Readonly. The canonical name that identifies this configuration parameter.")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ApiConfig value(String value) {
        this.value = value;
        return this;
    }

    /**
     * The user-defined value. When absent, the default value (if any) will be used. Can also be absent, when enumerating allowed configs.
     * @return value
     */
    @ApiModelProperty(value = "The user-defined value. When absent, the default value (if any) will be used. Can also be absent, when enumerating allowed configs.")
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public ApiConfig required(Boolean required) {
        this.required = required;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. Whether this configuration is required for the object. If any required configuration is not set, operations on the object may not work.
     * @return required
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. Whether this configuration is required for the object. If any required configuration is not set, operations on the object may not work.")
    public Boolean isRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public ApiConfig _default(String _default) {
        this._default = _default;
        return this;
    }

    @ApiModelProperty(value = "Readonly. Requires \"full\" view. The default value.")
    public String getDefault() {
        r

    }

    public void setDefault(String _default) {
        this._default = _default;
    }

    public ApiConfig displayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A user-friendly name of the parameters, as would have been shown in the web UI.
     * @return displayName
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A user-friendly name of the parameters, as would have been shown in the web UI.")
    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public ApiConfig description(String description) {
        this.description = description;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A textual description of the parameter.
     * @return description
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A textual description of the parameter.")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public ApiConfig relatedName(String relatedName) {
        this.relatedName = relatedName;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. If applicable, contains the related configuration variable used by the source project.
     * @return relatedName
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. If applicable, contains the related configuration variable used by the source project.")
    public String getRelatedName() {
        return relatedName;
    }

    public void setRelatedName(String relatedName) {
        this.relatedName = relatedName;
    }

    public ApiConfig sensitive(Boolean sensitive) {
        this.sensitive = sensitive;
        return this;
    }

    /**
     * Readonly. Whether this configuration is sensitive, i.e. contains information such as passwords, which might affect how the value of this configuration might be shared by the caller.  Available since v14.
     * @return sensitive
     */
    @ApiModelProperty(value = "Readonly. Whether this configuration is sensitive, i.e. contains information such as passwords, which might affect how the value of this configuration might be shared by the caller.  Available since v14.")
    public Boolean isSensitive() {
        return sensitive;
    }

    public void setSensitive(Boolean sensitive) {
        this.sensitive = sensitive;
    }

    public ApiConfig validationState(ValidationState validationState) {
        this.validationState = validationState;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. State of the configuration parameter after validation.
     * @return validationState
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. State of the configuration parameter after validation.")
    @Valid
    public ValidationState getValidationState() {
        return validationState;
    }

    public void setValidationState(ValidationState validationState) {
        this.validationState = validationState;
    }

    public ApiConfig validationMessage(String validationMessage) {
        this.validationMessage = validationMessage;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A message explaining the parameter's validation state.
     * @return validationMessage
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A message explaining the parameter's validation state.")
    public String getValidationMessage() {
        return validationMessage;
    }

    public void setValidationMessage(String validationMessage) {
        this.validationMessage = validationMessage;
    }

    public ApiConfig validationWarningsSuppressed(Boolean validationWarningsSuppressed) {
        this.validationWarningsSuppressed = validationWarningsSuppressed;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. Whether validation warnings associated with this parameter are suppressed. In general, suppressed validation warnings are hidden in the Cloudera Manager UI. Configurations that do not produce warnings will not contain this field.
     * @return validationWarningsSuppressed
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. Whether validation warnings associated with this parameter are suppressed. In general, suppressed validation warnings are hidden in the Cloudera Manager UI. Configurations that do not produce warnings will not contain this field.")
    public Boolean isValidationWarningsSuppressed() {
        return validationWarningsSuppressed;
    }

    public void setValidationWarningsSuppressed(Boolean validationWarningsSuppressed) {
        this.validationWarningsSuppressed = validationWarningsSuppressed;
    }

    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ApiConfig apiConfig = (ApiConfig) o;
        return Objects.equals(this.name, apiConfig.name) && Objects.equals(this.value, apiConfig.value) && Objects.equals(this.required, apiConfig.required) && Objects.equals(this._default, apiConfig._default) && Objects.equals(this.displayName, apiConfig.displayName) && Objects.equals(this.description, apiConfig.description) && Objects.equals(this.relatedName, apiConfig.relatedName) && Objects.equals(this.sensitive, apiConfig.sensitive) && Objects.equals(this.validationState, apiConfig.validationState) && Objects.equals(this.validationMessage, apiConfig.validationMessage) && Objects.equals(this.validationWarningsSuppressed, apiConfig.validationWarningsSuppressed);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, value, required, _default, displayName, description, relatedName, sensitive, validationState, validationMessage, validationWarningsSuppressed);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ApiConfig {\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    value: ").append(toIndentedString(value)).append("\n");
        sb.append("    required: ").append(toIndentedString(required)).append("\n");
        sb.append("    _default: ").append(toIndentedString(_default)).append("\n");
        sb.append("    displayName: ").append(toIndentedString(displayName)).append("\n");
        sb.append("    description: ").append(toIndentedString(description)).append("\n");
        sb.append("    relatedName: ").append(toIndentedString(relatedName)).append("\n");
        sb.append("    sensitive: ").append(toIndentedString(sensitive)).append("\n");
        sb.append("    validationState: ").append(toIndentedString(validationState)).append("\n");
        sb.append("    validationMessage: ").append(toIndentedString(validationMessage)).append("\n");
        sb.append("    validationWarningsSuppressed: ").append(toIndentedString(validationWarningsSuppressed)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}


@ApiModelProperty(value = "The user-defined value. When absent, the default value (if any) will be used. Can also be absent, when enumerating allowed configs.")
    public String getValue() {
        return value;
    }

package com.sequenceiq.mock.swagger.model;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.sequenceiq.mock.swagger.model.ValidationState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;

/**
 * Model for a configuration parameter.  When an entry's <i>value</i> property is not available, it means the entry is not configured. This means that the default value for the entry, if any, will be used. Setting a value to <i>null</i> also can be used to unset any previously set value for the parameter, reverting to the default value (if any).
 */
@ApiModel(description = "Model for a configuration parameter.  When an entry's value property is not available, it means the entry is not configured. This means that the default value for the entry, if any, will be used. Setting a value to null also can be used to unset any previously set value for the parameter, reverting to the default value (if any).")
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-10-26T08:01:08.932+01:00")
public class ApiConfig {

    @JsonProperty("name")
    private String name = null;

    @JsonProperty("value")
    private String value = null;

    @JsonProperty("required")
    private Boolean required = null;

    @JsonProperty("default")
    private String _default = null;

    @JsonProperty("displayName")
    private String displayName = null;

    @JsonProperty("description")
    private String description = null;

    @JsonProperty("relatedName")
    private String relatedName = null;

    @JsonProperty("sensitive")
    private Boolean sensitive = null;

    @JsonProperty("validationState")
    private ValidationState validationState = null;

    @JsonProperty("validationMessage")
    private String validationMessage = null;

    @JsonProperty("validationWarningsSuppressed")
    private Boolean validationWarningsSuppressed = null;

    public ApiConfig name(String name) {
        this.name = name;
        return this;
    }

    /**
     * Readonly. The canonical name that identifies this configuration parameter.
     * @return name
     */
    @ApiModelProperty(value = "Readonly. The canonical name that identifies this configuration parameter.")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ApiConfig value(String value) {
        this.value = value;
        return this;
    }

    /**
     * The user-defined value. When absent, the default value (if any) will be used. Can also be absent, when enumerating allowed configs.
     * @return value
     */

    public void setValue(String value) {
        this.value = value;
    }

    public ApiConfig required(Boolean required) {
        this.required = required;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. Whether this configuration is required for the object. If any required configuration is not set, operations on the object may not work.
     * @return required
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. Whether this configuration is required for the object. If any required configuration is not set, operations on the object may not work.")
    public Boolean isRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public ApiConfig _default(String _default) {
        this._default = _default;
        return this;
    }

    @ApiModelProperty(value = "Readonly. Requires \"full\" view. The default value.")
    public String getDefault() {
        return _default;
    }

    public void setDefault(String _default) {
        this._default = _default;
    }

    public ApiConfig displayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A user-friendly name of the parameters, as would have been shown in the web UI.
     * @return displayName
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A user-friendly name of the parameters, as would have been shown in the web UI.")
    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public ApiConfig description(String description) {
        this.description = description;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A textual description of the parameter.
     * @return description
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A textual description of the parameter.")
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public ApiConfig relatedName(String relatedName) {
        this.relatedName = relatedName;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. If applicable, contains the related configuration variable used by the source project.
     * @return relatedName
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. If applicable, contains the related configuration variable used by the source project.")
    public String getRelatedName() {
        return relatedName;
    }

    public void setRelatedName(String relatedName) {
        this.relatedName = relatedName;
    }

    public ApiConfig sensitive(Boolean sensitive) {
        this.sensitive = sensitive;
        return this;
    }

    /**
     * Readonly. Whether this configuration is sensitive, i.e. contains information such as passwords, which might affect how the value of this configuration might be shared by the caller.  Available since v14.
     * @return sensitive
     */
    @ApiModelProperty(value = "Readonly. Whether this configuration is sensitive, i.e. contains information such as passwords, which might affect how the value of this configuration might be shared by the caller.  Available since v14.")
    public Boolean isSensitive() {
        return sensitive;
    }

    public void setSensitive(Boolean sensitive) {
        this.sensitive = sensitive;
    }

    public ApiConfig validationState(ValidationState validationState) {
        this.validationState = validationState;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. State of the configuration parameter after validation.
     * @return validationState
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. State of the configuration parameter after validation.")
    @Valid
    public ValidationState getValidationState() {
        return validationState;
    }

    public void setValidationState(ValidationState validationState) {
        this.validationState = validationState;
    }

    public ApiConfig validationMessage(String validationMessage) {
        this.validationMessage = validationMessage;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. A message explaining the parameter's validation state.
     * @return validationMessage
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. A message explaining the parameter's validation state.")
    public String getValidationMessage() {
        return validationMessage;
    }

    public void setValidationMessage(String validationMessage) {
        this.validationMessage = validationMessage;
    }

    public ApiConfig validationWarningsSuppressed(Boolean validationWarningsSuppressed) {
        this.validationWarningsSuppressed = validationWarningsSuppressed;
        return this;
    }

    /**
     * Readonly. Requires \"full\" view. Whether validation warnings associated with this parameter are suppressed. In general, suppressed validation warnings are hidden in the Cloudera Manager UI. Configurations that do not produce warnings will not contain this field.
     * @return validationWarningsSuppressed
     */
    @ApiModelProperty(value = "Readonly. Requires \"full\" view. Whether validation warnings associated with this parameter are suppressed. In general, suppressed validation warnings are hidden in the Cloudera Manager UI. Configurations that do not produce warnings will not contain this field.")
    public Boolean isValidationWarningsSuppressed() {
        return validationWarningsSuppressed;
    }

    public void setValidationWarningsSuppressed(Boolean validationWarningsSuppressed) {
        this.validationWarningsSuppressed = validationWarningsSuppressed;
    }

    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ApiConfig apiConfig = (ApiConfig) o;
        return Objects.equals(this.name, apiConfig.name) && Objects.equals(this.value, apiConfig.value) && Objects.equals(this.required, apiConfig.required) && Objects.equals(this._default, apiConfig._default) && Objects.equals(this.displayName, apiConfig.displayName) && Objects.equals(this.description, apiConfig.description) && Objects.equals(this.relatedName, apiConfig.relatedName) && Objects.equals(this.sensitive, apiConfig.sensitive) && Objects.equals(this.validationState, apiConfig.validationState) && Objects.equals(this.validationMessage, apiConfig.validationMessage) && Objects.equals(this.validationWarningsSuppressed, apiConfig.validationWarningsSuppressed);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, value, required, _default, displayName, description, relatedName, sensitive, validationState, validationMessage, validationWarningsSuppressed);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ApiConfig {\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    value: ").append(toIndentedString(value)).append("\n");
        sb.append("    required: ").append(toIndentedString(required)).append("\n");
        sb.append("    _default: ").append(toIndentedString(_default)).append("\n");
        sb.append("    displayName: ").append(toIndentedString(displayName)).append("\n");
        sb.append("    description: ").append(toIndentedString(description)).append("\n");
        sb.append("    relatedName: ").append(toIndentedString(relatedName)).append("\n");
        sb.append("    sensitive: ").append(toIndentedString(sensitive)).append("\n");
        sb.append("    validationState: ").append(toIndentedString(validationState)).append("\n");
        sb.append("    validationMessage: ").append(toIndentedString(validationMessage)).append("\n");
        sb.append("    validationWarningsSuppressed: ").append(toIndentedString(validationWarningsSuppressed)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}


@Override
    public String getDescription()

package co.cask.coopr.shell.command;

import co.cask.common.cli.Arguments;
import co.cask.coopr.client.ClusterClient;
import co.cask.coopr.shell.CLIConfig;
import co.cask.coopr.shell.util.CliUtil;
import com.google.inject.Inject;
import java.io.PrintStream;
import static co.cask.coopr.shell.util.Constants.CLUSTER_ID_KEY;

/**
 * Gets the cluster.
 */
public class GetClusterCommand extends AbstractAuthCommand {

    private final ClusterClient clusterClient;

    @Inject
    private GetClusterCommand(ClusterClient clusterClient, CLIConfig cliConfig) {
        super(cliConfig);
        this.clusterClient = clusterClient;
    }

    @Override
    public void perform(Arguments arguments, PrintStream printStream) throws Exception {
        String id = arguments.get(CLUSTER_ID_KEY);
        printStream.print(CliUtil.getPrettyJson(clusterClient.getCluster(id)));
    }

    @Override
    public String getPattern() {
        return String.format("get cluster <%s>", CLUSTER_ID_KEY);
    }

{
        return "Get the cluster by id";
    }
}


{
        return String.format("get cluster <%s>", CLUSTER_ID_KEY);
    }

package co.cask.coopr.shell.command;

import co.cask.common.cli.Arguments;
import co.cask.coopr.client.ClusterClient;
import co.cask.coopr.shell.CLIConfig;
import co.cask.coopr.shell.util.CliUtil;
import com.google.inject.Inject;
import java.io.PrintStream;
import static co.cask.coopr.shell.util.Constants.CLUSTER_ID_KEY;

/**
 * Gets the cluster.
 */
public class GetClusterCommand extends AbstractAuthCommand {

    private final ClusterClient clusterClient;

    @Inject
    private GetClusterCommand(ClusterClient clusterClient, CLIConfig cliConfig) {
        super(cliConfig);
        this.clusterClient = clusterClient;
    }

    @Override
    public void perform(Arguments arguments, PrintStream printStream) throws Exception {
        String id = arguments.get(CLUSTER_ID_KEY);
        printStream.print(CliUtil.getPrettyJson(clusterClient.getCluster(id)));
    }

    @Override
    public String getPattern()

    @Override
    public String getDescription() {
        return "Get the cluster by id";
    }
}


package co.cask.coopr.shell.command;

import co.cask.common.cli.Arguments;
import co.cask.coopr.client.ClusterClient;
import co.cask.coopr.shell.CLIConfig;
import co.cask.coopr.shell.util.CliUtil;
import com.google.inject.Inject;
import java.io.PrintStream;
import static co.cask.coopr.shell.util.Constants.CLUSTER_ID_KEY;

/**
 * Gets the cluster.
 */
public class GetClusterCommand extends AbstractAuthCommand {

    private final ClusterClient clusterClient;

    @Inject
    private GetClusterCommand(ClusterClient clusterClient, CLIConfig cliConfig) {
        super(cliConfig);
        this.clusterClient = clusterClient;
    }

    @Override
    public void perform(Arguments arguments, PrintStream printStream) throws Exception {
        String id = arguments.get(CLUSTER_ID_KEY);
        printStream.print(CliUtil.getPrettyJson(clusterClient.getCluster(id)));
    }

    @Override
    public String getPattern() {
        return String.format("get cluster <%s>", CLUSTER_ID_KEY);
    }

    @Override
    public String getDescription() {
        ret


public MultipartContent setContentParts(Collection<? extends HttpContent> contentParts)

package com.google.api.client.http;

import com.google.api.client.util.Preconditions;
import com.google.api.client.util.StreamingContent;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;

/**
 * Serializes MIME multipart content as specified by RFC 2387: The MIME Multipart/Related Content-type
 * and RFC 2046: Multipurpose Internet
 * Mail Extensions: The Multipart/mixed (primary) subtype.
 *
 *
By default the media type is {@code "multipart/related; boundary=__END_OF_PART__<random
 * UUID>__"}, but this may be customized by calling {@link #setMediaType(HttpMediaType)}, {@link
 * #getMediaType()}, or {@link #setBoundary(String)}.
 *
 *
Implementation is not thread-safe.
 *
 * @since 1.14
 * @author Yaniv Inbar
 */
public class MultipartContent extends AbstractHttpContent {

    static final String NEWLINE = "\r\n";

    private static final String TWO_DASHES = "--";

    /**
     * Parts of the HTTP multipart request.
     */
    private ArrayList<Part> parts = new ArrayList<>();

    public MultipartContent() {
        this("__END_OF_PART__" + UUID.randomUUID().toString() + "__");
    }

    public MultipartContent(String boundary) {
        super(new HttpMediaType("multipart/related").setParameter("boundary", boundary));
    }

    public void writeTo(OutputStream out) throws IOException {
        Writer writer = new OutputStreamWriter(out, getCharset());
        String boundary = getBoundary();
        for (Part part : parts) {
            HttpHeaders headers = new HttpHeaders().setAcceptEncoding(null);
            if (part.headers != null) {
                headers.fromHttpHeaders(part.headers);
            }
            headers.setContentEncoding(null).setUserAgent(null).setContentType(null).setContentLength(null).set("Content-Transfer-Encoding", null);
            // analyze the content
            HttpContent content = part.content;
            StreamingContent streamingContent = null;
            if (content != null) {
                headers.set("Content-Transfer-Encoding", Arrays.asList("binary"));
                headers.setContentType(content.getType());
                HttpEncoding encoding = part.encoding;
                long contentLength;
                if (encoding == null) {
                    contentLength = content.getLength();
                    streamingContent = content;
                } else {
                    headers.setContentEncoding(encoding.getName());
                    streamingContent = new HttpEncodingStreamingContent(content, encoding);
                    contentLength = AbstractHttpContent.computeLength(content);
                }
                if (contentLength != -1) {
                    headers.setContentLength(contentLength);
                }
            }
            // write multipart-body from RFC 1521 §7.2.1
            // write encapsulation
            // write delimiter
            writer.write(TWO_DASHES);
            writer.write(boundary);
            writer.write(NEWLINE);
            // write body-part; message from RFC 822 §4.1
            // write message fields
            HttpHeaders.serializeHeadersForMultipartRequests(headers, null, null, writer);
            if (streamingContent != null) {
                writer.write(NEWLINE);
                writer.flush();
                // write message text/body
                streamingContent.writeTo(out);
            }
            // terminate encapsulation
            writer.write(NEWLINE);
        }
        // write close-delimiter
        writer.write(TWO_DASHES);
        writer.write(boundary);
        writer.write(TWO_DASHES);
        writer.write(NEWLINE);
        writer.flush();
    }

    @Override
    public boolean retrySupported() {
        for (Part part : parts) {
            if (!part.content.retrySupported()) {
                return false;
            }
        }
        return true;
    }

    @Override
    public MultipartContent setMediaType(HttpMediaType mediaType) {
        super.setMediaType(mediaType);
        return this;
    }

    /**
     * Returns an unmodifiable view of the parts of the HTTP multipart request.
     */
    public final Collection<Part> getParts() {
        return Collections.unmodifiableCollection(parts);
    }

    /**
     * Adds an HTTP multipart part.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent addPart(Part part) {
        parts.add(Preconditions.checkNotNull(part));
        return this;
    }

    /**
     * Sets the parts of the HTTP multipart request.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setParts(Collection<Part> parts) {
        this.parts = new ArrayList<>(parts);
        return this;
    }

    /**
     * Sets the HTTP content parts of the HTTP multipart request, where each part is assumed to have
     * no HTTP headers and no encoding.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */

{
        this.parts = new ArrayList<>(contentParts.size());
        for (HttpContent contentPart : contentParts) {
            addPart(new Part(contentPart));
        }
        return this;
    }

    /**
     * Returns the boundary string to use.
     */
    public final String getBoundary() {
        return getMediaType().getParameter("boundary");
    }

    /**
     * Sets the boundary string to use.
     *
     *
Defaults to {@code "END_OF_PART"}.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setBoundary(String boundary) {
        getMediaType().setParameter("boundary", Preconditions.checkNotNull(boundary));
        return this;
    }

    /**
     * Single part of a multi-part request.
     *
     *
Implementation is not thread-safe.
     */
    public static final class Part {

        /**
         * HTTP content or {@code null} for none.
         */
        HttpContent content;

        /**
         * HTTP headers or {@code null} for none.
         */
        HttpHeaders headers;

        /**
         * HTTP encoding or {@code null} for none.
         */
        HttpEncoding encoding;

        public Part() {
            this(null);
        }

        /**
         * @param content HTTP content or {@code null} for none
         */
        public Part(HttpContent content) {
            this(null, content);
        }

        /**
         * @param headers HTTP headers or {@code null} for none
         * @param content HTTP content or {@code null} for none
         */
        public Part(HttpHeaders headers, HttpContent content) {
            setHeaders(headers);
            setContent(content);
        }

        /**
         * Sets the HTTP content or {@code null} for none.
         */
        public Part setContent(HttpContent content) {
            this.content = content;
            return this;
        }

        /**
         * Returns the HTTP content or {@code null} for none.
         */
        public HttpContent getContent() {
            return content;
        }

        /**
         * Sets the HTTP headers or {@code null} for none.
         */
        public Part setHeaders(HttpHeaders headers) {
            this.headers = headers;
            return this;
        }

        /**
         * Returns the HTTP headers or {@code null} for none.
         */
        public HttpHeaders getHeaders() {
            return headers;
        }

        /**
         * Sets the HTTP encoding or {@code null} for none.
         */
        public Part setEncoding(HttpEncoding encoding) {
            this.encoding = encoding;
            return this;
        }

        /**
         * Returns the HTTP encoding or {@code null} for none.
         */
        public HttpEncoding getEncoding() {
            return encoding;
        }
    }
}


{
        getMediaType().setParameter("boundary", Preconditions.checkNotNull(boundary));
        return this;
    }

package com.google.api.client.http;

import com.google.api.client.util.Preconditions;
import com.google.api.client.util.StreamingContent;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;

/**
 * Serializes MIME multipart content as specified by RFC 2387: The MIME Multipart/Related Content-type
 * and RFC 2046: Multipurpose Internet
 * Mail Extensions: The Multipart/mixed (primary) subtype.
 *
 *
By default the media type is {@code "multipart/related; boundary=__END_OF_PART__<random
 * UUID>__"}, but this may be customized by calling {@link #setMediaType(HttpMediaType)}, {@link
 * #getMediaType()}, or {@link #setBoundary(String)}.
 *
 *
Implementation is not thread-safe.
 *
 * @since 1.14
 * @author Yaniv Inbar
 */
public class MultipartContent extends AbstractHttpContent {

    static final String NEWLINE = "\r\n";

    private static final String TWO_DASHES = "--";

    /**
     * Parts of the HTTP multipart request.
     */
    private ArrayList<Part> parts = new ArrayList<>();

    public MultipartContent() {
        this("__END_OF_PART__" + UUID.randomUUID().toString() + "__");
    }

    public MultipartContent(String boundary) {
        super(new HttpMediaType("multipart/related").setParameter("boundary", boundary));
    }

    public void writeTo(OutputStream out) throws IOException {
        Writer writer = new OutputStreamWriter(out, getCharset());
        String boundary = getBoundary();
        for (Part part : parts) {
            HttpHeaders headers = new HttpHeaders().setAcceptEncoding(null);
            if (part.headers != null) {
                headers.fromHttpHeaders(part.headers);
            }
            headers.setContentEncoding(null).setUserAgent(null).setContentType(null).setContentLength(null).set("Content-Transfer-Encoding", null);
            // analyze the content
            HttpContent content = part.content;
            StreamingContent streamingContent = null;
            if (content != null) {
                headers.set("Content-Transfer-Encoding", Arrays.asList("binary"));
                headers.setContentType(content.getType());
                HttpEncoding encoding = part.encoding;
                long contentLength;
                if (encoding == null) {
                    contentLength = content.getLength();
                    streamingContent = content;
                } else {
                    headers.setContentEncoding(encoding.getName());
                    streamingContent = new HttpEncodingStreamingContent(content, encoding);
                    contentLength = AbstractHttpContent.computeLength(content);
                }
                if (contentLength != -1) {
                    headers.setContentLength(contentLength);
                }
            }
            // write multipart-body from RFC 1521 §7.2.1
            // write encapsulation
            // write delimiter
            writer.write(TWO_DASHES);
            writer.write(boundary);
            writer.write(NEWLINE);
            // write body-part; message from RFC 822 §4.1
            // write message fields
            HttpHeaders.serializeHeadersForMultipartRequests(headers, null, null, writer);
            if (streamingContent != null) {
                writer.write(NEWLINE);
                writer.flush();
                // write message text/body
                streamingContent.writeTo(out);
            }
            // terminate encapsulation
            writer.write(NEWLINE);
        }
        // write close-delimiter
        writer.write(TWO_DASHES);
        writer.write(boundary);
        writer.write(TWO_DASHES);
        writer.write(NEWLINE);
        writer.flush();
    }

    @Override
    public boolean retrySupported() {
        for (Part part : parts) {
            if (!part.content.retrySupported()) {
                return false;
            }
        }
        return true;
    }

    @Override
    public MultipartContent setMediaType(HttpMediaType mediaType) {
        super.setMediaType(mediaType);
        return this;
    }

    /**
     * Returns an unmodifiable view of the parts of the HTTP multipart request.
     */
    public final Collection<Part> getParts() {
        return Collections.unmodifiableCollection(parts);
    }

    /**
     * Adds an HTTP multipart part.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent addPart(Part part) {
        parts.add(Preconditions.checkNotNull(part));
        return this;
    }

    /**
     * Sets the parts of the HTTP multipart request.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setParts(Collection<Part> parts) {
        this.parts = new ArrayList<>(parts);
        return this;
    }

    /**
     * Sets the HTTP content parts of the HTTP multipart request, where each part is assumed to have
     * no HTTP headers and no encoding.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setContentParts(Collection<? extends HttpContent> contentParts) {
        this.parts = new ArrayList<>(contentParts.size());
        for (HttpContent contentPart : contentParts) {
            addPart(new Part(contentPart));
        }
        return this;
    }

    /**
     * Returns the boundary string to use.
     */
    public final String getBoundary() {
        return getMediaType().getParameter("boundary");
    }

    /**
     * Sets the boundary string to use.
     *
     *
Defaults to {@code "END_OF_PART"}.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setBoundary(String boundary)

    /**
     * Single part of a multi-part request.
     *
     * <p>Implementation is not thread-safe.
     */
    public static final class Part {

        /**
         * HTTP content or {@code null} for none.
         */
        HttpContent content;

        /**
         * HTTP headers or {@code null} for none.
         */
        HttpHeaders headers;

        /**
         * HTTP encoding or {@code null} for none.
         */
        HttpEncoding encoding;

        public Part() {
            this(null);
        }

        /**
         * @param content HTTP content or {@code null} for none
         */
        public Part(HttpContent content) {
            this(null, content);
        }

        /**
         * @param headers HTTP headers or {@code null} for none
         * @param content HTTP content or {@code null} for none
         */
        public Part(HttpHeaders headers, HttpContent content) {
            setHeaders(headers);
            setContent(content);
        }

        /**
         * Sets the HTTP content or {@code null} for none.
         */
        public Part setContent(HttpContent content) {
            this.content = content;
            return this;
        }

        /**
         * Returns the HTTP content or {@code null} for none.
         */
        public HttpContent getContent() {
            return content;
        }

        /**
         * Sets the HTTP headers or {@code null} for none.
         */
        public Part setHeaders(HttpHeaders headers) {
            this.headers = headers;
            return this;
        }

        /**
         * Returns the HTTP headers or {@code null} for none.
         */
        public HttpHeaders getHeaders() {
            return headers;
        }

        /**
         * Sets the HTTP encoding or {@code null} for none.
         */
        public Part setEncoding(HttpEncoding encoding) {
            this.encoding = encoding;
            return this;
        }

        /**
         * Returns the HTTP encoding or {@code null} for none.
         */
        public HttpEncoding getEncoding() {
            return encoding;
        }
    }
}


package com.google.api.client.http;

import com.google.api.client.util.Preconditions;
import com.google.api.client.util.StreamingContent;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;

/**
 * Serializes MIME multipart content as specified by RFC 2387: The MIME Multipart/Related Content-type
 * and RFC 2046: Multipurpose Internet
 * Mail Extensions: The Multipart/mixed (primary) subtype.
 *
 *
By default the media type is {@code "multipart/related; boundary=__END_OF_PART__<random
 * UUID>__"}, but this may be customized by calling {@link #setMediaType(HttpMediaType)}, {@link
 * #getMediaType()}, or {@link #setBoundary(String)}.
 *
 *
Implementation is not thread-safe.
 *
 * @since 1.14
 * @author Yaniv Inbar
 */
public class MultipartContent extends AbstractHttpContent {

    static final String NEWLINE = "\r\n";

    private static final String TWO_DASHES = "--";

    /**
     * Parts of the HTTP multipart request.
     */
    private ArrayList<Part> parts = new ArrayList<>();

    public MultipartContent() {
        this("__END_OF_PART__" + UUID.randomUUID().toString() + "__");
    }

    public MultipartContent(String boundary) {
        super(new HttpMediaType("multipart/related").setParameter("boundary", boundary));
    }

    public void writeTo(OutputStream out) throws IOException {
        Writer writer = new OutputStreamWriter(out, getCharset());
        String boundary = getBo

for (Part part : parts) {
            HttpHeaders headers = new HttpHeaders().setAcceptEncoding(null);
            if (part.headers != null) {
                headers.fromHttpHeaders(part.headers);
            }
            headers.setContentEncoding(null).setUserAgent(null).setContentType(null).setContentLength(null).set("Content-Transfer-Encoding", null);
            // analyze the content
            HttpContent content = part.content;
            StreamingContent streamingContent = null;
            if (content != null) {
                headers.set("Content-Transfer-Encoding", Arrays.asList("binary"));
                headers.setContentType(content.getType());
                HttpEncoding encoding = part.encoding;
                long contentLength;
                if (encoding == null) {
                    contentLength = content.getLength();
                    streamingContent = content;
                } else {
                    headers.setContentEncoding(encoding.getName());
                    streamingContent = new HttpEncodingStreamingContent(content, encoding);
                    contentLength = AbstractHttpContent.computeLength(content);
                }
                if (contentLength != -1) {
                    headers.setContentLength(contentLength);
                }
            }
            // write multipart-body from RFC 1521 §7.2.1
            // write encapsulation
            // write delimiter
            writer.write(TWO_DASHES);
            writer.write(boundary);
            writer.write(NEWLINE);
            // write body-part; message from RFC 822 §4.1
            // write message fields
            HttpHeaders.serializeHeadersForMultipartRequests(headers, null, null, writer);
            if (streamingContent != null) {
                writer.write(NEWLINE);
                writer.flush();
                // write message text/body
                streamingContent.writeTo(out);
            }
            // terminate encapsulation
            writer.write(NEWLINE);
        }
        // write close-delimiter
        writer.write(TWO_DASHES);
        writer.write(boundary);
        writer.write(TWO_DASHES);
        writer.write(NEWLINE);
        writer.flush();
    }

    @Override
    public boolean retrySupported() {
        for (Part part : parts) {
            if (!part.content.retrySupported()) {
                return false;
            }
        }
        return true;
    }

    @Override
    public MultipartContent setMediaType(HttpMediaType mediaType) {
        super.setMediaType(mediaType);
        return this;
    }

    /**
     * Returns an unmodifiable view of the parts of the HTTP multipart request.
     */
    public final Collection<Part> getParts() {
        return Collections.unmodifiableCollection(parts);
    }

    /**
     * Adds an HTTP multipart part.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent addPart(Part part) {
        parts.add(Preconditions.checkNotNull(part));
        return this;
    }

    /**
     * Sets the parts of the HTTP multipart request.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setParts(Collection<Part> parts) {
        this.parts = new ArrayList<>(parts);
        return this;
    }

    /**
     * Sets the HTTP content parts of the HTTP multipart request, where each part is assumed to have
     * no HTTP headers and no encoding.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setContentParts(Collection<? extends HttpContent> contentParts) {
        this.parts = new ArrayList<>(contentParts.size());
        for (HttpContent contentPart : contentParts) {
            addPart(new Part(contentPart));
        }
        return this;
    }

    /**
     * Returns the boundary string to use.
     */
    public final String getBoundary() {
        return getMediaType().getParameter("boundary");
    }

    /**
     * Sets the boundary string to use.
     *
     *
Defaults to {@code "END_OF_PART"}.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setBoundary(String boundary) {
        getMediaType().setParameter("boundary", Preconditions.checkNotNull(boundary));
        return this;
    }

    /**
     * Single part of a multi-part request.
     *
     *
Implementation is not thread-safe.
     */
    public static final class Part {

        /**
         * HTTP content or {@code null} for none.
         */
        HttpContent content;

        /**
         * HTTP headers or {@code null} for none.
         */
        HttpHeaders headers;

        /**
         * HTTP encoding or {@code null} for none.
         */
        HttpEncoding encoding;

        public Part() {
            this(null);
        }

        /**
         * @param content HTTP content or {@code null} for none
         */
        public Part(HttpContent content) {
            this(null, content);
        }

        /**
         * @param headers HTTP headers or {@code null} for none
         * @param content HTTP content or {@code null} for none
         */
        public Part(HttpHeaders headers, HttpContent content) {
            setHeaders(headers);
            setContent(content);
        }

        /**
         * Sets the HTTP content or {@code null} for none.
         */
        public Part setContent(HttpContent content) {
            this.content = content;
            return this;
        }

        /**
         * Returns the HTTP content or {@code null} for none.
         */
        public HttpContent getContent() {
            return content;
        }

        /**
         * Sets the HTTP headers or {@code null} for none.
         */
        public Part setHeaders(HttpHeaders headers) {
            this.headers = headers;
            return this;
        }

        /**
         * Returns the HTTP headers or {@code null} for none.
         */
        public HttpHeaders getHeaders() {
            return headers;
        }

        /**
         * Sets the HTTP encoding or {@code null} for none.
         */
        public Part setEncoding(HttpEncoding encoding) {
            this.encoding = encoding;
            return this;
        }

        /**
         * Returns the HTTP encoding or {@code null} for none.
         */
        public HttpEncoding getEncoding() {
            return encoding;
        }
    }
}


public MultipartContent setBoundary(String boundary) {
        getMediaType().setParameter("boundary", Preconditions.checkNotNull(boundary));
        return this;
    }

package com.google.api.client.http;

import com.google.api.client.util.Preconditions;
import com.google.api.client.util.StreamingContent;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;

/**
 * Serializes MIME multipart content as specified by RFC 2387: The MIME Multipart/Related Content-type
 * and RFC 2046: Multipurpose Internet
 * Mail Extensions: The Multipart/mixed (primary) subtype.
 *
 *
By default the media type is {@code "multipart/related; boundary=__END_OF_PART__<random
 * UUID>__"}, but this may be customized by calling {@link #setMediaType(HttpMediaType)}, {@link
 * #getMediaType()}, or {@link #setBoundary(String)}.
 *
 *
Implementation is not thread-safe.
 *
 * @since 1.14
 * @author Yaniv Inbar
 */
public class MultipartContent extends AbstractHttpContent {

    static final String NEWLINE = "\r\n";

    private static final String TWO_DASHES = "--";

    /**
     * Parts of the HTTP multipart request.
     */
    private ArrayList<Part> parts = new ArrayList<>();

    public MultipartContent() {
        this("__END_OF_PART__" + UUID.randomUUID().toString() + "__");
    }

    public MultipartContent(String boundary) {
        super(new HttpMediaType("multipart/related").setParameter("boundary", boundary));
    }

    public void writeTo(OutputStream out) throws IOException {
        Writer writer = new OutputStreamWriter(out, getCharset());
        String boundary = getBoundary();
        for (Part part : parts) {
            HttpHeaders headers = new HttpHeaders().setAcceptEncoding(null);
            if (part.headers != null) {
                headers.fromHttpHeaders(part.headers);
            }
            headers.setContentEncoding(null).setUserAgent(null).setContentType(null).setContentLength(null).set("Content-Transfer-Encoding", null);
            // analyze the content
            HttpContent content = part.content;
            StreamingContent streamingContent = null;
            if (content != null) {
                headers.set("Content-Transfer-Encoding", Arrays.asList("binary"));
                headers.setContentType(content.getType());
                HttpEncoding encoding = part.encoding;
                long contentLength;
                if (encoding == null) {
                    contentLength = content.getLength();
                    streamingContent = content;
                } else {
                    headers.setContentEncoding(encoding.getName());
                    streamingContent = new HttpEncodingStreamingContent(content, encoding);
                    contentLength = AbstractHttpContent.computeLength(content);
                }
                if (contentLength != -1) {
                    headers.setContentLength(contentLength);
                }
            }
            // write multipart-body from RFC 1521 §7.2.1
            // write encapsulation
            // write delimiter
            writer.write(TWO_DASHES);
            writer.write(boundary);
            writer.write(NEWLINE);
            // write body-part; message from RFC 822 §4.1
            // write message fields
            HttpHeaders.serializeHeadersForMultipartRequests(headers, null, null, writer);
            if (streamingContent != null) {
                writer.write(NEWLINE);
                writer.flush();
                // write message text/body
                streamingContent.writeTo(out);
            }
            // terminate encapsulation
            writer.write(NEWLINE);
        }
        // write close-delimiter
        writer.write(TWO_DASHES);
        writer.write(boundary);
        writer.write(TWO_DASHES);
        writer.write(NEWLINE);
        writer.flush();
    }

    @Override
    public boolean retrySupported() {
        for (Part part : parts) {
            if (!part.content.retrySupported()) {
                return false;
            }
        }
        return true;
    }

    @Override
    public MultipartContent setMediaType(HttpMediaType mediaType) {
        super.setMediaType(mediaType);
        return this;
    }

    /**
     * Returns an unmodifiable view of the parts of the HTTP multipart request.
     */
    public final Collection<Part> getParts() {
        return Collections.unmodifiableCollection(parts);
    }

    /**
     * Adds an HTTP multipart part.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent addPart(Part part) {
        parts.add(Preconditions.checkNotNull(part));
        return this;
    }

    /**
     * Sets the parts of the HTTP multipart request.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setParts(Collection<Part> parts) {
        this.parts = new ArrayList<>(parts);
        return this;
    }

    /**
     * Sets the HTTP content parts of the HTTP multipart request, where each part is assumed to have
     * no HTTP headers and no encoding.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */
    public MultipartContent setContentParts(Collection<? extends HttpContent> contentParts) {
        this.parts = new ArrayList<>(contentParts.size());
        for (HttpContent contentPart : contentParts) {
            addPart(new Part(contentPart));
        }
        return this;
    }

    /**
     * Returns the boundary string to use.
     */
    public final String getBoundary() {
        return getMediaType().getParameter("boundary");
    }

    /**
     * Sets the boundary string to use.
     *
     *
Defaults to {@code "END_OF_PART"}.
     *
     *
Overriding is only supported for the purpose of calling the super implementation and
     * changing the return type, but nothing else.
     */


protected Object getAttributeValueOf(Attribute attr, String stringValue)

package org.netbeans.modules.websvc.api.jaxws.bindings.impl;

import java.util.List;
import javax.xml.namespace.QName;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsComponent;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsModel;
import org.netbeans.modules.xml.xam.dom.Attribute;
import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * @author Roderico Cruz
 */
public abstract class BindingsComponentImpl extends AbstractDocumentComponent<BindingsComponent> implements BindingsComponent {

    /**
     * Creates a new instance of BindingsComponentImpl
     */
    public BindingsComponentImpl(BindingsModelImpl model, Element e) {
        super(model, e);
    }

{
        return stringValue;
    }

    protected void populateChildren(List<BindingsComponent> children) {
        NodeList nl = getPeer().getChildNodes();
        if (nl != null) {
            for (int i = 0; i < nl.getLength(); i++) {
                org.w3c.dom.Node n = nl.item(i);
                if (n instanceof Element) {
                    BindingsModel bindingsModel = getModel();
                    BindingsComponentImpl comp = (BindingsComponentImpl) bindingsModel.getFactory().create((Element) n, this);
                    if (comp != null) {
                        children.add(comp);
                    }
                }
            }
        }
    }

    protected abstract String getNamespaceURI();

    public BindingsModelImpl getModel() {
        return (BindingsModelImpl) super.getModel();
    }

    protected static org.w3c.dom.Element createNewElement(QName qName, BindingsModel model) {
        return model.getDocument().createElementNS(qName.getNamespaceURI(), qName.getLocalPart());
    }

    protected static org.w3c.dom.Element createPrefixedElement(QName qName, BindingsModel model) {
        org.w3c.dom.Element e = createNewElement(qName, model);
        e.setPrefix(qName.getPrefix());
        return e;
    }
}


{
        return model.getDocument().createElementNS(qName.getNamespaceURI(), qName.getLocalPart());
    }

package org.netbeans.modules.websvc.api.jaxws.bindings.impl;

import java.util.List;
import javax.xml.namespace.QName;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsComponent;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsModel;
import org.netbeans.modules.xml.xam.dom.Attribute;
import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * @author Roderico Cruz
 */
public abstract class BindingsComponentImpl extends AbstractDocumentComponent<BindingsComponent> implements BindingsComponent {

    /**
     * Creates a new instance of BindingsComponentImpl
     */
    public BindingsComponentImpl(BindingsModelImpl model, Element e) {
        super(model, e);
    }

    protected Object getAttributeValueOf(Attribute attr, String stringValue) {
        return stringValue;
    }

    protected void populateChildren(List<BindingsComponent> children) {
        NodeList nl = getPeer().getChildNodes();
        if (nl != null) {
            for (int i = 0; i < nl.getLength(); i++) {
                org.w3c.dom.Node n = nl.item(i);
                if (n instanceof Element) {
                    BindingsModel bindingsModel = getModel();
                    BindingsComponentImpl comp = (BindingsComponentImpl) bindingsModel.getFactory().create((Element) n, this);
                    if (comp != null) {
                        children.add(comp);
                    }
                }
            }
        }
    }

    protected abstract String getNamespaceURI();

    public BindingsModelImpl getModel() {
        return (BindingsModelImpl) super.getModel();
    }

    protected static org.w3c.dom.Element createNewElement(QName qName, BindingsModel model)

    protected static org.w3c.dom.Element createPrefixedElement(QName qName, BindingsModel model) {
        org.w3c.dom.Element e = createNewElement(qName, model);
        e.setPrefix(qName.getPrefix());
        return e;
    }
}


package org.netbeans.modules.websvc.api.jaxws.bindings.impl;

import java.util.List;
import javax.xml.namespace.QName;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsComponent;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsModel;
import org.netbeans.modules.xml.xam.dom.Attribute;
import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * @author Roderico Cruz
 */
public abstract class BindingsComponentImpl extends AbstractDocumentComponent<BindingsComponent> implements BindingsComponent {

    /**
     * Creates a new instance of BindingsComponentImpl
     */
    public BindingsComponentImpl(BindingsModelImpl model, Element e) {
        super(model, e);
    }

    protected Object getAttributeValueOf(Attribute attr, String stringValue) {
        return stringValue;
    }

    protected void populateChildren(List<BindingsComponent> children) {
        NodeList nl = getPeer().getChildNodes();
        if (nl != null) {
            for (int i = 0; i < nl.getLength(); i++) {
                org.w3c.dom.Node n = nl.item(i);
                if (n instanceof Element) {
                    BindingsModel bindingsModel = getModel();
                    BindingsComponentImpl comp = (BindingsComponentImpl) bindingsModel.getFactory().create((Element) n, this);
                    if (comp != null) {
                        children.add(comp);
                    }
                }
            }
        }
    }

    protected abstract String getNamespaceURI();

    public BindingsModelImpl getModel() {
        return (BindingsModelImpl) super.getModel();
    }

    protected static org.w3c.dom.Element createNewElement(QName qName, BindingsModel model) {
        return model.getDocument().createElementNS(qName.getNamespaceURI(), qName.getLocalPart());
    }

    protected static org.w3c.dom.Element createPrefixedElement(QName qName, BindingsModel model) {
        org.w3c.dom.Element e = createNewEle

        e.setPrefix(qName.getPrefix());
        return e;
    }
}


for (int i = 0; i < nl.getLength(); i++) {
                org.w3c.dom.Node n = nl.item(i);
                if (n instanceof Element) {
                    BindingsModel bindingsModel = getModel();
                    BindingsComponentImpl comp = (BindingsComponentImpl) bindingsModel.getFactory().create((Element) n, this);
                    if (comp != null) {
                        children.add(comp);
                    }
                }
            }

package org.netbeans.modules.websvc.api.jaxws.bindings.impl;

import java.util.List;
import javax.xml.namespace.QName;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsComponent;
import org.netbeans.modules.websvc.api.jaxws.bindings.BindingsModel;
import org.netbeans.modules.xml.xam.dom.Attribute;
import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * @author Roderico Cruz
 */
public abstract class BindingsComponentImpl extends AbstractDocumentComponent<BindingsComponent> implements BindingsComponent {

    /**
     * Creates a new instance of BindingsComponentImpl
     */
    public BindingsComponentImpl(BindingsModelImpl model, Element e) {
        super(model, e);
    }

    protected Object getAttributeValueOf(Attribute attr, String stringValue) {
        return stringValue;
    }

    protected void populateChildren(List<BindingsComponent> children) {
        NodeList nl = getPeer().getChildNodes();
        if (nl != null) {

        }
    }

    protected abstract String getNamespaceURI();

    public BindingsModelImpl getModel() {
        return (BindingsModelImpl) super.getModel();
    }

    protected static org.w3c.dom.Element createNewElement(QName qName, BindingsModel model) {
        return model.getDocument().createElementNS(qName.getNamespaceURI(), qName.getLocalPart());
    }

    protected static org.w3c.dom.Element createPrefixedElement(QName qName, BindingsModel model) {
        org.w3c.dom.Element e = createNewElement(qName, model);
        e.setPrefix(qName.getPrefix());
        return e;
    }
}


@Override
    protected void read(ByteBuf clientdata)

package protocolsupport.protocol.packet.middleimpl.serverbound.login.v_7_8_9r1_9r2_10_11_12r1_12r2_13_14r1_14r2_15_16r1_16r2_17r1_17r2;

import io.netty.buffer.ByteBuf;
import protocolsupport.protocol.codec.StringCodec;
import protocolsupport.protocol.packet.middle.serverbound.login.MiddleLoginStart;

public class LoginStart extends MiddleLoginStart {

    public LoginStart(MiddlePacketInit init) {
        super(init);
    }

{
        name = StringCodec.readVarIntUTF8String(clientdata, 16);
    }
}


{
        name = StringCodec.readVarIntUTF8String(clientdata, 16);
    }

package protocolsupport.protocol.packet.middleimpl.serverbound.login.v_7_8_9r1_9r2_10_11_12r1_12r2_13_14r1_14r2_15_16r1_16r2_17r1_17r2;

import io.netty.buffer.ByteBuf;
import protocolsupport.protocol.codec.StringCodec;
import protocolsupport.protocol.packet.middle.serverbound.login.MiddleLoginStart;

public class LoginStart extends MiddleLoginStart {

    public LoginStart(MiddlePacketInit init) {
        super(init);
    }

    @Override
    protected void read(ByteBuf clientdata)


package protocolsupport.protocol.packet.middleimpl.serverbound.login.v_7_8_9r1_9r2_10_11_12r1_12r2_13_14r1_14r2_15_16r1_16r2_17r1_17r2;

import io.netty.buffer.ByteBuf;
import protocolsupport.protocol.codec.StringCodec;
import protocolsupport.protocol.packet.middle.serverbound.login.MiddleLoginStart;

public class LoginStart extends MiddleLoginStart {

    public LoginStart(MiddlePacketInit init) {
        super(init);
    }

    @Override
    protected void read(ByteBuf clientdata) {
        name = StringCode


package streaming;

import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.streaming.Duration;
import org.apache.spark.streaming.api.java.JavaDStream;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import streaming.util.CSVFileStreamGenerator;
import streaming.util.StreamingItem;
import java.io.IOException;

/**
 * The windowing methods on a stream allow you to create a derived stream whose batches contain data from some
 * number fo the most recent batches in the parent stream, and producing a batch per some number of parent
 * stream batches (default is one.)
 *
 * Both the sliding window size and the batch frequency are specified as durations, which must be integer
 * multiples of the parent stream's batch duration. Of course, the parent stream could itself have been
 * derived from another stream, so its batch duration will not necessarily be the duration specified for the
 * JavaStreamingContext.
 *
 * This example creates two derived streams with different window and slide durations. All three streams print
 * their batch size every time they produce a batch, so you can compare the number of records across streams
 * and batches.
 */
public class Windowing {

{
        // The "modern" way to initialize Spark is to create a SparkSession
        // although they really come from the world of Spark SQL, and Dataset
        // and DataFrame.
        SparkSession spark = SparkSession.builder().appName("streaming-Windowing").master("local[4]").getOrCreate();
        // Operating on a raw RDD actually requires access to the more low
        // level SparkContext -- get the special Java version for convenience
        JavaSparkContext sc = new JavaSparkContext(spark.sparkContext());
        // streams will produce data every second (note: it would be nice if this was Java 8's Duration class,
        // but it isn't -- it comes from org.apache.spark.streaming)
        JavaStreamingContext ssc = new JavaStreamingContext(sc, new Duration(1000));
        // use the utility class to produce a sequence of 10 files, each containing 100 records
        CSVFileStreamGenerator fm = new CSVFileStreamGenerator(10, 100, 500);
        // create the stream, which will contain the rows of the individual files as strings
        // -- notice we can create the stream even though this directory won't have any data until we call
        JavaDStream<String> streamOfRecords = ssc.textFileStream(fm.getDestination().getAbsolutePath());
        // Create a derived stream that will produce a batch every second (just like its parent) but the
        // batch will contain data from the parent stream's most recent two batches
        JavaDStream<String> threeSecondsEverySecond = streamOfRecords.window(new Duration(3000));
        // Another derived stream, this time creating batch every two seconds, but containing the data from
        // the parent stream's most recent five batches
        JavaDStream<String> fiveSecondsEveryTwoSeconds = streamOfRecords.window(new Duration(5000), new Duration(2000));
        // Register functions to print the batch sizes in all three of the streams. Notice that:
        // 1) Each stream identifies itself as either [original], [window 3s] or [window 3s slide 2s]
        // 2) The "window duration" is how far back int he parent's stream is included in very batch
        // 3) The "slide duration" is how often a "windowed" batch is produced byt he derived stream (default is the
        // same as the parent's "batch duration")
        // 4) You will see output from the [window 3s] stream every second, but only every two seconds from
        // [window 3s slide 2s] -- and you can check the item counts against the right number of most recent item
        // counts from the [original] stream.
        // 5) Time stamps are included to help you keep track of the batches
        streamOfRecords.foreachRDD((rdd, timeStamp) -> System.out.println("[original] TS: " + timeStamp + " Item count = " + rdd.count()));
        threeSecondsEverySecond.foreachRDD((rdd, timeStamp) -> System.out.println("[window 3s] TS: " + timeStamp + " Item count = " + rdd.count()));
        fiveSecondsEveryTwoSeconds.foreachRDD((rdd, timeStamp) -> System.out.println("[window 5s slide 2s] TS: " + timeStamp + " Item count = " + rdd.count()));
        // start streaming
        System.out.println("*** about to start streaming");
        ssc.start();
        Thread t = new Thread() {

            public void run() {
                try {
                    // A curious fact about files based streaming is that any files written
                    // before the first RDD is produced are ignored. So wait longer than
                    // that before producing files.
                    Thread.sleep(2000);
                    System.out.println("*** producing data");
                    // start producing files
                    fm.makeFiles();
                    // give it time to get processed
                    Thread.sleep(10000);
                } catch (InterruptedException ie) {
                } catch (IOException ioe) {
                    throw new RuntimeException("problem in background thread", ioe);
                }
                ssc.stop();
                System.out.println("*** stopping streaming");
            }
        };
        t.start();
        try {
            ssc.awaitTermination();
        } catch (InterruptedException ie) {
        }
        System.out.println("*** Streaming terminated");
    }
}


condsEverySecond.foreachRDD((rdd, timeStamp) -> System.out.println("[window 3s] TS: " + timeStamp + " Item count = " + rdd.count()));

package streaming;

import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.streaming.Duration;
import org.apache.spark.streaming.api.java.JavaDStream;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import streaming.util.CSVFileStreamGenerator;
import streaming.util.StreamingItem;
import java.io.IOException;

/**
 * The windowing methods on a stream allow you to create a derived stream whose batches contain data from some
 * number fo the most recent batches in the parent stream, and producing a batch per some number of parent
 * stream batches (default is one.)
 *
 * Both the sliding window size and the batch frequency are specified as durations, which must be integer
 * multiples of the parent stream's batch duration. Of course, the parent stream could itself have been
 * derived from another stream, so its batch duration will not necessarily be the duration specified for the
 * JavaStreamingContext.
 *
 * This example creates two derived streams with different window and slide durations. All three streams print
 * their batch size every time they produce a batch, so you can compare the number of records across streams
 * and batches.
 */
public class Windowing {

    public static void main(String[] args) {
        // The "modern" way to initialize Spark is to create a SparkSession
        // although they really come from the world of Spark SQL, and Dataset
        // and DataFrame.
        SparkSession spark = SparkSession.builder().appName("streaming-Windowing").master("local[4]").getOrCreate();
        // Operating on a raw RDD actually requires access to the more low
        // level SparkContext -- get the special Java version for convenience
        JavaSparkContext sc = new JavaSparkContext(spark.sparkContext());
        // streams will produce data every second (note: it would be nice if this was Java 8's Duration class,
        // but it isn't -- it comes from org.apache.spark.streaming)
        JavaStreamingContext ssc = new JavaStreamingContext(sc, new Duration(1000));
        // use the utility class to produce a sequence of 10 files, each containing 100 records
        CSVFileStreamGenerator fm = new CSVFileStreamGenerator(10, 100, 500);
        // create the stream, which will contain the rows of the individual files as strings
        // -- notice we can create the stream even though this directory won't have any data until we call
        JavaDStream<String> streamOfRecords = ssc.textFileStream(fm.getDestination().getAbsolutePath());
        // Create a derived stream that will produce a batch every second (just like its parent) but the
        // batch will contain data from the parent stream's most recent two batches
        JavaDStream<String> threeSecondsEverySecond = streamOfRecords.window(new Duration(3000));
        // Another derived stream, this time creating batch every two seconds, but containing the data from
        // the parent stream's most recent five batches
        JavaDStream<String> fiveSecondsEveryTwoSeconds = streamOfRecords.window(new Duration(5000), new Duration(2000));
        // Register functions to print the batch sizes in all three of the streams. Notice that:
        // 1) Each stream identifies itself as either [original], [window 3s] or [window 3s slide 2s]
        // 2) The "window duration" is how far back int he parent's stream is included in very batch
        // 3) The "slide duration" is how often a "windowed" batch is produced byt he derived stream (default is the
        // same as the parent's "batch duration")
        // 4) You will see output from the [window 3s] stream every second, but only every two seconds from
        // [window 3s slide 2s] -- and you can check the item counts against the right number of most recent item
        // counts from the [original] stream.
        // 5) Time stamps are included to help you keep track of the batches
        streamOfRecords.foreachRDD((rdd, timeStamp) -> System.out.println("[original] TS: " + timeStamp + " Item count = " + rdd.count()));
        threeSe

        fiveSecondsEveryTwoSeconds.foreachRDD((rdd, timeStamp) -> System.out.println("[window 5s slide 2s] TS: " + timeStamp + " Item count = " + rdd.count()));
        // start streaming
        System.out.println("*** about to start streaming");
        ssc.start();
        Thread t = new Thread() {

            public void run() {
                try {
                    // A curious fact about files based streaming is that any files written
                    // before the first RDD is produced are ignored. So wait longer than
                    // that before producing files.
                    Thread.sleep(2000);
                    System.out.println("*** producing data");
                    // start producing files
                    fm.makeFiles();
                    // give it time to get processed
                    Thread.sleep(10000);
                } catch (InterruptedException ie) {
                } catch (IOException ioe) {
                    throw new RuntimeException("problem in background thread", ioe);
                }
                ssc.stop();
                System.out.println("*** stopping streaming");
            }
        };
        t.start();
        try {
            ssc.awaitTermination();
        } catch (InterruptedException ie) {
        }
        System.out.println("*** Streaming terminated");
    }
}


try {
            ssc.awaitTermination();
        } catch (InterruptedException ie) {
        }

package streaming;

import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.streaming.Duration;
import org.apache.spark.streaming.api.java.JavaDStream;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import streaming.util.CSVFileStreamGenerator;
import streaming.util.StreamingItem;
import java.io.IOException;

/**
 * The windowing methods on a stream allow you to create a derived stream whose batches contain data from some
 * number fo the most recent batches in the parent stream, and producing a batch per some number of parent
 * stream batches (default is one.)
 *
 * Both the sliding window size and the batch frequency are specified as durations, which must be integer
 * multiples of the parent stream's batch duration. Of course, the parent stream could itself have been
 * derived from another stream, so its batch duration will not necessarily be the duration specified for the
 * JavaStreamingContext.
 *
 * This example creates two derived streams with different window and slide durations. All three streams print
 * their batch size every time they produce a batch, so you can compare the number of records across streams
 * and batches.
 */
public class Windowing {

    public static void main(String[] args) {
        // The "modern" way to initialize Spark is to create a SparkSession
        // although they really come from the world of Spark SQL, and Dataset
        // and DataFrame.
        SparkSession spark = SparkSession.builder().appName("streaming-Windowing").master("local[4]").getOrCreate();
        // Operating on a raw RDD actually requires access to the more low
        // level SparkContext -- get the special Java version for convenience
        JavaSparkContext sc = new JavaSparkContext(spark.sparkContext());
        // streams will produce data every second (note: it would be nice if this was Java 8's Duration class,
        // but it isn't -- it comes from org.apache.spark.streaming)
        JavaStreamingContext ssc = new JavaStreamingContext(sc, new Duration(1000));
        // use the utility class to produce a sequence of 10 files, each containing 100 records
        CSVFileStreamGenerator fm = new CSVFileStreamGenerator(10, 100, 500);
        // create the stream, which will contain the rows of the individual files as strings
        // -- notice we can create the stream even though this directory won't have any data until we call
        JavaDStream<String> streamOfRecords = ssc.textFileStream(fm.getDestination().getAbsolutePath());
        // Create a derived stream that will produce a batch every second (just like its parent) but the
        // batch will contain data from the parent stream's most recent two batches
        JavaDStream<String> threeSecondsEverySecond = streamOfRecords.window(new Duration(3000));
        // Another derived stream, this time creating batch every two seconds, but containing the data from
        // the parent stream's most recent five batches
        JavaDStream<String> fiveSecondsEveryTwoSeconds = streamOfRecords.window(new Duration(5000), new Duration(2000));
        // Register functions to print the batch sizes in all three of the streams. Notice that:
        // 1) Each stream identifies itself as either [original], [window 3s] or [window 3s slide 2s]
        // 2) The "window duration" is how far back int he parent's stream is included in very batch
        // 3) The "slide duration" is how often a "windowed" batch is produced byt he derived stream (default is the
        // same as the parent's "batch duration")
        // 4) You will see output from the [window 3s] stream every second, but only every two seconds from
        // [window 3s slide 2s] -- and you can check the item counts against the right number of most recent item
        // counts from the [original] stream.
        // 5) Time stamps are included to help you keep track of the batches
        streamOfRecords.foreachRDD((rdd, timeStamp) -> System.out.println("[original] TS: " + timeStamp + " Item count = " + rdd.count()));
        threeSecondsEverySecond.foreachRDD((rdd, timeStamp) -> System.out.println("[window 3s] TS: " + timeStamp + " Item count = " + rdd.count()));
        fiveSecondsEveryTwoSeconds.foreachRDD((rdd, timeStamp) -> System.out.println("[window 5s slide 2s] TS: " + timeStamp + " Item count = " + rdd.count()));
        // start streaming
        System.out.println("*** about to start streaming");
        ssc.start();
        Thread t = new Thread() {

            public void run() {
                try {
                    // A curious fact about files based streaming is that any files written
                    // before the first RDD is produced are ignored. So wait longer than
                    // that before producing files.
                    Thread.sleep(2000);
                    System.out.println("*** producing data");
                    // start producing files
                    fm.makeFiles();
                    // give it time to get processed
                    Thread.sleep(10000);
                } catch (InterruptedException ie) {
                } catch (IOException ioe) {
                    throw new RuntimeException("problem in background thread", ioe);
                }
                ssc.stop();
                System.out.println("*** stopping streaming");
            }
        };
        t.start();

        System.out.println("*** Streaming terminated");
    }
}