Source code: org/dinopolis/util/debug/DebugMessageFormatFactory.java
1 /***********************************************************************
2 * @(#)$RCSfile: DebugMessageFormatFactory.java,v $ $Revision: 1.1.1.1 $ $Date: 2003/01/10 15:33:38 $
3 *
4 * Copyright (c) 2000 IICM, Graz University of Technology
5 * Inffeldgasse 16c, A-8010 Graz, Austria.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License (LGPL)
9 * as published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this program; if not, write to the
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ***********************************************************************/
22
23
24 package org.dinopolis.util.debug;
25
26 //______________________________________________________________________
27 //______________________________________________________________________
28 /**
29 * This class is responsible for creating the parts of the message format.
30 *
31 */
32 public class DebugMessageFormatFactory
33 {
34
35 // the getPackage() method does not work in the linux jdk1.2, so
36 // the packagename is hard coded in the meantime.
37 // static final String CLASS_PACKAGE = DebugMessageFormatFactory.class.getPackage().getName();
38 static final String CLASS_PACKAGE = "org.dinopolis.util.debug";
39 static final String CLASS_PREFIX = CLASS_PACKAGE + ".DebugMessage";
40
41 //______________________________________________________________________
42 /**
43 * Returns a new object of the specified DebugMessage. The class name
44 * is created by appending the given name in uppercase to the prefix
45 * "DebugMessage".
46 *
47 * @param name the name of the keyword of the debug message.
48 * @return a new object of the specified DebugMessage.
49 */
50 public static DebugMessageFormatObject getMessageFormatObject(String name)
51 throws ClassNotFoundException, IllegalAccessException, InstantiationException
52 {
53 String class_name = CLASS_PREFIX + name.toUpperCase();
54 // System.out.println("trying to load class: " + class_name);
55 DebugMessageFormatObject message_obj = (DebugMessageFormatObject)
56 Class.forName(class_name).newInstance();
57 return(message_obj);
58 }
59 }
60
61
62
63
64
65
66
67
68
69