This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/master by this push:
new 2c49a07 [KARAF-5342] No reference to branding-ssh.properties in
console branding section
2c49a07 is described below
commit 2c49a07201c9b612f24a866db9540935d2d34663
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Feb 5 19:54:48 2018 +0100
[KARAF-5342] No reference to branding-ssh.properties in console branding
section
---
.../src/main/asciidoc/developer-guide/branding.adoc | 10 +++++++++-
.../apache/karaf/shell/impl/console/Branding.java | 21 +++++++++++++++++----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/manual/src/main/asciidoc/developer-guide/branding.adoc
b/manual/src/main/asciidoc/developer-guide/branding.adoc
index 2abf408..6a0873b 100644
--- a/manual/src/main/asciidoc/developer-guide/branding.adoc
+++ b/manual/src/main/asciidoc/developer-guide/branding.adoc
@@ -51,10 +51,18 @@ prompt = \u001B[1m${USER}@${APPLICATION}\u001B[0m>
Start Karaf and you will see your branded Karaf console.
+=== Adding a branding-ssh.properties file to etc
+
+In a similar way, a `etc/branding-ssh.properties` file can be added. It should
contain the same
+`welcome` and `prompt` entries but those will be used for external clients
connecting through ssh.
+The values default to the ones in `etc/branding.properties` if this file is
not defined.
+
+
+
==== Branding bundle
At startup, Apache Karaf is looking for a bundle which exports the
`org.apache.karaf.branding` package, containing
-a `branding.properties` file.
+a `branding.properties` and/or `branding-ssh.properties` file.
Basically, a branding bundle is a very simple bundle, just containing a
`org/apache/karaf/branding/branding.properties`
file.
diff --git
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/Branding.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/Branding.java
index 775c5ea..8ecf541 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/Branding.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/Branding.java
@@ -32,13 +32,19 @@ public final class Branding {
public static Properties loadBrandingProperties(boolean ssh) {
Properties props = new Properties();
- String name = ssh ? "branding-ssh.properties" : "branding.properties";
- loadPropsFromResource(props, "org/apache/karaf/shell/console/" + name);
- loadPropsFromResource(props, "org/apache/karaf/branding/" + name);
- loadPropsFromFile(props, System.getProperty("karaf.etc") + "/" + name);
+ loadPropsFromResource(props, "org/apache/karaf/shell/console/", ssh);
+ loadPropsFromResource(props, "org/apache/karaf/branding/", ssh);
+ loadPropsFromFile(props, System.getProperty("karaf.etc") + "/", ssh);
return props;
}
+ private static void loadPropsFromFile(Properties props, String fileName,
boolean ssh) {
+ loadPropsFromFile(props, fileName + "branding.properties");
+ if (ssh) {
+ loadPropsFromFile(props, fileName + "branding-ssh.properties");
+ }
+ }
+
private static void loadPropsFromFile(Properties props, String fileName) {
try (FileInputStream is = new FileInputStream(fileName)) {
loadProps(props, is);
@@ -47,6 +53,13 @@ public final class Branding {
}
}
+ private static void loadPropsFromResource(Properties props, String
resource, boolean ssh) {
+ loadPropsFromResource(props, resource + "branding.properties");
+ if (ssh) {
+ loadPropsFromResource(props, resource + "branding-ssh.properties");
+ }
+ }
+
private static void loadPropsFromResource(Properties props, String
resource) {
try (InputStream is =
Branding.class.getClassLoader().getResourceAsStream(resource)) {
loadProps(props, is);
--
To stop receiving notification emails like this one, please contact
[email protected].