KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > geronimo > GeronimoLoaderNaming


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.geronimo;
5
6 public class GeronimoLoaderNaming {
7
8   public static String JavaDoc adjustName(String JavaDoc name) {
9     if (name != null && name.endsWith("war")) {
10       String JavaDoc[] parts = name.split("/", -1);
11       if (parts.length != 4) { throw new RuntimeException JavaDoc("unknown format: " + name + ", # parts = " + parts.length); }
12
13       if ("war".equals(parts[3]) && parts[2].matches("^\\d+$")) {
14         name = name.replaceAll(parts[2], "");
15       }
16     }
17
18     return name;
19   }
20
21   public static void main(String JavaDoc args[]) {
22     String JavaDoc name = "Geronimo.default/simplesession/1164587457359/war";
23     System.err.println(adjustName(name));
24   }
25
26 }
27
Popular Tags