01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: ModuleItemByName.java 6840 2005-05-26 14:28:35Z danesa $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.webapp.jonasadmin.common;
25:
26: import org.objectweb.jonas.webapp.jonasadmin.common.ModuleItem;
27: import java.util.Comparator;
28:
29: /**
30: * @author Adriana.Danes@objectweb.org
31: *
32: * ModuleItem objects are used to show management information concerning
33: * modules in a J2EEApplication.
34: */
35: public class ModuleItemByName implements Comparator {
36: // --------------------------------------------------------- Public Methods
37:
38: public int compare(Object pO1, Object pO2) {
39: ModuleItem oContainer1 = (ModuleItem) pO1;
40: ModuleItem oContainer2 = (ModuleItem) pO2;
41: if ((oContainer1.getName() == null)
42: || (oContainer2.getName() == null)) {
43: if ((oContainer1.getName() == null)
44: && (oContainer2.getName() == null)) {
45: return 0;
46: } else if ((oContainer1.getName() == null)
47: && (oContainer2.getName() != null)) {
48: return 1;
49: } else {
50: return -1;
51: }
52: }
53: return oContainer1.getName().compareToIgnoreCase(
54: oContainer2.getName());
55: }
56:
57: public boolean equals(Object pObj) {
58: if (pObj instanceof ModuleItem) {
59: return true;
60: }
61: return false;
62: }
63: }
|