01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * The contents of this file are subject to the terms of the Common
07: * Development and Distribution License ("CDDL")(the "License"). You
08: * may not use this file except in compliance with the License.
09: *
10: * You can obtain a copy of the License at
11: * https://open-esb.dev.java.net/public/CDDLv1.0.html
12: * or mural/license.txt. See the License for the specific language
13: * governing permissions and limitations under the License.
14: *
15: * When distributing Covered Code, include this CDDL Header Notice
16: * in each file and include the License file at mural/license.txt.
17: * If applicable, add the following below the CDDL Header, with the
18: * fields enclosed by brackets [] replaced by your own identifying
19: * information: "Portions Copyrighted [year] [name of copyright owner]"
20: */
21:
22: package org.netbeans.modules.etl.project;
23:
24: import java.util.regex.Pattern;
25: import net.java.hulp.i18n.LocalizationSupport;
26:
27: /**
28: *
29: * @author rtam
30: */
31: public class Localizer extends LocalizationSupport {
32:
33: private static final String DEFAULT_PATTERN = "([A-Z][A-Z][A-Z][A-Z]\\d\\d\\d)(: )(.*)";
34:
35: private static final String DEFAULT_PREFIX = "DM-DI-";
36: private static final String DEFAULT_BUNDLENAME = "msgs";
37: private static Localizer instance = null;
38:
39: public Localizer(Pattern idpattern, String prefix, String bundlename) {
40: super (idpattern, prefix, bundlename);
41: }
42:
43: /** Returns an instance of Localizer.
44: *
45: * @return a Localizer instance.
46: *
47: */
48: public static Localizer get() {
49: if (instance == null) {
50: Pattern pattern = Pattern.compile(DEFAULT_PATTERN);
51: instance = new Localizer(pattern, DEFAULT_PREFIX,
52: DEFAULT_BUNDLENAME);
53:
54: }
55: return instance;
56: }
57:
58: public static String parse(String str) {
59: String s = "DM-DI-PRSR001: ";
60: if (str.contains(s)) {
61: str = str.replace(s, "");
62: }
63: return str;
64: }
65: /* public static Localizer get(String prefix, String bundlename) {
66:
67: Pattern pattern = Pattern.compile(DEFAULT_PATTERN);
68: Localizer instanceLocal = new Localizer(pattern, prefix, bundlename);
69:
70:
71: return instanceLocal;
72: } */
73: }
|