Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/server-am/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,13 @@
<_initParams>
<org.eclipse.jetty.servlet.Default.useFileMappedBuffer>false</org.eclipse.jetty.servlet.Default.useFileMappedBuffer>
</_initParams>

</webApp>
<httpConnector>
<port>${servlet.port}</port>
</httpConnector>
<scan>5</scan>

</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -394,6 +396,7 @@
<targetPath>/swagger-ui/dist</targetPath>
</resource>
</webResources>

</configuration>
</plugin>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
// End of user code

/**
* Generated by Lyo Designer 7.0.0.qualifier
* Generated by Lyo Designer 7.0.0-SNAPSHOT
*/

@OpenAPIDefinition(info = @Info(title = "AM", version = "1.0.0"), servers = @Server(url = "/services/"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -137,6 +140,7 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
* <ol>
* <li>LYO_SCHEME env variable</li>
* <li>%pkg_name%.scheme JVM property, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* <li>LYO_SCHEME JNDI env entry</li>
* <li>%pkg_name%.scheme Servlet Context parameter, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* </ol>
* @param key property key name
Expand All @@ -147,8 +151,9 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
public static String getConfigurationProperty(String key, String defaultValue, final ServletContext servletContext, Class klass) {
String value = getConfigurationPropertyFromEnvironment(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromSystemProperties(generateFullyQualifiedKey(klass, key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue)));
.orElseGet(() -> getConfigurationPropertyFromJndi(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue))));
return value;
}

Expand All @@ -166,6 +171,22 @@ private static String generateEnvironmentKey(String key) {
return "LYO_" + key.toUpperCase(Locale.ROOT).replace('.', '_');
}

private static Optional<String> getConfigurationPropertyFromJndi(String key) {
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Object value = envCtx.lookup(key);
if (value != null) {
logger.info("Found JNDI env entry with key {}", key);
return Optional.of(value.toString());
}
} catch (NamingException e) {
// JNDI lookup failed - normal if not running in a container or property not defined
logger.debug("JNDI lookup failed for key '{}': {}", key, e.getMessage());
}
return Optional.empty();
}

private static Optional<String> getConfigurationPropertyFromEnvironment(String basePathEnvKey) {
final Map<String, String> env = System.getenv();
if (!env.containsKey(basePathEnvKey)) {
Expand Down
3 changes: 3 additions & 0 deletions src/server-cm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,13 @@
<_initParams>
<org.eclipse.jetty.servlet.Default.useFileMappedBuffer>false</org.eclipse.jetty.servlet.Default.useFileMappedBuffer>
</_initParams>

</webApp>
<httpConnector>
<port>${servlet.port}</port>
</httpConnector>
<scan>5</scan>

</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -397,6 +399,7 @@
<targetPath>/swagger-ui/dist</targetPath>
</resource>
</webResources>

</configuration>
</plugin>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
// End of user code

/**
* Generated by Lyo Designer 7.0.0.qualifier
* Generated by Lyo Designer 7.0.0-SNAPSHOT
*/

@OpenAPIDefinition(info = @Info(title = "CM", version = "1.0.0"), servers = @Server(url = "/services/"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -137,6 +140,7 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
* <ol>
* <li>LYO_SCHEME env variable</li>
* <li>%pkg_name%.scheme JVM property, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* <li>LYO_SCHEME JNDI env entry</li>
* <li>%pkg_name%.scheme Servlet Context parameter, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* </ol>
* @param key property key name
Expand All @@ -147,8 +151,9 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
public static String getConfigurationProperty(String key, String defaultValue, final ServletContext servletContext, Class klass) {
String value = getConfigurationPropertyFromEnvironment(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromSystemProperties(generateFullyQualifiedKey(klass, key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue)));
.orElseGet(() -> getConfigurationPropertyFromJndi(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue))));
return value;
}

Expand All @@ -166,6 +171,22 @@ private static String generateEnvironmentKey(String key) {
return "LYO_" + key.toUpperCase(Locale.ROOT).replace('.', '_');
}

private static Optional<String> getConfigurationPropertyFromJndi(String key) {
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Object value = envCtx.lookup(key);
if (value != null) {
logger.info("Found JNDI env entry with key {}", key);
return Optional.of(value.toString());
}
} catch (NamingException e) {
// JNDI lookup failed - normal if not running in a container or property not defined
logger.debug("JNDI lookup failed for key '{}': {}", key, e.getMessage());
}
return Optional.empty();
}

private static Optional<String> getConfigurationPropertyFromEnvironment(String basePathEnvKey) {
final Map<String, String> env = System.getenv();
if (!env.containsKey(basePathEnvKey)) {
Expand Down
3 changes: 3 additions & 0 deletions src/server-qm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@
<_initParams>
<org.eclipse.jetty.servlet.Default.useFileMappedBuffer>false</org.eclipse.jetty.servlet.Default.useFileMappedBuffer>
</_initParams>

</webApp>
<httpConnector>
<port>${servlet.port}</port>
</httpConnector>
<scan>5</scan>

</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -393,6 +395,7 @@
<targetPath>/swagger-ui/dist</targetPath>
</resource>
</webResources>

</configuration>
</plugin>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
// End of user code

/**
* Generated by Lyo Designer 7.0.0.qualifier
* Generated by Lyo Designer 7.0.0-SNAPSHOT
*/

@OpenAPIDefinition(info = @Info(title = "QM", version = "1.0.0"), servers = @Server(url = "/services/"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -137,6 +140,7 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
* <ol>
* <li>LYO_SCHEME env variable</li>
* <li>%pkg_name%.scheme JVM property, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* <li>LYO_SCHEME JNDI env entry</li>
* <li>%pkg_name%.scheme Servlet Context parameter, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* </ol>
* @param key property key name
Expand All @@ -147,8 +151,9 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
public static String getConfigurationProperty(String key, String defaultValue, final ServletContext servletContext, Class klass) {
String value = getConfigurationPropertyFromEnvironment(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromSystemProperties(generateFullyQualifiedKey(klass, key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue)));
.orElseGet(() -> getConfigurationPropertyFromJndi(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue))));
return value;
}

Expand All @@ -166,6 +171,22 @@ private static String generateEnvironmentKey(String key) {
return "LYO_" + key.toUpperCase(Locale.ROOT).replace('.', '_');
}

private static Optional<String> getConfigurationPropertyFromJndi(String key) {
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Object value = envCtx.lookup(key);
if (value != null) {
logger.info("Found JNDI env entry with key {}", key);
return Optional.of(value.toString());
}
} catch (NamingException e) {
// JNDI lookup failed - normal if not running in a container or property not defined
logger.debug("JNDI lookup failed for key '{}': {}", key, e.getMessage());
}
return Optional.empty();
}

private static Optional<String> getConfigurationPropertyFromEnvironment(String basePathEnvKey) {
final Map<String, String> env = System.getenv();
if (!env.containsKey(basePathEnvKey)) {
Expand Down
3 changes: 3 additions & 0 deletions src/server-rm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,13 @@
<_initParams>
<org.eclipse.jetty.servlet.Default.useFileMappedBuffer>false</org.eclipse.jetty.servlet.Default.useFileMappedBuffer>
</_initParams>

</webApp>
<httpConnector>
<port>${servlet.port}</port>
</httpConnector>
<scan>5</scan>

</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -424,6 +426,7 @@
<targetPath>/swagger-ui/dist</targetPath>
</resource>
</webResources>

</configuration>
</plugin>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
// End of user code

/**
* Generated by Lyo Designer 7.0.0.202511270506
* Generated by Lyo Designer 7.0.0-SNAPSHOT
*/

@OpenAPIDefinition(info = @Info(title = "RM", version = "1.0.0"), servers = @Server(url = "/services/"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

import java.net.URI;
import java.util.ArrayList;

import org.eclipse.lyo.oslc4j.trs.server.InmemPagedTrs;
import org.eclipse.lyo.oslc4j.trs.server.PagedTrs;
import org.eclipse.lyo.oslc4j.trs.server.PagedTrsFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -140,6 +143,7 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
* <ol>
* <li>LYO_SCHEME env variable</li>
* <li>%pkg_name%.scheme JVM property, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* <li>LYO_SCHEME JNDI env entry</li>
* <li>%pkg_name%.scheme Servlet Context parameter, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme</li>
* </ol>
* @param key property key name
Expand All @@ -150,8 +154,9 @@ private static Optional<String> getBasePathFromSystemProperties(String basePathC
public static String getConfigurationProperty(String key, String defaultValue, final ServletContext servletContext, Class klass) {
String value = getConfigurationPropertyFromEnvironment(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromSystemProperties(generateFullyQualifiedKey(klass, key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue)));
.orElseGet(() -> getConfigurationPropertyFromJndi(generateEnvironmentKey(key))
.orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key))
.orElse(defaultValue))));
return value;
}

Expand All @@ -169,6 +174,22 @@ private static String generateEnvironmentKey(String key) {
return "LYO_" + key.toUpperCase(Locale.ROOT).replace('.', '_');
}

private static Optional<String> getConfigurationPropertyFromJndi(String key) {
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Object value = envCtx.lookup(key);
if (value != null) {
logger.info("Found JNDI env entry with key {}", key);
return Optional.of(value.toString());
}
} catch (NamingException e) {
// JNDI lookup failed - normal if not running in a container or property not defined
logger.debug("JNDI lookup failed for key '{}': {}", key, e.getMessage());
}
return Optional.empty();
}

private static Optional<String> getConfigurationPropertyFromEnvironment(String basePathEnvKey) {
final Map<String, String> env = System.getenv();
if (!env.containsKey(basePathEnvKey)) {
Expand Down
Loading