01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.geronimo;
05:
06: public class GeronimoLoaderNaming {
07:
08: public static String adjustName(String name) {
09: if (name != null && name.endsWith("war")) {
10: String[] parts = name.split("/", -1);
11: if (parts.length != 4) {
12: throw new RuntimeException("unknown format: " + name
13: + ", # parts = " + parts.length);
14: }
15:
16: if ("war".equals(parts[3]) && parts[2].matches("^\\d+$")) {
17: name = name.replaceAll(parts[2], "");
18: }
19: }
20:
21: return name;
22: }
23:
24: public static void main(String args[]) {
25: String name = "Geronimo.default/simplesession/1164587457359/war";
26: System.err.println(adjustName(name));
27: }
28:
29: }
|