| | |
| | | */ |
| | | static private final String GLOBAL_ORDINAL = "global.ordinal"; |
| | | |
| | | /** |
| | | * When true and if the Java Web Start property is set use the class loader of |
| | | * the jar where the MessageDescriptor is contained to retrieve the |
| | | * ResourceBundle. |
| | | */ |
| | | static private final String GLOBAL_USE_MESSAGE_JAR_IF_WEBSTART = |
| | | "global.use.message.jar.if.webstart"; |
| | | |
| | | static private final Set<String> DIRECTIVE_PROPERTIES = new HashSet<String>(); |
| | | static { |
| | |
| | | DIRECTIVE_PROPERTIES.add(GLOBAL_CATEGORY_MASK); |
| | | DIRECTIVE_PROPERTIES.add(GLOBAL_SEVERITY); |
| | | DIRECTIVE_PROPERTIES.add(GLOBAL_ORDINAL); |
| | | DIRECTIVE_PROPERTIES.add(GLOBAL_USE_MESSAGE_JAR_IF_WEBSTART); |
| | | } |
| | | |
| | | static private final String SPECIFIER_REGEX = |
| | |
| | | sb.append(","); |
| | | } |
| | | } |
| | | sb.append(", "); |
| | | } |
| | | sb.append("getClassLoader()"); |
| | | sb.append(");"); |
| | | return sb.toString(); |
| | | } |
| | |
| | | @Override |
| | | public void execute() throws BuildException { |
| | | BufferedReader stubReader = null; |
| | | PrintWriter destWriter = null; |
| | | PrintWriter destWriter = null; |
| | | try { |
| | | |
| | | // Decide whether to generate messages based on modification |
| | |
| | | destWriter = new PrintWriter(new FileOutputStream(dest)); |
| | | |
| | | String stubLine; |
| | | Properties properties = new Properties(); |
| | | properties.load(new FileInputStream(source)); |
| | | while (null != (stubLine = stubReader.readLine())) { |
| | | if (stubLine.contains("${MESSAGES}")) { |
| | | Properties properties = new Properties(); |
| | | properties.load(new FileInputStream(source)); |
| | | |
| | | Integer globalOrdinal = null; |
| | | String go = properties.getProperty(GLOBAL_ORDINAL); |
| | | if (go != null) { |
| | |
| | | } catch (IllegalArgumentException iae) { |
| | | throw new BuildException( |
| | | "ERROR: invalid property key " + propKey + |
| | | ": " + iae.getMessage() + |
| | | ": " + iae.getMessage() + |
| | | KEY_FORM_MSG); |
| | | } |
| | | } |
| | |
| | | dest.getName().substring(0, dest.getName().length() - |
| | | ".java".length())); |
| | | stubLine = stubLine.replace("${BASE}", getBase()); |
| | | |
| | | String useMessageJarIfWebstart = |
| | | properties.getProperty(GLOBAL_USE_MESSAGE_JAR_IF_WEBSTART); |
| | | if ((useMessageJarIfWebstart != null) && |
| | | ("true".equalsIgnoreCase(useMessageJarIfWebstart) || |
| | | "on".equalsIgnoreCase(useMessageJarIfWebstart) || |
| | | "true".equalsIgnoreCase(useMessageJarIfWebstart))) |
| | | { |
| | | useMessageJarIfWebstart = "true"; |
| | | } |
| | | else |
| | | { |
| | | useMessageJarIfWebstart = "false"; |
| | | } |
| | | stubLine = stubLine.replace("${USE_MESSAGE_JAR_IF_WEBSTART}", |
| | | useMessageJarIfWebstart); |
| | | destWriter.println(stubLine); |
| | | } |
| | | } |