Skip to content

Commit aa6ed60

Browse files
authored
Merge pull request #20 from aloubyansky/upgrade-wfcore-5
upgrade to wildfly-core-5.0.0.Final
2 parents b9fb462 + 8ce892d commit aa6ed60

File tree

6 files changed

+71
-26
lines changed

6 files changed

+71
-26
lines changed

patch-gen/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
<dependencies>
2020
<dependency>
21-
<groupId>org.wildfly.core</groupId>
22-
<artifactId>wildfly-patching</artifactId>
21+
<groupId>org.wildfly.core</groupId>
22+
<artifactId>wildfly-patching</artifactId>
2323
</dependency>
2424
<dependency>
2525
<groupId>junit</groupId>

patch-gen/src/main/java/org/jboss/as/patching/generator/PatchBundleGenerator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.jboss.as.patching.IoUtils;
4444
import org.jboss.as.patching.PatchingException;
4545
import org.jboss.as.patching.ZipUtils;
46-
import org.jboss.as.patching.logging.PatchLogger;
4746
import org.jboss.as.patching.metadata.BundledPatch;
4847
import org.jboss.as.patching.metadata.Patch;
4948
import org.jboss.as.patching.metadata.PatchBundleXml;
@@ -79,12 +78,12 @@ public static void assemble(final String... args) throws Exception {
7978
} else if (arg.equals("--assemble-patch-bundle")) {
8079
continue;
8180
} else {
82-
System.err.println(PatchLogger.ROOT_LOGGER.argumentExpected(arg));
81+
System.err.println(PatchGenLogger.argumentExpected(arg));
8382
usage();
8483
return;
8584
}
8685
} catch (IndexOutOfBoundsException e) {
87-
System.err.println(PatchLogger.ROOT_LOGGER.argumentExpected(arg));
86+
System.err.println(PatchGenLogger.argumentExpected(arg));
8887
usage();
8988
return;
9089
}
@@ -98,7 +97,7 @@ public static void assemble(final String... args) throws Exception {
9897
missing.add("--output");
9998
}
10099
if (! missing.isEmpty()) {
101-
System.err.println(PatchLogger.ROOT_LOGGER.missingRequiredArgs(missing));
100+
System.err.println(PatchGenLogger.missingRequiredArgs(missing));
102101
return;
103102
}
104103

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2018 Red Hat, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.jboss.as.patching.generator;
18+
19+
import java.util.Set;
20+
21+
import org.jboss.as.controller.OperationFailedException;
22+
23+
/**
24+
*
25+
* @author Alexey Loubyansky
26+
*/
27+
public class PatchGenLogger {
28+
29+
public static String argumentExpected(String arg) {
30+
return "Argument expected for option " + arg;
31+
}
32+
33+
public static String missingRequiredArgs(Set<String> set) {
34+
return "Missing required argument(s): " + set;
35+
}
36+
37+
public static String fileIsNotADirectory(String arg) {
38+
return "File at path specified by argument " + arg + " is not a directory";
39+
}
40+
41+
public static String fileIsADirectory(String arg) {
42+
return "File at path specified by argument " + arg + " is a directory";
43+
}
44+
45+
public static OperationFailedException patchActive(String patchId) {
46+
return new OperationFailedException("Cannot complete operation. Patch '" + patchId + "' is currently active");
47+
}
48+
}

patch-gen/src/main/java/org/jboss/as/patching/generator/PatchGenerator.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private void process() throws PatchingException, IOException, XMLStreamException
114114
}
115115
}
116116
if (!required.isEmpty()) {
117-
System.err.printf(PatchLogger.ROOT_LOGGER.missingRequiredArgs(required));
117+
System.err.printf(PatchGenLogger.missingRequiredArgs(required));
118118
usage();
119119
return;
120120
}
@@ -235,7 +235,7 @@ private static PatchGenerator parse(String[] args) throws Exception {
235235
usage();
236236
return null;
237237
} else if (!oldFile.isDirectory()) {
238-
System.err.printf(PatchLogger.ROOT_LOGGER.fileIsNotADirectory(arg));
238+
System.err.printf(PatchGenLogger.fileIsNotADirectory(arg));
239239
usage();
240240
return null;
241241
}
@@ -247,7 +247,7 @@ private static PatchGenerator parse(String[] args) throws Exception {
247247
usage();
248248
return null;
249249
} else if (!newFile.isDirectory()) {
250-
System.err.printf(PatchLogger.ROOT_LOGGER.fileIsNotADirectory(arg));
250+
System.err.printf(PatchGenLogger.fileIsNotADirectory(arg));
251251
usage();
252252
return null;
253253
}
@@ -259,15 +259,15 @@ private static PatchGenerator parse(String[] args) throws Exception {
259259
usage();
260260
return null;
261261
} else if (patchConfig.isDirectory()) {
262-
System.err.printf(PatchLogger.ROOT_LOGGER.fileIsADirectory(arg));
262+
System.err.printf(PatchGenLogger.fileIsADirectory(arg));
263263
usage();
264264
return null;
265265
}
266266
} else if (arg.startsWith(OUTPUT_FILE)) {
267267
String val = arg.substring(OUTPUT_FILE.length() + 1);
268268
patchFile = new File(val);
269269
if (patchFile.exists() && patchFile.isDirectory()) {
270-
System.err.printf(PatchLogger.ROOT_LOGGER.fileIsADirectory(arg));
270+
System.err.printf(PatchGenLogger.fileIsADirectory(arg));
271271
usage();
272272
return null;
273273
}
@@ -291,14 +291,14 @@ private static PatchGenerator parse(String[] args) throws Exception {
291291
}
292292
}
293293
} catch (IndexOutOfBoundsException e) {
294-
System.err.printf(PatchLogger.ROOT_LOGGER.argumentExpected(arg));
294+
System.err.printf(PatchGenLogger.argumentExpected(arg));
295295
usage();
296296
return null;
297297
}
298298
}
299299

300300
if (patchConfig == null) {
301-
System.err.printf(PatchLogger.ROOT_LOGGER.missingRequiredArgs(Collections.singleton(PATCH_CONFIG)));
301+
System.err.printf(PatchGenLogger.missingRequiredArgs(Collections.singleton(PATCH_CONFIG)));
302302
usage();
303303
return null;
304304
}

patch-gen/src/main/java/org/jboss/as/patching/generator/TemplateGenerator.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import java.io.Writer;
3131
import java.util.UUID;
3232

33-
import org.jboss.as.patching.logging.PatchLogger;
34-
3533
/**
3634
* Generate a simple template for a give patch type.
3735
*
@@ -48,7 +46,7 @@ class TemplateGenerator {
4846
private static final String ONE_OFF = "--one-off";
4947
private static final String STD_OUT = "--std.out";
5048
private static final String TAB = " ";
51-
49+
5250
static void generate(final String... args) throws IOException {
5351

5452
boolean stdout = false;
@@ -89,12 +87,12 @@ static void generate(final String... args) throws IOException {
8987
} else if (arg.equals(DEFAULT_OPTIONAL_PATHS)) {
9088
defaultOptionalPaths = true;
9189
} else {
92-
System.err.println(PatchLogger.ROOT_LOGGER.argumentExpected(arg));
90+
System.err.println(PatchGenLogger.argumentExpected(arg));
9391
usage();
9492
return;
9593
}
9694
} catch (IndexOutOfBoundsException e) {
97-
System.err.println(PatchLogger.ROOT_LOGGER.argumentExpected(arg));
95+
System.err.println(PatchGenLogger.argumentExpected(arg));
9896
usage();
9997
return;
10098
}
@@ -107,18 +105,18 @@ static void generate(final String... args) throws IOException {
107105

108106
final Writer target;
109107
if (stdout) {
110-
target = new OutputStreamWriter(System.out);
108+
target = new OutputStreamWriter(System.out);
111109
} else {
112110
target = new FileWriter(new File("patch-config-" +patchID + ".xml"));
113111
}
114-
112+
115113
try(BufferedWriter bw = new BufferedWriter(target)) {
116114
bw.write("<?xml version='1.0' encoding='UTF-8'?>");bw.newLine();
117115
elementStart(bw, 0, "patch-config", "xmlns", "urn:jboss:patch-config:1.0");
118116
elementWithContent(bw, 1, "name", patchID);
119117
elementWithContent(bw, 1, "description", "No description available");
120118
elementWithAttrs(bw, 1, oneOff ? "one-off" : "cumulative", "applies-to-version", appliesToVersion);
121-
119+
122120
// Write patch element
123121
elementStart(bw, 1, "element", "patch-id", "layer-base-" + patchID);
124122
elementWithAttrs(bw, 2, oneOff ? "one-off" : "cumulative", "name", "base");
@@ -150,7 +148,7 @@ static void generate(final String... args) throws IOException {
150148
elementWithAttrs(bw, 2, "path", "value", "bin/appclient.*", "requires", "appclient");
151149
elementEnd(bw, 1, "optional-paths");
152150
}
153-
151+
154152
elementEnd(bw, 0, "patch-config");
155153
}
156154
}
@@ -201,7 +199,7 @@ private static void writeStart(BufferedWriter writer, int offset, String name, b
201199
}
202200
writer.write('<');
203201
writer.write(name);
204-
202+
205203
if(attrs != null && attrs.length > 0) {
206204
int i = 0;
207205
while(i < attrs.length) {
@@ -223,7 +221,7 @@ private static void writeStart(BufferedWriter writer, int offset, String name, b
223221
writer.write('>');
224222
}
225223
}
226-
224+
227225
static void usage() {
228226
System.err.println("USAGE:");
229227
System.err.println("patch-gen.sh --create-template --one-off [patch-id] [" + DEFAULT_OPTIONAL_PATHS + "]");

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
For example: <version.org.jboss.as.console>
4242
-->
4343

44-
<version.org.wildfly-core>3.0.0.Alpha19</version.org.wildfly-core>
44+
<version.org.wildfly-core>5.0.0.Final</version.org.wildfly-core>
4545
<version.org.apache.maven.shared.maven-shared-utils>3.1.0</version.org.apache.maven.shared.maven-shared-utils>
4646
<version.org.apache.maven.plugin-tools.maven-plugin-annotations>3.2</version.org.apache.maven.plugin-tools.maven-plugin-annotations>
4747
<version.org.apache.maven.maven-plugin-api>2.0</version.org.apache.maven.maven-plugin-api>
@@ -106,7 +106,7 @@
106106
<plugin>
107107
<groupId>org.apache.maven.plugins</groupId>
108108
<artifactId>maven-plugin-plugin</artifactId>
109-
<version>3.3</version>
109+
<version>3.5.2</version>
110110
</plugin>
111111
<plugin>
112112
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)