forked from eclipse-ditto/ditto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-ditto#903]: Make schema optional, allow alternate content type
This change allows to make the schema optional and also allows to configure the data content type. Signed-off-by: Jens Reimann <[email protected]>
- Loading branch information
Showing
9 changed files
with
233 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...main/java/org/eclipse/ditto/services/gateway/util/config/endpoints/CloudEventsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (c) 2020 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.services.gateway.util.config.endpoints; | ||
|
||
import java.util.Set; | ||
|
||
import javax.annotation.concurrent.Immutable; | ||
|
||
import org.eclipse.ditto.services.utils.config.KnownConfigValue; | ||
|
||
/** | ||
* Provides configuration settings for the cloud events endpoint of the Ditto Gateway service. | ||
*/ | ||
@Immutable | ||
public interface CloudEventsConfig { | ||
|
||
/** | ||
* Returns if an empty data schema is allowed. | ||
* | ||
* @return {@code true} if an empty data schema is allowed {@code false} otherwise. | ||
*/ | ||
boolean isEmptySchemaAllowed(); | ||
|
||
/** | ||
* Returns the allowed data types. | ||
* | ||
* @return The set of allowed data types. | ||
*/ | ||
Set<String> getDataTypes(); | ||
|
||
/** | ||
* An enumeration of the known config path expressions and their associated default values for | ||
* {@code CloudEventsConfig}. | ||
*/ | ||
enum CloudEventsConfigValue implements KnownConfigValue { | ||
|
||
/** | ||
* Flag if an empty data schema is allowed. | ||
*/ | ||
EMPTY_SCHEMA_ALLOWED("empty-schema-allowed", true), | ||
|
||
/** | ||
* Set of allowed data types | ||
*/ | ||
DATA_TYPES("data-types", Set.of("application/json", "application/vnd.eclipse.ditto+json")); | ||
|
||
private final String path; | ||
private final Object defaultValue; | ||
|
||
private CloudEventsConfigValue(final String thePath, final Object theDefaultValue) { | ||
path = thePath; | ||
defaultValue = theDefaultValue; | ||
} | ||
|
||
@Override | ||
public Object getDefaultValue() { | ||
return defaultValue; | ||
} | ||
|
||
@Override | ||
public String getConfigPath() { | ||
return path; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.