📄 iqservices.java
字号:
/*
* License
*
* The contents of this file are subject to the Jabber Open Source License
* Version 1.0 (the "License"). You may not copy or use this file, in either
* source code or executable form, except in compliance with the License. You
* may obtain a copy of the License at http://www.jabber.com/license/ or at
* http://www.opensource.org/.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Copyrights
*
* Portions created by or assigned to Jabber.com, Inc. are
* Copyright (c) 2000 Jabber.com, Inc. All Rights Reserved. Contact
* information for Jabber.com, Inc. is available at http://www.jabber.com/.
*
* Portions Copyright (c) 1999-2000 David Waite
*
* Acknowledgements
*
* Special thanks to the Jabber Open Source Contributors for their
* suggestions and support of Jabber.
*
* Changes
*
* @author $Author: chris $
* @version $Revision: 1.1 $
*
* j.komzak
* Changed into IQServices
*/
package edu.ou.kmi.buddyspace.xml;
import java.util.*;
import org.jabber.jabberbeans.Extension.Extension;
import org.jabber.jabberbeans.Extension.HashExtension;
import org.jabber.jabberbeans.Extension.QueryExtension;
/**
* An <code>IQSerices</code> holds the values for BuddySpace services namespace
*
* @author David Waite <a href="mailto:dwaite@jabber.com">
* <i><dwaite@jabber.com></i></a>
* @author $Author: chris $
* @version $Revision: 1.1 $
*
* @author Jiri Komzak <a href="mailto:j.komzak@open.ac.uk">
* <i><j.komzak@open.ac.uk></i></a>
* @author $Author: chris $
* @version $Revision: 1.1 $
*/
public class IQServices extends HashExtension
implements QueryExtension {
/** Vector of extension objects contained. */
private Vector extensions;
/** is this query or x **/
private boolean iq;
/** Creates a new <code>IQServices</code> instance. */
public IQServices(IQServicesBuilder builder)
throws InstantiationException
{
super(builder);
extensions = (Vector) builder.extensions().clone();
iq = builder.isIQ();
}
/**
* Used to fetch the internal XMLNS, which is used by AppendItem and
* toString to return the proper XML representation.
*
* @return <code>String</code> holding the XML namespace
*/
protected String getXMLNS()
{
return "http://jabber.open.ac.uk/tags/services";
}
public boolean isIQ() {
return iq;
}
/**
* returns an enumeration of <code>extensions</code> contained within this
* object.
*
* @return an <code>Enumeration</code> value
*/
public Enumeration extensions()
{
return extensions.elements();
}
/**
* <code>appendItem</code> appends the XML representation of the
* current packet data to the specified <code>StringBuffer</code>.
*
* @param retval The <code>StringBuffer</code> to append to
*/
public void appendItem(StringBuffer retval)
{
retval.append("<" + (iq? "query" : "x") + " xmlns=\"");
retval.append(getXMLNS());
retval.append("\">");
Enumeration names=entries.keys();
if (names!=null)
{
while (names.hasMoreElements())
{
String name=(String)names.nextElement();
appendChild(retval,
name,
(String)entries.get(name));
}
}
Enumeration extEnum = extensions.elements();
while (extEnum.hasMoreElements()) {
Extension ext = (Extension) extEnum.nextElement();
ext.appendItem(retval);
}
retval.append("</" + (iq? "query" : "x") + ">");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -