Skip to content

Commit

Permalink
Add internal configuration for legacy EAR classpath behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwatson committed Aug 13, 2024
1 parent 653475d commit fd968d1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
5 changes: 3 additions & 2 deletions dev/com.ibm.ws.classloading.configuration/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ Import-Package: \

-buildpath: \
com.ibm.websphere.org.osgi.service.component,\
com.ibm.wsspi.org.osgi.service.component.annotations, \
com.ibm.ws.org.osgi.annotation.versioning;version=latest
com.ibm.wsspi.org.osgi.service.component.annotations,\
com.ibm.ws.org.osgi.annotation.versioning;version=latest,\
com.ibm.ws.kernel.boot.core
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@
id="useJarUrls"
required="false"
default="false"
type="Boolean"
/>
type="Boolean"
/>
<AD name="internal" description="internal use only"
id="useLegacyEARClassPath"
required="false"
default="false"
type="Boolean"
/>
</OCD>

<Designate pid="com.ibm.ws.classloading.global">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand All @@ -21,11 +21,13 @@
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Modified;

import com.ibm.ws.kernel.productinfo.ProductInfo;

@Component(service = GlobalClassloadingConfiguration.class, immediate = true, configurationPolicy = ConfigurationPolicy.REQUIRE,
configurationPid = "com.ibm.ws.classloading.global", property = "service.vendor=IBM")
public class GlobalClassloadingConfiguration {

private Map<String, Object> properties;
private volatile Map<String, Object> properties;

@Activate
protected void activate(ComponentContext cCtx, Map<String, Object> properties) {
Expand All @@ -47,7 +49,15 @@ protected void modified(ComponentContext ctx, Map<String, Object> props) {
* @return
*/
public boolean useJarUrls() {
return properties == null || (Boolean) properties.get("useJarUrls");
return getBooleanProperty("useJarUrls", true);
}

public boolean useLegacyEARClassPath() {
return ProductInfo.getBetaEdition() && getBooleanProperty("useLegacyEARClassPath", false);
}

private boolean getBooleanProperty(String key, boolean nullPropsValue) {
Map<String, Object> current = properties;
return current == null ? nullPropsValue : (Boolean) current.get(key);
}
}

0 comments on commit fd968d1

Please sign in to comment.