-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3eb319
commit 0e93c60
Showing
7 changed files
with
140 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...iner.service/src/com/ibm/ws/container/service/config/internal/WebFragmentInfoAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 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.container.service.config.internal; | ||
|
||
import org.osgi.service.component.annotations.Component; | ||
|
||
import com.ibm.ws.container.service.config.WebFragmentInfo; | ||
import com.ibm.ws.javaee.dd.web.WebFragment; | ||
import com.ibm.wsspi.adaptable.module.Container; | ||
import com.ibm.wsspi.adaptable.module.Entry; | ||
import com.ibm.wsspi.adaptable.module.UnableToAdaptException; | ||
import com.ibm.wsspi.adaptable.module.adapters.ContainerAdapter; | ||
import com.ibm.wsspi.artifact.ArtifactContainer; | ||
import com.ibm.wsspi.artifact.overlay.OverlayContainer; | ||
|
||
@Component | ||
public class WebFragmentInfoAdapter implements ContainerAdapter<WebFragmentInfo> { | ||
|
||
@Override | ||
public WebFragmentInfo adapt(Container root, OverlayContainer rootOverlay, ArtifactContainer artifactContainer, Container containerToAdapt) throws UnableToAdaptException { | ||
WebFragment fragmment = containerToAdapt.adapt(WebFragment.class); | ||
String path = getPath(containerToAdapt); | ||
WebFragmentsInfoImpl.WebFragmentItemImpl nextFragmentInfo = new WebFragmentsInfoImpl.WebFragmentItemImpl(containerToAdapt, fragmment, path, path, false); | ||
return nextFragmentInfo; | ||
} | ||
|
||
public static String getPath(Container container) throws UnableToAdaptException { | ||
// if ( tc.isDebugEnabled() ) { | ||
// Tr.debug(tc, "getPath Initial [ " + container + " ]"); | ||
// } | ||
StringBuilder pathBuilder = new StringBuilder(); | ||
|
||
Entry entry; | ||
while ((entry = container.adapt(Entry.class)) != null) { // throws UnableToAdaptException | ||
pathBuilder.insert(0, entry.getPath()); | ||
container = entry.getRoot(); | ||
// if ( tc.isDebugEnabled() ) { | ||
// Tr.debug(tc, "getPath Next [ " + container + " ]"); | ||
// } | ||
} | ||
|
||
return pathBuilder.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters