diff options
author | Lahiru Gunathilake <lahiru@apache.org> | 2008-10-07 09:07:34 +0000 |
---|---|---|
committer | Lahiru Gunathilake <lahiru@apache.org> | 2008-10-07 09:07:34 +0000 |
commit | 72b302e7c6ce04f700dfc8f52a17599dd2268eb8 (patch) | |
tree | 478c74e63dc35eb81a6e6bf31ed851ab935268ae /qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects | |
parent | 6498fc705816a435f8a9a5f2fdd60816b19beb90 (diff) | |
download | qpid-python-72b302e7c6ce04f700dfc8f52a17599dd2268eb8.tar.gz |
committing qpid-cli for the first time.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@702402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects')
7 files changed, 812 insertions, 0 deletions
diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java new file mode 100644 index 0000000000..7f16109f0c --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java @@ -0,0 +1,44 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + */ + +package org.apache.qpid.commands.objects; + +import javax.management.MBeanServerConnection; + +/** + * Created by IntelliJ IDEA. + * User: lahiru + * Date: Jun 20, 2008 + * Time: 9:04:22 AM + * To change this template use File | Settings | File Templates. + */ +public class AllObjects extends ObjectNames { + + public AllObjects(MBeanServerConnection mbsc) { + ObjectNames(mbsc); +// querystring = "org.apache.qpid:*"; +// set = returnObjects(); + } + + public void setQueryString(String object, String name) { + querystring = "org.apache.qpid:*"; + } +} diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java new file mode 100644 index 0000000000..6c427660c0 --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java @@ -0,0 +1,54 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + */ + +package org.apache.qpid.commands.objects; + +import javax.management.MBeanServerConnection; + +/** + * Created by IntelliJ IDEA. + * User: lahiru + * Date: Jun 26, 2008 + * Time: 9:58:02 PM + * To change this template use File | Settings | File Templates. + */ +public class ConnectionObject extends ObjectNames { + public ConnectionObject(MBeanServerConnection mbsc) { + /*calling parent classes constructor */ + ObjectNames(mbsc); +// querystring = "org.apache.qpid:type=VirtualHost.Connection,*"; +// set = returnObjects(); + + } + + public void setQueryString(String object, String name, String vhost) { + if (name != null && vhost == null) + querystring = "org.apache.qpid:type=Connection,name=" + name + ",*"; + else if (name != null && vhost != null) + querystring = "org.apache.qpid:type=Connection,VirtualHost=" + vhost + ",name=" + name + ",*"; + else if (name == null && vhost != null) + querystring = "org.apache.qpid:type=Connection,VirtualHost=" + vhost + ",*"; + else + querystring = "org.apache.qpid:type=Connection,*"; + + } +} + diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java new file mode 100644 index 0000000000..22439e9d61 --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java @@ -0,0 +1,53 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + */ + +package org.apache.qpid.commands.objects; + +import javax.management.MBeanServerConnection; + +/** + * Created by IntelliJ IDEA. + * User: lahiru + * Date: Jun 24, 2008 + * Time: 12:15:19 AM + * To change this template use File | Settings | File Templates. + */ +public class ExchangeObject extends ObjectNames { + public ExchangeObject(MBeanServerConnection mbsc) { + ObjectNames(mbsc); +// querystring = "org.apache.qpid:type=VirtualHost.Exchange,*"; +// set = returnObjects(); + + } + + public void setQueryString(String object, String name, String vhost) { + if (name != null && vhost == null) + querystring = "org.apache.qpid:type=VirtualHost.Exchange,name=" + name + ",*"; + else if (name != null && vhost != null) + querystring = "org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=" + vhost + ",name=" + name + ",*"; + else if (name == null && vhost != null) + querystring = "org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=" + vhost + ",*"; + else + querystring = "org.apache.qpid:type=VirtualHost.Exchange,*"; + + } +} + diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java new file mode 100644 index 0000000000..127c9f0a67 --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java @@ -0,0 +1,477 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + */ + +package org.apache.qpid.commands.objects; + +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.MBeanInfo; +import java.util.Iterator; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; + +/** + * Created by IntelliJ IDEA. + * User: lahiru + * Date: Jun 20, 2008 + * Time: 8:39:01 AM + * To change this template use File | Settings | File Templates. + */ +public class ObjectNames { + public String querystring = null; + public MBeanServerConnection mbsc; + public Set set = null; + public String attributes = ""; + public String attributevalues = "";// = null; + + /* method return the Set objects according to the Object type */ + public void ObjectNames(MBeanServerConnection mbsc) { + this.mbsc = mbsc; + } + + public Set returnObjects() { + try { + set = mbsc.queryNames(new ObjectName(querystring), null); + } catch (Exception ex) { + ex.printStackTrace(); + } + return set; + } + + public void echo(String str) { + System.out.println(str); + } + /* display appropriate objects according to the ojbect type */ + + public void displayobjects(String output, String seperator) { + Iterator it = set.iterator(); + String line = ""; + String temp2 = ""; + int iterator = 0; + try { + do { + ObjectName temp_object = null; + if (it.hasNext()) { + temp_object = (ObjectName) it.next(); + if (temp_object == null) + System.out.println("null test"); + } + // echo(temp_object.getCanonicalKeyPropertyListString()); + MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object); + MBeanAttributeInfo[] attr_info = bean_info.getAttributes(); + if (attr_info == null) { + echo(temp_object.toString()); + String temp = ""; + while (temp_object.toString().length() > temp.length()) + temp = "=" + temp; + if (output == null) + echo(temp); + + } else { + for (MBeanAttributeInfo attr : attr_info) { + Object toWrite = null; + + try { + String temp1 = attr.getName(); + if (output == null) { + while (temp1.length() < 15) + temp1 = " " + temp1; + attributes = attributes + temp1 + "|"; + } else if (output.compareToIgnoreCase("csv") == 0) + attributes = attributes + temp1 + seperator; + else { + echo("Wrong output format current version is supporting only for CSV"); + return; + } + } catch (Exception x) { + x.printStackTrace(); + } + } + if (attributes.equalsIgnoreCase("")) { + echo(temp_object.toString()); + String temp = ""; + while (temp_object.toString().length() > temp.length()) + temp = "=" + temp; + echo(temp); + echo("There are no attributes for this object Type"); + return; + } + for (MBeanAttributeInfo attr : attr_info) { + Object toWrite = null; + temp2 = null; + try { + toWrite = mbsc.getAttribute(temp_object, attr.getName()); + } catch (Exception x) { + temp2 = "-"; + } + if (toWrite != null) + temp2 = toWrite.toString(); + else + temp2 = "-"; + if (output == null) { + + while (temp2.length() < 15) + temp2 = " " + temp2; + + attributevalues = attributevalues + temp2 + "|"; + } else if (output.compareToIgnoreCase("csv") == 0) + attributevalues = attributevalues + temp2 + seperator; + + //echo(temp1 + " " + temp2 + " " + temp3); + + + } + } + iterator++; + if (iterator == 1) { + echo(attributes); + for (int i = 0; i < attributes.length(); i++) + line = line + "-"; + if (output == null) + echo(line); + } + echo(attributevalues); + line = ""; + attributes = ""; + attributevalues = ""; + } while (it.hasNext()); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + + public void reportgenerator(String output, String seperator, List<String> column) { + Iterator it = set.iterator(); + String line = ""; + String temp2 = ""; + int iterator = 0; + try { + do { + ObjectName temp_object = null; + if (it.hasNext()) { + temp_object = (ObjectName) it.next(); + if (temp_object == null) + System.out.println("null test"); + } + // echo(temp_object.getCanonicalKeyPropertyListString()); + MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object); + MBeanAttributeInfo[] attr_info = bean_info.getAttributes(); + if (attr_info == null) { + echo(temp_object.toString()); + String temp = ""; + while (temp_object.toString().length() > temp.length()) + temp = "=" + temp; + if (output == null) + echo(temp); + + } else { + for (MBeanAttributeInfo attr : attr_info) { + Object toWrite = null; + + try { + String temp1 = attr.getName(); + if (column.contains(temp1)) { + if (output == null) { + while (temp1.length() < 15) + temp1 = " " + temp1; + attributes = attributes + temp1 + "|"; + } else if (output.compareToIgnoreCase("csv") == 0) + attributes = attributes + temp1 + seperator; + else { + echo("Wrong output format current version is supporting only for CSV"); + return; + } + } + } catch (Exception x) { + x.printStackTrace(); + } + } + if (attributes.equalsIgnoreCase("")) { + echo(temp_object.toString()); + String temp = ""; + while (temp_object.toString().length() > temp.length()) + temp = "=" + temp; + echo(temp); + echo("There are no attributes for this object Type"); + return; + } + for (MBeanAttributeInfo attr : attr_info) { + Object toWrite = null; + temp2 = null; + if (column.contains(attr.getName())) { + try { + toWrite = mbsc.getAttribute(temp_object, attr.getName()); + } catch (Exception x) { + temp2 = "-"; + } + if (toWrite != null) + temp2 = toWrite.toString(); + else + temp2 = "-"; + if (output == null) { + + while (temp2.length() < 15) + temp2 = " " + temp2; + + attributevalues = attributevalues + temp2 + "|"; + } else if (output.compareToIgnoreCase("csv") == 0) + attributevalues = attributevalues + temp2 + seperator; + + //echo(temp1 + " " + temp2 + " " + temp3); + + } + + + } + } + iterator++; + if (iterator == 1) { + echo(attributes); + for (int i = 0; i < attributes.length(); i++) + line = line + "-"; + if (output == null) + echo(line); + } + echo(attributevalues); + line = ""; + attributes = ""; + attributevalues = ""; + } while (it.hasNext()); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + + public void displayqueues(String output, String seperator) { + Iterator it = set.iterator(); + String line = ""; + int iterator = 0; + int attr_count = 0; + String temp1 = ""; + String temp2 = ""; + try { + do { + attr_count = 0; + ObjectName temp_object = null; + if (it.hasNext()) { + temp_object = (ObjectName) it.next(); + } + // echo(temp_object.getCanonicalKeyPropertyListString()); + MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object); + MBeanAttributeInfo[] attr_info = bean_info.getAttributes(); + if (attr_info == null) { + echo(temp_object.toString()); + String temp = ""; + while (temp_object.toString().length() > temp.length()) + temp = "=" + temp; + if (output == null) + echo(temp); + + } else { + for (MBeanAttributeInfo attr : attr_info) { + Object toWrite = null; + attr_count++; + try { + toWrite = mbsc.getAttribute(temp_object, attr.getName()); + if (output == null) { + switch (attr_count) { + case 1: + case 3: + temp1 = attr.getName(); + while (temp1.length() < 10) + temp1 = " " + temp1; + attributes = attributes + temp1 + "|"; + temp2 = toWrite.toString(); + while (temp2.length() < 10) + temp2 = " " + temp2; + attributevalues = attributevalues + temp2 + "|"; + break; + case 6: + temp1 = attr.getName(); + while (temp1.length() < 20) + temp1 = " " + temp1; + attributes = attributes + temp1 + "|"; + temp2 = toWrite.toString(); + while (temp2.length() < 20) + temp2 = " " + temp2; + attributevalues = attributevalues + temp2 + "|"; + break; + case 7: + temp1 = attr.getName(); + while (temp1.length() < 13) + temp1 = " " + temp1; + attributes = attributes + temp1 + "|"; + temp2 = toWrite.toString(); + while (temp2.length() < 13) + temp2 = " " + temp2; + attributevalues = attributevalues + temp2 + "|"; + break; + case 9: + temp1 = attr.getName(); + while (temp1.length() < 20) + temp1 = " " + temp1; + attributes = attributes + temp1 + "|"; + temp2 = toWrite.toString(); + while (temp2.length() < 20) + temp2 = " " + temp2; + attributevalues = attributevalues + temp2 + "|"; + break; + } + } else if (output.compareToIgnoreCase("csv") == 0) { + switch (attr_count) { + case 1: + case 3: + case 6: + temp1 = attr.getName(); + attributes = attributes + temp1 + seperator; + temp2 = toWrite.toString(); + attributevalues = attributevalues + temp2 + seperator; + break; + case 7: + temp1 = attr.getName(); + attributes = attributes + temp1 + seperator; + temp2 = toWrite.toString(); + attributevalues = attributevalues + temp2 + seperator; + break; + case 9: + temp1 = attr.getName(); + attributes = attributes + temp1 + seperator; + temp2 = toWrite.toString(); + attributevalues = attributevalues + temp2 + seperator; + break; + } + } else { + echo("Wrong output format specified currently CLI supports only csv output format"); + return; + } + + + } catch (Exception x) { + x.printStackTrace(); + } + + } + } + iterator++; + if (iterator == 1) { + for (int i = 0; i < attributes.length(); i++) + line = line + "-"; + if (output == null) + echo(line); + echo(attributes); + if (output == null) + echo(line); + } + echo(attributevalues); + line = ""; + attributes = ""; + attributevalues = ""; + } while (it.hasNext()); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + public void displayinfo(String output, String seperator) { + Iterator it = set.iterator(); + String temp1, temp2 = ""; + try { + do { + + ObjectName temp_object = null; + if (it.hasNext()) { + temp_object = (ObjectName) it.next(); + } + // echo(temp_object.getCanonicalKeyPropertyListString()); + MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object); + MBeanAttributeInfo[] attr_info = bean_info.getAttributes(); + if (attr_info == null) { + echo(temp_object.toString()); + String temp = ""; + while (temp_object.toString().length() > temp.length()) + temp = "=" + temp; + echo(temp); + + } else { + echo(temp_object.toString()); + String temp = ""; + while (temp_object.toString().length() > temp.length()) + temp = "=" + temp; + echo(temp); + + for (MBeanAttributeInfo attr : attr_info) { + Object toWrite = null; + + try { + toWrite = mbsc.getAttribute(temp_object, attr.getName()); + } catch (Exception x) { + temp2 = "-"; + } + temp1 = attr.getName(); + if (toWrite != null) + temp2 = toWrite.toString(); + + if (output == null) { + while (temp1.length() < 35) + temp1 = " " + temp1; + + while (temp2.length() < 35) + temp2 = " " + temp2; + echo(temp1 + " " + temp2); + } else if (output.compareToIgnoreCase("csv") == 0) + echo(temp1 + seperator + temp2); + else { + echo("Wrong output format specified currently CLI supports only csv output format"); + return; + } + } + echo(""); + echo(""); + + } + } while (it.hasNext()); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + + public void setQueryString(String object, String name, String vhost) { + + } + + public void setQueryStringforinfo(String object, String name, String virtualhost) { + + } + + public String getQueryString() { + return querystring; + } + + public Set getSet() { + return set; + } + +} diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java new file mode 100644 index 0000000000..7bbcbf5840 --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java @@ -0,0 +1,86 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + */ + +package org.apache.qpid.commands.objects; + +import javax.management.MBeanServerConnection; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanInfo; +import javax.management.ObjectName; + +/** + * Created by IntelliJ IDEA. + * User: lahiru + * Date: Jun 20, 2008 + * Time: 8:49:56 AM + * To change this template use File | Settings | File Templates. + */ +public class QueueObject extends ObjectNames { + public QueueObject(MBeanServerConnection mbsc) { + ObjectNames(mbsc); + } + + public void setQueryString(String object, String name, String vhost) { + if (name != null && vhost == null) + querystring = "org.apache.qpid:type=VirtualHost.Queue,name=" + name + ",*"; + else if (name != null && vhost != null) + querystring = "org.apache.qpid:type=VirtualHost.Queue,VirtualHost=" + vhost + ",name=" + name + ",*"; + else if (name == null && vhost != null) + querystring = "org.apache.qpid:type=VirtualHost.Queue,VirtualHost=" + vhost + ",*"; + else + querystring = "org.apache.qpid:type=VirtualHost.Queue,*"; + } + + public int getmessagecount(ObjectName queue) { + int attr_count = 0; + String value; + Integer depth = null; + + try { + MBeanInfo bean_info; + bean_info = mbsc.getMBeanInfo(queue); + MBeanAttributeInfo[] attr_info = bean_info.getAttributes(); + if (attr_info == null) + return 0; + else { + for (MBeanAttributeInfo attr : attr_info) { + Object toWrite = null; + attr_count++; + toWrite = mbsc.getAttribute(queue, attr.getName()); + if (attr_count == 7) { + value = toWrite.toString(); + depth = new Integer(value); + } + } + + } + + } catch (Exception ex) { + ex.printStackTrace(); + } + if (depth != null) + return depth.intValue(); + else + return -1; + } + + +} diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java new file mode 100644 index 0000000000..a5f84ea39e --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java @@ -0,0 +1,45 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + */ + +package org.apache.qpid.commands.objects; + +import javax.management.MBeanServerConnection; + +/** + * Created by IntelliJ IDEA. + * User: lahiru + * Date: Jun 24, 2008 + * Time: 12:11:52 AM + * To change this template use File | Settings | File Templates. + */ +public class UserManagementObject extends ObjectNames { + public UserManagementObject(MBeanServerConnection mbsc) { + ObjectNames(mbsc); +// querystring = "org.apache.qpid:type=UserManagement,*"; +// set = returnObjects(); + + } + + public void setQueryString(String object, String name, String vhost) { + querystring = "org.apache.qpid:type=UserManagement,*"; + } + +} diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java new file mode 100644 index 0000000000..16bb159990 --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java @@ -0,0 +1,53 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + */ + +package org.apache.qpid.commands.objects; + +import javax.management.MBeanServerConnection; + +/** + * Created by IntelliJ IDEA. + * User: lahiru + * Date: Jun 20, 2008 + * Time: 9:02:04 AM + * To change this template use File | Settings | File Templates. + */ +public class VirtualHostObject extends ObjectNames { + + public VirtualHostObject(MBeanServerConnection mbsc) { + ObjectNames(mbsc); +// querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,*"; +// set = returnObjects(); + } + + public void setQueryString(String object, String name, String vhost) { + if (name != null && vhost == null) + querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,name=" + name + ",*"; + else if (name != null && vhost != null) + querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + vhost + ",name=" + name + ",*"; + else if (name == null && vhost != null) + querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + vhost + ",*"; + else + querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,*"; + + + } +} |