Skip to content

Commit

Permalink
mojohaus#42: installDaemon.sh - add all needed scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sparsick committed Nov 1, 2019
1 parent 65f4654 commit e37f306
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions appassembler-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@
<include>trayMessage.gv</include>
</includes>
</resource>
<resource>
<directory>target/dependency/yajsw-binaries/yajsw-stable-12.14/templates</directory>
<targetPath>org/codehaus/mojo/appassembler/daemon/yajsw/templates</targetPath>
</resource>
<resource>
<directory>target/dependency/yajsw-binaries/yajsw-stable-12.14/bin</directory>
<targetPath>org/codehaus/mojo/appassembler/daemon/yajsw/bin</targetPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public class YetAnotherJavaServiceWrapperDaemonGenerator
add("uninstallDaemon.sh");
add("setenv.sh");
add("wrapper.sh");
add("installDaemonNoPriv.sh");
}
};

Expand All @@ -121,6 +122,13 @@ public class YetAnotherJavaServiceWrapperDaemonGenerator
}
};

private static List<String> TEMPLATES = new ArrayList<String>()
{
{
add("daemon.vm");
}
};

@Override
public void generate( DaemonGenerationRequest request ) throws DaemonGeneratorException
{
Expand Down Expand Up @@ -228,24 +236,30 @@ private void writeScripts(File outputDirectory) throws DaemonGeneratorException
{
for (String batScriptName : BAT_SCRIPTS)
{
String batScriptPath = "bat/"+batScriptName;
String batScriptPath = "bat/" + batScriptName;
InputStream batScript = createInputStream(batScriptPath);
writeFile(new File(outputDirectory, batScriptPath), batScript);
}

for(String shellScriptName : SHELL_SCRIPTS)
{
String shellScriptPath = "bin/"+shellScriptName;
String shellScriptPath = "bin/" + shellScriptName;
InputStream shellScript = createInputStream(shellScriptPath);
writeFile(new File(outputDirectory, shellScriptPath), shellScript);
}

for(String groovyScriptName : GROOVY_SCRIPTS)
{
String groovyScriptPath = "scripts/"+groovyScriptName;
String groovyScriptPath = "scripts/" + groovyScriptName;
InputStream groovyScript = createInputStream(groovyScriptPath);
writeFile(new File(outputDirectory, groovyScriptPath), groovyScript);
}

for(String templateScriptName : TEMPLATES) {
String templateScriptPath = "templates/" + templateScriptName;
InputStream templateScript = createInputStream(templateScriptPath);
writeFile(new File(outputDirectory, templateScriptPath), templateScript);
}
}

private void writeLibraries(File outputDirectory) throws DaemonGeneratorException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void testDefaultYAJSWFilesIfNoGeneratorConfigurationsIsSet()
assertFileExists(yajswDir, "bin/uninstallDaemon.sh");
assertFileExists(yajswDir, "bin/setenv.sh");
assertFileExists(yajswDir, "bin/wrapper.sh");
assertFileExists(yajswDir, "bin/installDaemonNoPriv.sh");
assertFileExists( yajswDir, "wrapper.jar" );
assertFileExists( yajswDir, "wrapperApp.jar" );
assertFileExists( yajswDir, "lib/core/commons/commons-cli-1.4.jar" );
Expand All @@ -76,6 +77,7 @@ public void testDefaultYAJSWFilesIfNoGeneratorConfigurationsIsSet()
assertFileExists( yajswDir, "lib/extended/velocity/velocity-1.7.jar");
assertFileExists( yajswDir, "lib/extended/yajsw/hessian4.jar");
assertFileExists( yajswDir, "scripts/trayMessage.gv");
assertFileExists(yajswDir, "templates/daemon.vm");
}

private String trimWhitespacePerLine(File wrapper) throws IOException {
Expand Down

0 comments on commit e37f306

Please sign in to comment.