Skip to content

Commit

Permalink
Improve the "temp-extensions" workaround:
Browse files Browse the repository at this point in the history
- Cleanup code
  • Loading branch information
SgtSilvio committed Nov 7, 2024
1 parent f4cdcc8 commit bede900
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,20 @@ private boolean removePrepackagedExtensions() {
}

@Override
public void copyFileToContainer(final @NotNull MountableFile mountableFile, @NotNull String containerPath) {
if (!isStarted && removePrepackagedExtensions() && containerPath.startsWith("/opt/hivemq/extensions/")) {
containerPath = "/opt/hivemq/temp-extensions/" + containerPath.substring("/opt/hivemq/extensions/".length());
}
super.copyFileToContainer(mountableFile, containerPath);
public void copyFileToContainer(final @NotNull MountableFile mountableFile, final @NotNull String containerPath) {
super.copyFileToContainer(mountableFile, mapContainerPathIfRequired(containerPath));
}

@Override
public void copyFileToContainer(final @NotNull Transferable transferable, @NotNull String containerPath) {
public void copyFileToContainer(final @NotNull Transferable transferable, final @NotNull String containerPath) {
super.copyFileToContainer(transferable, mapContainerPathIfRequired(containerPath));
}

private @NotNull String mapContainerPathIfRequired(final @NotNull String containerPath) {
if (!isStarted && removePrepackagedExtensions() && containerPath.startsWith("/opt/hivemq/extensions/")) {
containerPath = "/opt/hivemq/temp-extensions/" + containerPath.substring("/opt/hivemq/extensions/".length());
return "/opt/hivemq/temp-extensions/" + containerPath.substring("/opt/hivemq/extensions/".length());
}
super.copyFileToContainer(transferable, containerPath);
return containerPath;
}

protected void containerIsStarted(final @NotNull InspectContainerResponse containerInfo) {
Expand Down

0 comments on commit bede900

Please sign in to comment.