|
/*
Copyright 2005 Matthew J. Battey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
This software implements a Java application to manage a SAFMQ server.
Created on May 13, 2005
*/
package com.safmq.manager;
import java.util.Vector;
import com.safmq.MQConnection;
import com.safmq.Safmq;
/**
* @author matt
*
*/
public class GroupList extends AbstractManagerList {
Server parent;
public GroupList(Server parent) {
this.parent = parent;
}
public static final String NAME = "Groups";
public String toString() {
return GroupList.NAME;
}
public boolean reload() {
MQConnection con = parent.getCon();
if (con != null) {
Vector groups = new Vector();
Vector list = getList();
Vector dels = (Vector)list.clone();
Vector adds = new Vector();
Group group;
int err = con.EnumerateGroups(groups);
int x;
if (err == Safmq.EC_NOERROR) {
for(x=0;x<groups.size();x++) {
group = new Group((String)groups.get(x),parent);
if (!dels.remove(group))
adds.add(group);
}
for(x=0;x<dels.size();x++)
list.remove(dels.get(x));
for(x=0;x<adds.size();x++)
list.add(adds.get(x));
return true;
} else if (err == Safmq.EC_NETWORKERROR) {
Manager.getInstance().handleNetworkError(
"An error occurred loading the list of groups from safmq://"+parent.getName()+
".\n\nTry reconnecting to server and then viewing the list of groups again to recover.",parent);
}
} else
getList().removeAllElements();
return false;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
A programmer for 20 years and professionaly employed for 12, I am currently Cheif Engineer for Pharmacy Chare Professionals, Inc., located in Omaha, NE.
My experience is in the area of OO Design, Application, and programming, technical team leadership, RDBMS applications, ISAM applications, Image Processing, Mathematical image generation, Client-Server business applications, eBusiness applications, XML & EDI B2B communications, Java application development, C/C++ application development, CFML/ASP/VB development, on systems like Win2K/NT/98/95, Linux, Irix, Solaris, and MacOS.