423739 Start checks module files.
renamed option to --create-files cleaned up logging and messages removed switch statement.
This commit is contained in:
parent
5380430b75
commit
e5b85055bd
|
@ -3,35 +3,13 @@
|
|||
#
|
||||
|
||||
[files]
|
||||
${switch java.version
|
||||
1.7.0_9: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar
|
||||
1.7.0_10: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar
|
||||
1.7.0_11: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar
|
||||
1.7.0_13: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar:lib/npn/npn-boot-1.1.4.v20130313.jar
|
||||
1.7.0_15: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_17: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_21: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_25: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_40: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
1.7.0_45: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
*: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
}
|
||||
http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
|
||||
[ini-template]
|
||||
# NPN Configuration
|
||||
# NPN boot jar for JRE 1.7.0_45
|
||||
--exec
|
||||
${switch java.version
|
||||
1.7.0_9: -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar
|
||||
1.7.0_10: -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar
|
||||
1.7.0_11: -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar
|
||||
1.7.0_13: -Xbootclasspath/p:lib/npn/npn-boot-1.1.4.v20130313.jar
|
||||
1.7.0_15: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_17: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_21: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_25: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
|
||||
1.7.0_40: -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
1.7.0_45: -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
*: -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
}
|
||||
-Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar
|
||||
|
||||
# For other versions of JRE, an appropriate npn-boot jar must be downloaded
|
||||
#
|
||||
|
|
|
@ -381,7 +381,7 @@ public class Main
|
|||
return;
|
||||
}
|
||||
source = short_start_ini;
|
||||
StartLog.warn("%-15s initialised in %s (appended)",name,source);
|
||||
StartLog.info("%-15s initialised in %s (appended)",name,source);
|
||||
out = new PrintWriter(new FileWriter(start_ini,true));
|
||||
}
|
||||
else
|
||||
|
@ -403,7 +403,7 @@ public class Main
|
|||
return;
|
||||
}
|
||||
source = short_ini;
|
||||
StartLog.warn("%-15s initialised in %s (created)",name,source);
|
||||
StartLog.info("%-15s initialised in %s (created)",name,source);
|
||||
out = new PrintWriter(ini);
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ public class Main
|
|||
{
|
||||
if (!short_ini.equals(source))
|
||||
{
|
||||
StartLog.warn("%-15s enabled in %s",name,baseHome.toShortForm(source));
|
||||
StartLog.info("%-15s enabled in %s",name,baseHome.toShortForm(source));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -673,9 +673,9 @@ public class Main
|
|||
args.setRun(false);
|
||||
String type=arg.location.endsWith("/")?"directory":"file";
|
||||
if (arg.uri==null)
|
||||
StartLog.warn("Required %s '%s' does not exist. Run with --create",type,baseHome.toShortForm(file));
|
||||
StartLog.warn("Required %s '%s' does not exist. Run with --create-files to create",type,baseHome.toShortForm(file));
|
||||
else
|
||||
StartLog.warn("Required %s '%s' not downloaded from %s. Run with --download",type,baseHome.toShortForm(file),arg.uri);
|
||||
StartLog.warn("Required %s '%s' not downloaded from %s. Run with --create-files to download",type,baseHome.toShortForm(file),arg.uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class Module
|
|||
/** List of sources that enabled this module */
|
||||
private final Set<String> sources = new HashSet<>();
|
||||
|
||||
public Module(File file) throws FileNotFoundException, IOException
|
||||
public Module(BaseHome basehome,File file) throws FileNotFoundException, IOException
|
||||
{
|
||||
this.file = file;
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class Module
|
|||
name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst("");
|
||||
|
||||
init();
|
||||
process();
|
||||
process(basehome);
|
||||
}
|
||||
|
||||
public void addChildEdge(Module child)
|
||||
|
@ -245,13 +245,13 @@ public class Module
|
|||
return enabled;
|
||||
}
|
||||
|
||||
public void process() throws FileNotFoundException, IOException
|
||||
public void process(BaseHome basehome) throws FileNotFoundException, IOException
|
||||
{
|
||||
Pattern section = Pattern.compile("\\s*\\[([^]]*)\\]\\s*");
|
||||
|
||||
if (!FS.canReadFile(file))
|
||||
{
|
||||
StartLog.debug("Skipping read of missing file: %s",file.getAbsolutePath());
|
||||
StartLog.debug("Skipping read of missing file: %s",basehome.toShortForm(file));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -261,36 +261,9 @@ public class Module
|
|||
{
|
||||
String line;
|
||||
String sectionType = "";
|
||||
String caseTag = null;
|
||||
boolean switched = false;
|
||||
while ((line = buf.readLine()) != null)
|
||||
{
|
||||
line = line.trim();
|
||||
|
||||
if (caseTag!=null)
|
||||
{
|
||||
if ("}".equals(line))
|
||||
{
|
||||
caseTag=null;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (switched)
|
||||
continue;
|
||||
|
||||
if (!line.startsWith(caseTag) && !line.startsWith("*:"))
|
||||
continue;
|
||||
|
||||
switched=true;
|
||||
line=line.substring(line.indexOf(':')+1).trim();
|
||||
}
|
||||
else if (line.startsWith("${switch "))
|
||||
{
|
||||
switched=false;
|
||||
caseTag=line.substring(9).trim();
|
||||
caseTag=System.getProperty(caseTag)+":";
|
||||
continue;
|
||||
}
|
||||
|
||||
Matcher sectionMatcher = section.matcher(line);
|
||||
|
||||
|
@ -300,7 +273,7 @@ public class Module
|
|||
}
|
||||
else
|
||||
{
|
||||
// blank lines and comments are valid for initialize section
|
||||
// blank lines and comments are valid for initialise section
|
||||
if (line.length() == 0 || line.startsWith("#"))
|
||||
{
|
||||
if ("INI-TEMPLATE".equals(sectionType))
|
||||
|
|
|
@ -309,7 +309,7 @@ public class Modules implements Iterable<Module>
|
|||
{
|
||||
for (File file : basehome.listFiles("modules",new FS.FilenameRegexFilter("^.*\\.mod$")))
|
||||
{
|
||||
register(new Module(file));
|
||||
register(new Module(basehome,file));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ public class StartArgs
|
|||
return;
|
||||
}
|
||||
|
||||
if (arg.equals("--download") || arg.equals("--create"))
|
||||
if (arg.equals("--create-files"))
|
||||
{
|
||||
run=false;
|
||||
download=true;
|
||||
|
|
|
@ -60,7 +60,7 @@ public class StartLog
|
|||
|
||||
public static void info(String format, Object... args)
|
||||
{
|
||||
System.err.printf("WARNING: " + format + "%n",args);
|
||||
System.err.printf("INFO: " + format + "%n",args);
|
||||
}
|
||||
|
||||
public static void warn(String format, Object... args)
|
||||
|
|
|
@ -94,12 +94,9 @@ Module Management:
|
|||
See http://graphviz.org/ for details on how to post-process
|
||||
this file into the output best suited for your needs.
|
||||
|
||||
--download Download or create any missing files/directories that are
|
||||
required by initialised modules.
|
||||
|
||||
--create Download or create any missing files/directories that are
|
||||
required by initialised modules.
|
||||
|
||||
--create-files Create any missing files that are required by initialised
|
||||
modules. This may download a file from the network if the
|
||||
module provides a URL.
|
||||
|
||||
Startup / Shutdown Command Line:
|
||||
--------------------------------
|
||||
|
|
|
@ -34,7 +34,7 @@ public class ModuleTest
|
|||
private Module loadTestHomeModule(String moduleFileName) throws IOException
|
||||
{
|
||||
File file = MavenTestingUtils.getTestResourceFile("usecases/home/modules/" + moduleFileName);
|
||||
return new Module(file);
|
||||
return new Module(new BaseHome(),file);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue