KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > common > ModuleItemByName


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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,v 1.2 2005/05/26 14:28:35 danesa Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.common;
27
28 import org.objectweb.jonas.webapp.jonasadmin.common.ModuleItem;
29 import java.util.Comparator JavaDoc;
30 /**
31  * @author Adriana.Danes@objectweb.org
32  *
33  * ModuleItem objects are used to show management information concerning
34  * modules in a J2EEApplication.
35  */

36 public class ModuleItemByName implements Comparator JavaDoc {
37     // --------------------------------------------------------- Public Methods
38

39     public int compare(Object JavaDoc pO1, Object JavaDoc pO2) {
40         ModuleItem oContainer1 = (ModuleItem) pO1;
41         ModuleItem oContainer2 = (ModuleItem) pO2;
42         if ((oContainer1.getName() == null) || (oContainer2.getName() == null)) {
43             if ((oContainer1.getName() == null) && (oContainer2.getName() == null)) {
44                 return 0;
45             } else if ((oContainer1.getName() == null) && (oContainer2.getName() != null)) {
46                 return 1;
47             } else {
48                 return -1;
49             }
50         }
51         return oContainer1.getName().compareToIgnoreCase(oContainer2.getName());
52     }
53
54     public boolean equals(Object JavaDoc pObj) {
55         if (pObj instanceof ModuleItem) {
56             return true;
57         }
58         return false;
59     }
60 }
Popular Tags