Skip to content

Commit

Permalink
fix: put an ApplicationPrereq in jndi.iiop
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-chacko committed Oct 28, 2024
1 parent fdddef0 commit 9faf5ea
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 13 deletions.
9 changes: 6 additions & 3 deletions dev/com.ibm.ws.jndi.iiop/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#*******************************************************************************
# Copyright (c) 2017,2021 IBM Corporation and others.
# Copyright (c) 2017,2024 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# 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,7 +21,7 @@ Bundle-Description: This bundle provides a way to access CosNaming via JNDI; ver
WS-TraceGroup: Naming

# For each exported package, create (in that package) a package-info.java
# file, and place an @version javadoc tag in package-level javadoc.
# file, and place an @version javadoc tag in package-level javadoc.
# Append ";provide:=true" if this bundle also provides an implementation
# for the exported API.

Expand All @@ -33,6 +33,9 @@ Import-Package: \
javax.rmi.*;version="[2.4,3.0)", \
*

Include-Resource: OSGI-INF=resources/OSGI-INF
IBM-Default-Config: OSGI-INF/wlp/defaultInstances.xml

-dsannotations-inherit: true
-dsannotations: com.ibm.ws.jndi.iiop.*UrlContextFactory

Expand Down
29 changes: 29 additions & 0 deletions dev/com.ibm.ws.jndi.iiop/resources/OSGI-INF/metatype/metatype.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
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:
IBM Corporation - initial API and implementation
-->
<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0"
xmlns:ibm="http://www.ibm.com/xmlns/appservers/osgi/metatype/v1.0.0"
xmlns:ibmui="http://www.ibm.com/xmlns/appservers/osgi/metatype/ui/v1.0.0"
localization="OSGI-INF/l10n/metatype">

<Designate pid="com.ibm.ws.jndi.iiop.CorbanameUrlContextFactory">
<Object ocdref="com.ibm.ws.jndi.iiop.CorbanameUrlContextFactory" />
</Designate>

<OCD id="com.ibm.ws.jndi.iiop.CorbanameUrlContextFactory" name="internal" description="internal use only"
ibm:objectClass="com.ibm.wsspi.application.lifecycle.ApplicationPrereq">
<AD id="id" name="internal" description="internal use only" type="String" required="true" />
</OCD>


</metatype:MetaData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
Copyright (c) 2024 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
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:
IBM Corporation - initial API and implementation
-->
<server>
<com.ibm.ws.jndi.iiop.CorbanameUrlContextFactory id="CorbanameUrlContextFactory" />
</server>
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
/*******************************************************************************
* Copyright (c) 2017 IBM Corporation and others.
* Copyright (c) 2017,2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.jndi.iiop;

import static org.osgi.service.component.annotations.ConfigurationPolicy.IGNORE;
import static org.osgi.service.component.annotations.ConfigurationPolicy.REQUIRE;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.BitSet;
import java.util.regex.Matcher;
Expand All @@ -26,10 +25,18 @@

import com.ibm.websphere.ras.Tr;
import com.ibm.websphere.ras.TraceComponent;
import com.ibm.wsspi.application.lifecycle.ApplicationPrereq;
import com.ibm.wsspi.application.lifecycle.ApplicationRecycleComponent;

@Component(configurationPolicy=IGNORE,property={"service.vendor=ibm","osgi.jndi.url.scheme=corbaname"})
public class CorbanameUrlContextFactory extends UrlContextFactory implements ObjectFactory, ApplicationRecycleComponent {
/**
* One of the context factories should be an {@link ApplicationPrereq}
* to represent this bundle being up and running.
* This (the most commonly used one) was chosen.
*/


@Component(configurationPolicy=REQUIRE,property={"service.vendor=ibm","osgi.jndi.url.scheme=corbaname"})
public class CorbanameUrlContextFactory extends UrlContextFactory implements ObjectFactory, ApplicationRecycleComponent, ApplicationPrereq {
static class Escaper{
static final TraceComponent tc = Tr.register(CorbanameUrlContextFactory.Escaper.class);
private static final Pattern PERCENT_TRIPLET = Pattern.compile("%(?:[0-9a-f]{2}|[0-9A-F]{2})");
Expand Down Expand Up @@ -88,7 +95,7 @@ public static String escapeCorbanameUrlIfNecessary(String url) {
// escape dots
n = n.replaceAll("\\.", "\\\\.");

//
//
sn.append(n).append("/");
}

Expand Down Expand Up @@ -118,8 +125,8 @@ public static String escapeCorbanameUrlIfNecessary(String url) {
return escaped.toString();
}


}


}

0 comments on commit 9faf5ea

Please sign in to comment.