Skip to content

Commit

Permalink
Refactor rest models
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schüth committed Apr 12, 2017
1 parent 6ad81c2 commit f032d62
Show file tree
Hide file tree
Showing 116 changed files with 1,213 additions and 501 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

= Gentics Mesh Changelog

== 0.9.4 (PENDING)
== 0.9.4 (12.04.2017)

icon:check[] UI: The global search was fixed.
icon:check[] JWT: The `signatureSecret` property within the Gentics Mesh configuration has been renamed to `keystorePassword`.

icon:check[] UI: The translation feature was fixed.
icon:plus[] JWT: It is now possible to configure the algorithm which is used to sign the JWT tokens.

icon:plus[] Java: The Java model classes have been updated to provide fluent API's.

icon:plus[] Demo: It is now possible to access elasticsearch head UI directly from mesh via http://localhost:8080/elastichead - The UI will only provided if the elasticsearch http ports are enabled. Only enable this for development since mesh will not protect the Elasticsearch HTTP server.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
*/
public class AuthenticationOptions {

public static final long DEFAULT_TOKEN_EXPIRATION_TIME = 60 * 60; //1 hour
public static final String DEFAULT_ALGORITHM = "HS256";

public static final long DEFAULT_TOKEN_EXPIRATION_TIME = 60 * 60; // 1 hour

public static final String DEFAULT_KEYSTORE_PATH = "keystore.jceks";

public static final String DEFAULT_KEYSTORE_PASSWORD = "secret";

private long tokenExpirationTime = DEFAULT_TOKEN_EXPIRATION_TIME;

private String signatureSecret = "secret";
private String keystorePassword = DEFAULT_KEYSTORE_PASSWORD;

private String keystorePath = DEFAULT_KEYSTORE_PATH;

private String algorithm = DEFAULT_ALGORITHM;

/**
* Gets the time after which an authentication token should expire.
*
Expand All @@ -29,33 +35,38 @@ public long getTokenExpirationTime() {
*
* @param tokenExpirationTime
* The expiration time in seconds
* @return Fluent API
*/
public void setTokenExpirationTime(long tokenExpirationTime) {
public AuthenticationOptions setTokenExpirationTime(long tokenExpirationTime) {
this.tokenExpirationTime = tokenExpirationTime;
return this;
}

/**
* Gets the secret passphrase which is used when singing the authentication token.
* Gets the password which is used to open the java key store.
*
* @return
* @return Keystore password
*/
public String getSignatureSecret() {
return signatureSecret;
public String getKeystorePassword() {
return keystorePassword;
}

/**
* Sets the secret passphrase which is used when singing the authentication token.
* Sets the password which is used to open the java key store.
*
* @param password
* @return Fluent API
*
* @param signatureSecret
*/
public void setSignatureSecret(String signatureSecret) {
this.signatureSecret = signatureSecret;
public AuthenticationOptions setKeystorePassword(String password) {
this.keystorePassword = password;
return this;
}

/**
* Gets the path to the keystore file.
*
* @return
* @return Path to keystore
*/
public String getKeystorePath() {
return keystorePath;
Expand All @@ -65,8 +76,31 @@ public String getKeystorePath() {
* Sets the path to the keystore file.
*
* @param keystorePath
* @return Fluent API
*
*/
public void setKeystorePath(String keystorePath) {
public AuthenticationOptions setKeystorePath(String keystorePath) {
this.keystorePath = keystorePath;
return this;
}

/**
* Return the algorithm which is used to sign the JWT tokens. By default {@value #DEFAULT_ALGORITHM} is used.
*
* @return Configured algorithm
*/
public String getAlgorithm() {
return algorithm;
}

/**
* Set the algorithm which is used to sign the JWT tokens.
*
* @param algorithm
* @return Fluent API
*/
public AuthenticationOptions setAlgorithm(String algorithm) {
this.algorithm = algorithm;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ public boolean isHttpEnabled() {
*
* @param httpEnabled
* Server flag
* @return Fluent API
*/
public void setHttpEnabled(boolean httpEnabled) {
public ElasticSearchOptions setHttpEnabled(boolean httpEnabled) {
this.httpEnabled = httpEnabled;
return this;
}

/**
Expand All @@ -47,9 +49,11 @@ public String getDirectory() {
*
* @param directory
* Path to the search index filesystem directory
* @return Fluent API
*/
public void setDirectory(String directory) {
public ElasticSearchOptions setDirectory(String directory) {
this.directory = directory;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ public String getDirectory() {
*
* @param directory
* Graph storage filesystem directory
* @return Fluent API
*/
public void setDirectory(String directory) {
public GraphStorageOptions setDirectory(String directory) {
this.directory = directory;
return this;
}

/**
Expand All @@ -54,9 +56,11 @@ public Map<String, String> getParameters() {
*
* @param key
* @param value
* @return Fluent API
*/
public void setParameter(String key, String value) {
public GraphStorageOptions setParameter(String key, String value) {
this.parameters.put(key, value);
return this;
}

/**
Expand All @@ -73,9 +77,11 @@ public String getBackupDirectory() {
*
* @param backupDirectory
* Backup directory
* @return Fluent API
*/
public void setBackupDirectory(String backupDirectory) {
public GraphStorageOptions setBackupDirectory(String backupDirectory) {
this.backupDirectory = backupDirectory;
return this;
}

/**
Expand All @@ -92,9 +98,11 @@ public String getExportDirectory() {
*
* @param exportDirectory
* Export directory
* @return Fluent API
*/
public void setExportDirectory(String exportDirectory) {
public GraphStorageOptions setExportDirectory(String exportDirectory) {
this.exportDirectory = exportDirectory;
return this;
}

/**
Expand All @@ -110,8 +118,10 @@ public Boolean getStartServer() {
* Set the start server flag.
*
* @param startServer
* @return Fluent API
*/
public void setStartServer(Boolean startServer) {
public GraphStorageOptions setStartServer(Boolean startServer) {
this.startServer = startServer;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class HttpServerConfig {
public static final String DEFAULT_CORS_ALLOWED_ORIGIN_PATTERN = "";

public static final String HTTP_PORT_KEY = "httpPort";

public static final int DEFAULT_HTTP_PORT = 8080;

private int port = DEFAULT_HTTP_PORT;
Expand All @@ -35,9 +36,11 @@ public int getPort() {
*
* @param port
* Http server port
* @return Fluent API
*/
public void setPort(int port) {
public HttpServerConfig setPort(int port) {
this.port = port;
return this;
}

/**
Expand All @@ -50,13 +53,15 @@ public Boolean getEnableCors() {
}

/**
* Set the flag which will enable cors.
* Set the flag which will enable CORS.
*
* @param enableCors
* CORS enabled flag
* @return Fluent API
*/
public void setEnableCors(Boolean enableCors) {
public HttpServerConfig setEnableCors(Boolean enableCors) {
this.enableCors = enableCors;
return this;
}

/**
Expand All @@ -83,9 +88,11 @@ public String getCorsAllowedOriginPattern() {
*
* @param corsAllowedOriginPattern
* CORS allowed pattern
* @return Fluent API
*/
public void setCorsAllowedOriginPattern(String corsAllowedOriginPattern) {
public HttpServerConfig setCorsAllowedOriginPattern(String corsAllowedOriginPattern) {
this.corsAllowedOriginPattern = corsAllowedOriginPattern;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ public String getImageCacheDirectory() {
* Set the binary image cache directory.
*
* @param imageCacheDirectory
* @return Fluent API
*/
public void setImageCacheDirectory(String imageCacheDirectory) {
public ImageManipulatorOptions setImageCacheDirectory(String imageCacheDirectory) {
this.imageCacheDirectory = imageCacheDirectory;
return this;
}

/**
Expand All @@ -43,9 +45,11 @@ public Integer getMaxHeight() {
* Set the maximum image height.
*
* @param maxHeight
* @return Fluent API
*/
public void setMaxHeight(int maxHeight) {
public ImageManipulatorOptions setMaxHeight(int maxHeight) {
this.maxHeight = maxHeight;
return this;
}

/**
Expand All @@ -61,8 +65,10 @@ public Integer getMaxWidth() {
* Set the maximum allowed image width.
*
* @param maxWidth
* @return Fluent API
*/
public void setMaxWidth(int maxWidth) {
public ImageManipulatorOptions setMaxWidth(int maxWidth) {
this.maxWidth = maxWidth;
return this;
}
}
26 changes: 19 additions & 7 deletions api/src/main/java/com/gentics/mesh/etc/config/MeshOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ public boolean isClusterMode() {
*
* @param clusterMode
* Flag value
* @return Fluent API
*/
public void setClusterMode(boolean clusterMode) {
public MeshOptions setClusterMode(boolean clusterMode) {
this.clusterMode = clusterMode;
return this;
}

/**
Expand All @@ -82,9 +84,11 @@ public int getDefaultMaxDepth() {
* Set the default max depth for navigations.
*
* @param defaultMaxDepth
* @return Fluent API
*/
public void setDefaultMaxDepth(int defaultMaxDepth) {
public MeshOptions setDefaultMaxDepth(int defaultMaxDepth) {
this.defaultMaxDepth = defaultMaxDepth;
return this;
}

/**
Expand Down Expand Up @@ -152,9 +156,11 @@ public ElasticSearchOptions getSearchOptions() {
*
* @param searchOptions
* Search options
* @return Fluent API
*/
public void setSearchOptions(ElasticSearchOptions searchOptions) {
public MeshOptions setSearchOptions(ElasticSearchOptions searchOptions) {
this.searchOptions = searchOptions;
return this;
}

/**
Expand All @@ -172,9 +178,11 @@ public AuthenticationOptions getAuthenticationOptions() {
*
* @param authenticationOptions
* Authentication options
* @return Fluent API
*/
public void setAuthenticationOptions(AuthenticationOptions authenticationOptions) {
public MeshOptions setAuthenticationOptions(AuthenticationOptions authenticationOptions) {
this.authenticationOptions = authenticationOptions;
return this;
}

/**
Expand Down Expand Up @@ -210,9 +218,11 @@ public ImageManipulatorOptions getImageOptions() {
* Set the image manipulation options.
*
* @param imageOptions
* @return Fluent API
*/
public void setImageOptions(ImageManipulatorOptions imageOptions) {
public MeshOptions setImageOptions(ImageManipulatorOptions imageOptions) {
this.imageOptions = imageOptions;
return this;
}

/**
Expand All @@ -229,9 +239,11 @@ public boolean isUpdateCheckEnabled() {
* Set the update checker flag. If set to true a update check will be invoked during mesh server startup.
*
* @param updateCheck
* @return Fluent API
*/
public void setUpdateCheck(boolean updateCheck) {
public MeshOptions setUpdateCheck(boolean updateCheck) {
this.updateCheck = updateCheck;
return this;
}

}
}
Loading

0 comments on commit f032d62

Please sign in to comment.