Skip to content

Commit 7b000d6

Browse files
committed
2 parents e5f7458 + 2373082 commit 7b000d6

15 files changed

Lines changed: 1790 additions & 1530 deletions

File tree

bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java

Lines changed: 818 additions & 774 deletions
Large diffs are not rendered by default.

bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
******************************************************************************/
99

1010
/******************************************************************************
11-
* Copyright (c) 2018-2022 Payara Foundation
11+
* Copyright (c) 2018-2023 Payara Foundation
1212
* All rights reserved. This program and the accompanying materials
1313
* are made available under the terms of the Eclipse Public License v2.0
1414
* which accompanies this distribution, and is available at
@@ -492,7 +492,8 @@ private void setDebugArgument(ILaunchConfigurationWorkingCopy config, String key
492492
* @return true if ant publisher needs to publish.
493493
*/
494494
private boolean publishNeeded(int kind, int deltaKind, IModule[] module) {
495-
if ((getServer().getServerPublishState() == PUBLISH_CLEAN) || (kind != PUBLISH_INCREMENTAL && kind != PUBLISH_AUTO) || (deltaKind != NO_CHANGE)) {
495+
if ((getServer().getServerPublishState() == PUBLISH_CLEAN)
496+
|| (kind != PUBLISH_INCREMENTAL && kind != PUBLISH_AUTO) || (deltaKind != NO_CHANGE)) {
496497
return true;
497498
}
498499

@@ -531,13 +532,13 @@ private void publishModuleForPayara(int kind, int deltaKind, IModule[] module, I
531532
Properties publishProperties = loadPublishProperties();
532533

533534
boolean isRemote = getPayaraServerDelegate().isRemote();
535+
boolean isDockerInstance = getPayaraServerDelegate().isDockerInstance();
534536
boolean isJarDeploy = getPayaraServerDelegate().getJarDeploy();
535537

536-
if ((!isRemote && !isJarDeploy)) {
538+
if ((!isRemote && !isJarDeploy) || isDockerInstance) {
537539
publishDeployedDirectory(kind, deltaKind, publishProperties, module, monitor);
538540
} else {
539541
publishJarFile(kind, deltaKind, publishProperties, module, monitor);
540-
541542
}
542543

543544
setModulePublishState(module, PUBLISH_STATE_NONE);
@@ -607,13 +608,17 @@ private void publishDeployedDirectory(int kind, int deltaKind, Properties publis
607608
return;
608609
}
609610

610-
IPath path = new Path(getPayaraServerDelegate().getDomainPath() + "/eclipseApps/" + module[0].getName());
611-
612611
// Using PublishHelper to control the temp area to be in the same file system of
613612
// the deployed apps
614613
// so that the move operation Eclipse is doing sometimes can work.
615-
PublishHelper helper = new PublishHelper(
616-
new Path(getPayaraServerDelegate().getDomainPath() + "/eclipseAppsTmp").toFile());
614+
boolean dockerInstance = getPayaraServerDelegate().isDockerInstance();
615+
String hostPath = getPayaraServerDelegate().getHostPath();
616+
String containerPath = getPayaraServerDelegate().getContainerPath();
617+
618+
String parentPath = dockerInstance ? getPayaraServerDelegate().getHostPath()
619+
: getPayaraServerDelegate().getDomainPath();
620+
IPath path = new Path(parentPath + "/eclipseApps/" + module[0].getName());
621+
PublishHelper helper = new PublishHelper(new Path(parentPath + "/eclipseAppsTmp").toFile());
617622

618623
AssembleModules assembler = new AssembleModules(module, path, getPayaraServerDelegate(), helper);
619624
logMessage("Deploy direcotry " + path.toFile().getAbsolutePath());
@@ -675,7 +680,7 @@ private void publishDeployedDirectory(int kind, int deltaKind, Properties publis
675680
CommandTarget command = null;
676681
if (deltaKind == ADDED) {
677682
command = new CommandDeploy(name, null, new File("" + path), contextRoot, properties, new File[0],
678-
hotDeploy);
683+
dockerInstance, hostPath, containerPath, hotDeploy);
679684
} else {
680685
command = new CommandRedeploy(name, null, contextRoot, properties, new File[0], keepSession,
681686
hotDeploy, metadataChanged, sourcesChanged);
@@ -718,6 +723,10 @@ private void publishJarFile(int kind, int deltaKind, Properties p, IModule[] mod
718723
String name = simplifyModuleID(module[0].getName());
719724
String contextRoot = null;
720725

726+
boolean dockerInstance = getPayaraServerDelegate().isDockerInstance();
727+
String hostPath = getPayaraServerDelegate().getHostPath();
728+
String containerPath = getPayaraServerDelegate().getContainerPath();
729+
721730
if (isModuleType(module[0], "jst.web")) {
722731
contextRoot = getContextRoot(module);
723732
}
@@ -727,9 +736,9 @@ private void publishJarFile(int kind, int deltaKind, Properties p, IModule[] mod
727736
boolean hotDeploy = getServer().getAttribute(PayaraServer.ATTR_HOTDEPLOY,
728737
Boolean.parseBoolean(DEFAULT_HOT_DEPLOY));
729738
try {
730-
ServerAdmin
731-
.executeOn(getPayaraServerDelegate()).command(new CommandDeploy(name, null, archivePath,
732-
contextRoot, getDeploymentProperties(), new File[0], hotDeploy))
739+
ServerAdmin.executeOn(getPayaraServerDelegate())
740+
.command(new CommandDeploy(name, null, archivePath, contextRoot, getDeploymentProperties(),
741+
new File[0], dockerInstance, hostPath, containerPath, hotDeploy))
733742
.timeout(520).onNotCompleted(result -> {
734743
logMessage("deploy is failing=" + result.getValue());
735744
throw new IllegalStateException("deploy is failing=" + result.getValue());

bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
******************************************************************************/
99

1010
/******************************************************************************
11-
* Copyright (c) 2018-2022 Payara Foundation
11+
* Copyright (c) 2018-2023 Payara Foundation
1212
* All rights reserved. This program and the accompanying materials
1313
* are made available under the terms of the Eclipse Public License v2.0
1414
* which accompanies this distribution, and is available at
@@ -68,8 +68,8 @@ public class CommandDeploy extends CommandTargetName {
6868
public static ResultString deploy(PayaraServer server, File application, TaskStateListener listener)
6969
throws PayaraIdeException {
7070
try {
71-
return ServerAdmin.<ResultString>exec(server,
72-
new CommandDeploy(null, null, application, null, null, null, false), listener).get();
71+
return ServerAdmin.<ResultString>exec(server, new CommandDeploy(null, null, application, null, null, null,
72+
server.isDockerInstance(), server.getHostPath(), server.getContainerPath(), false), listener).get();
7373
} catch (InterruptedException | ExecutionException | CancellationException ie) {
7474
throw new PayaraIdeException(ERROR_MESSAGE, ie);
7575
}
@@ -97,6 +97,15 @@ public static ResultString deploy(PayaraServer server, File application, TaskSta
9797
/** Hot Deploy. */
9898
final boolean hotDeploy;
9999

100+
/** Docker Instance. */
101+
final boolean dockerInstance;
102+
103+
/** Host Path. */
104+
final String hostPath;
105+
106+
/** Container Path. */
107+
final String containerPath;
108+
100109
////////////////////////////////////////////////////////////////////////////
101110
// Constructors //
102111
////////////////////////////////////////////////////////////////////////////
@@ -105,24 +114,29 @@ public static ResultString deploy(PayaraServer server, File application, TaskSta
105114
* Constructs an instance of GlassFish server deploy command entity.
106115
* <p/>
107116
*
108-
* @param name Name of module/cluster/instance to modify.
109-
* @param target Target GlassFish instance or cluster where
110-
* <code>name</code> is stored.
111-
* @param path File to deploy.
112-
* @param contextRoot Deployed application context root.
113-
* @param properties Deployment properties.
114-
* @param libraries Not used in actual deploy command.
115-
* @param hotDeploy Hot Deploy.
117+
* @param name Name of module/cluster/instance to modify.
118+
* @param target Target GlassFish instance or cluster where
119+
* <code>name</code> is stored.
120+
* @param path File to deploy.
121+
* @param contextRoot Deployed application context root.
122+
* @param properties Deployment properties.
123+
* @param libraries Not used in actual deploy command.
124+
* @param dockerInstance Docker Instance.
125+
* @param hotDeploy Hot Deploy.
116126
*/
117127
public CommandDeploy(String name, String target, File path, String contextRoot, Map<String, String> properties,
118-
File[] libraries, final boolean hotDeploy) {
128+
File[] libraries, final boolean dockerInstance, final String hostPath, final String containerPath,
129+
final boolean hotDeploy) {
119130
super(COMMAND, name, target);
120131

121132
this.path = path;
122133
this.contextRoot = contextRoot;
123134
this.properties = properties;
124135
this.libraries = libraries;
125136
this.dirDeploy = path.isDirectory();
137+
this.dockerInstance = dockerInstance;
138+
this.hostPath = hostPath;
139+
this.containerPath = containerPath;
126140
this.hotDeploy = hotDeploy;
127141
}
128142

0 commit comments

Comments
 (0)