Skip to content

Commit 5a41d13

Browse files
committed
Add --update-jar and change semantics of --replace-jar in fbjava-deployer.
1 parent 188d081 commit 5a41d13

File tree

1 file changed

+27
-4
lines changed
  • src/fbjava-impl/src/main/java/org/firebirdsql/fbjava

1 file changed

+27
-4
lines changed

src/fbjava-impl/src/main/java/org/firebirdsql/fbjava/Deployer.java

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
import java.util.jar.JarEntry;
3636
import java.util.jar.JarInputStream;
3737

38-
import org.firebirdsql.fbjava.ExternalResultSet;
39-
4038

4139
public class Deployer
4240
{
@@ -323,6 +321,7 @@ public void doMain(String args[]) throws Exception
323321
boolean installPlugin = false;
324322
boolean uninstallPlugin = false;
325323
String installJar = null;
324+
String updateJar = null;
326325
String replaceJar = null;
327326
String removeJar = null;
328327

@@ -335,6 +334,11 @@ else if (args[i].equals("--install-jar"))
335334
if (more2Args)
336335
installJar = args[i + 1];
337336
}
337+
else if (args[i].equals("--update-jar"))
338+
{
339+
if (more2Args)
340+
updateJar = args[i + 1];
341+
}
338342
else if (args[i].equals("--replace-jar"))
339343
{
340344
if (more2Args)
@@ -359,7 +363,7 @@ else if (args[i].equals("--remove-jar"))
359363
while (result.fetch())
360364
;
361365
}
362-
else if (replaceJar != null)
366+
else if (updateJar != null)
363367
{
364368
doRemoveJar(args[i + 2]);
365369

@@ -370,6 +374,24 @@ else if (replaceJar != null)
370374
while (result.fetch())
371375
;
372376
}
377+
else if (replaceJar != null)
378+
{
379+
try
380+
{
381+
doRemoveJar(args[i + 2]);
382+
}
383+
catch (SQLException e)
384+
{
385+
// Do nothing, let remove fail.
386+
}
387+
388+
String[] className = new String[1];
389+
InstallJarResult result = doVerboseInstallJar(args[i + 1], args[i + 2],
390+
className, false);
391+
392+
while (result.fetch())
393+
;
394+
}
373395

374396
i += 2;
375397
}
@@ -403,7 +425,8 @@ public static void main(String[] args) throws Exception
403425
System.out.println("\t--install-plugin\t\tInstall the plugin on a database");
404426
System.out.println("\t--uninstall-plugin\t\tUninstall the plugin from a database");
405427
System.out.println("\t--install-jar <url> <name>\tInstall a JAR on a database");
406-
System.out.println("\t--replace-jar <url> <name>\tReplaces a JAR on a database");
428+
System.out.println("\t--update-jar <url> <name>\tUpdates an existing JAR on a database");
429+
System.out.println("\t--replace-jar <url> <name>\tReplaces (install or update) a JAR on a database");
407430
System.out.println("\t--remove-jar <name>\t\tRemoves a JAR from the database");
408431
return;
409432
}

0 commit comments

Comments
 (0)