Commit bce715db authored by Matt Tucker's avatar Matt Tucker Committed by matt

Checking in XMPP packet classes from Whack.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5942 b35dd754-fafc-0310-a699-88a17e54d16e
parent a9eaeaeb
......@@ -11,7 +11,7 @@ commons-codec.jar | 1.3
dom4j.jar | 1.6.1
hsqldb.jar | 1.8.0.5
jetty.jar | Jetty 6.1.0
jetty-util.jar | Jetty 6.1.0
jetty-util.jar | Jetty 6.1.0
jasper-compiler.jar | Jetty 6.1.0 (5.5.15)
jasper-runtime.jar | Jetty 6.1.0 (5.5.15)
jaxen.jar | 1.1 beta 4 (from DOM4J 1.6.1)
......@@ -19,7 +19,7 @@ junit.jar | 3.8.1
jdic.jar | 0.9.1 (for windows only)
jstl.jar | Jakarta standard taglib 1.1.2
jmdns.jar | 1.0 RC1
jsp-api.jar | Jetty 6.1.0 (2.0)
jsp-api.jar | Jetty 6.1.0 (2.0)
jtds.jar | 1.2
jzlib.jar | 1.0.7
mail.jar | 1.4.0 (JavaMail)
......
/**
* $RCSfile$
* $Revision: 2610 $
* $Date: 2005-04-13 10:28:51 -0700 (Wed, 13 Apr 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.component;
import org.xmpp.packet.Packet;
import org.xmpp.packet.JID;
/**
* Component enhance the functionality of an XMPP server.
*
* Components are JavaBeans and will have their properties exposed as ad-hoc commands.
*
* @author Matt Tucker
*/
public interface Component {
/**
* Returns the name of this component.
*
* @return the name of this component.
*/
public String getName();
/**
* Returns the description of this component.
*
* @return the description of this component.
*/
public String getDescription();
/**
* Processes a packet sent to this Component.
*
* @param packet the packet.
* @see ComponentManager#sendPacket(Component, Packet)
*/
public void processPacket(Packet packet);
/**
* Initializes this component with a ComponentManager and the JID
* that this component is available at (e.g. <tt>service.example.com</tt>). If a
* ComponentException is thrown then the component will not be loaded.<p>
*
* The initialization code must not rely on receiving packets from the server since
* the component has not been fully initialized yet. This means that at this point the
* component must not rely on information that is obtained from the server such us
* discovered items.
*
* @param jid the XMPP address that this component is available at.
* @param componentManager the component manager.
* @throws ComponentException if an error occured while initializing the component.
*/
public void initialize(JID jid, ComponentManager componentManager) throws ComponentException;
/**
* Notification message indicating that the component will start receiving incoming
* packets. At this time the component may finish pending initialization issues that
* require information obtained from the server.<p>
*
* It is likely that most of the component will leave this method empty.
*/
public void start();
/**
* Shuts down this component. All component resources must be released as
* part of shutdown.
*/
public void shutdown();
}
\ No newline at end of file
/**
* $RCSfile$
* $Revision: 2589 $
* $Date: 2005-03-21 08:39:39 -0800 (Mon, 21 Mar 2005) $
*
* Copyright 2005 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.component;
import org.xmpp.packet.StreamError;
/**
* Thrown when an exception occors with a Component.
*
* @author Matt Tucker
*/
public class ComponentException extends Exception {
private StreamError streamError;
public ComponentException() {
super();
}
public ComponentException(String message) {
super(message);
}
public ComponentException(String message, Throwable cause) {
super(message, cause);
}
public ComponentException(Throwable cause) {
super(cause);
}
public ComponentException(String message, StreamError streamError) {
super(message);
this.streamError = streamError;
}
public ComponentException(StreamError streamError) {
super(streamError.getCondition().toXMPP());
this.streamError = streamError;
}
public StreamError getStreamError() {
return streamError;
}
}
/**
* $RCSfile$
* $Revision: 5861 $
* $Date: 2006-10-26 14:45:51 -0700 (Thu, 26 Oct 2006) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.component;
import org.xmpp.packet.Packet;
/**
* Manages components.
*
* @see Component
* @author Matt Tucker
*/
public interface ComponentManager {
/**
* Adds a component. The {@link Component#initialize(org.xmpp.packet.JID, ComponentManager)}
* method will be called on the component. The subdomain specifies the address of
* the component on a server. For example, if the subdomain is "test" and the XMPP
* server is at "example.com", then the component's address would be "test.example.com".
*
* @param subdomain the subdomain of the component's address.
* @param component the component.
*/
public void addComponent(String subdomain, Component component) throws ComponentException;
/**
* Removes a component. The {@link Component#shutdown} method will be called on the
* component.
*
* @param subdomain the subdomain of the component's address.
*/
public void removeComponent(String subdomain) throws ComponentException;
/**
* Sends a packet to the XMPP server. The "from" value of the packet must not be null.
* An <tt>IllegalArgumentException</tt> will be thrown when the "from" value is null.<p>
*
* Components are trusted by the server and may use any value in from address. Usually
* the from address uses the component's address as the domain but this is not required.
*
* @param component the component sending the packet.
* @param packet the packet to send.
*/
public void sendPacket(Component component, Packet packet) throws ComponentException;
/**
* Returns a property value specified by name. Properties can be used by
* components to store configuration data. It is recommended that each
* component qualify property names to prevent overlap. For example a
* component that broadcasts messages to groups of users, might prepend
* all property names it uses with "broadcast.".
*
* @param name the property name.
* @return the property value.
*/
public String getProperty(String name);
/**
* Sets a property value. Properties can be used by components to
* store configuration data. It is recommended that each component
* qualify property names to prevent overlap. For example a component
* that broadcasts messages to groups of users, might prepend all
* property names it uses with "broadcast.".
*
* @param name the property name.
* @param value the property value.
*/
public void setProperty(String name, String value);
/**
* Returns the domain of the XMPP server. The domain name may be the IP address or the host
* name.
*
* @return the domain of the XMPP server.
*/
public String getServerName();
/**
* Returns true if components managed by this component manager are external
* components connected to the server over a network connection. Otherwise,
* the components are internal to the server.
*
* @return true if the managed components are external components.
*/
public boolean isExternalMode();
/**
* Returns a Log instance, which can be used by components for logging error,
* warning, info, and debug messages.
*
* @return a Log instance.
*/
public Log getLog();
}
\ No newline at end of file
/**
* $RCSfile$
* $Revision: 2579 $
* $Date: 2005-02-08 13:48:59 -0800 (Tue, 08 Feb 2005) $
*
* Copyright 2005 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.component;
/**
* Factory to get a ComponentManager implementation. The ComponentManager implementation
* used will determined in the following way:<ul>
*
* <li>An external process can set the ComponentManager using
* {@link #setComponentManager(ComponentManager)}.
* <li>If the component manager is <tt>null</tt>, the factory will check for
* the Java system property "whack.componentManagerClass". The value of the
* property should be the fully qualified class name of a ComponentManager
* implementation (e.g. com.foo.MyComponentManager). The class must have a default
* constructor.
* </ul>
*
* @author Matt Tucker
*/
public class ComponentManagerFactory {
private static ComponentManager componentManager;
/**
* Returns a ComponentManager instance.
*
* @return a ComponentManager instance.
*/
public static synchronized ComponentManager getComponentManager() {
if (componentManager != null) {
return componentManager;
}
// ComponentManager is null so we have to try to figure out how to load
// an instance. Look for a Java property.
String className = System.getProperty("whack.componentManagerClass");
if (className != null) {
try {
Class c = Class.forName(className);
componentManager = (ComponentManager)c.newInstance();
return componentManager;
}
catch (Exception e) {
e.printStackTrace();
}
}
// Got here, so throw exception.
throw new NullPointerException("No ComponentManager implementation available.");
}
/**
* Sets the ComponentManager instance that will be used.
*
* @param manager the ComponentManager instance.
*/
public static void setComponentManager(ComponentManager manager) {
componentManager = manager;
}
}
/**
* $RCSfile$
* $Revision: 2580 $
* $Date: 2005-02-10 12:48:23 -0800 (Thu, 10 Feb 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.component;
/**
* A simple logging service for components. Four log levels are provided:<ul>
*
* <li>Error -- an error occured in the component.
* <li>Warn -- a condition occured that an administrator should be warned about.
* <li>Info -- used to send information messages, such as a version or license notice.
* <li>Debug -- used to send debugging information. Most Log implementations will
* disable debug output by default.
* </ul>
*
* Log implementations will attempt use the native logging service of the component host
* server. However, this may not be possible in some cases -- for example, when using an
* external component that is not currently connected to the server.
*
* @author Matt Tucker
*/
public interface Log {
/**
* Logs an error.
*
* @param message the error message.
*/
public void error(String message);
/**
* Logs an error.
*
* @param message the error message.
* @param throwable the Throwable that caused the error.
*/
public void error(String message, Throwable throwable);
/**
* Logs an error.
*
* @param throwable the Throwable that caused the error.
*/
public void error(Throwable throwable);
/**
* Logs a warning.
*
* @param message the warning message.
*/
public void warn(String message);
/**
* Logs a warning.
*
* @param message the warning message.
* @param throwable the Throwable that caused the error.
*/
public void warn(String message, Throwable throwable);
/**
* Logs a warning.
*
* @param throwable the Throwable that caused the error.
*/
public void warn(Throwable throwable);
/**
* Logs an info message.
*
* @param message the info message.
*/
public void info(String message);
/**
* Logs an info message.
*
* @param message the info message.
* @param throwable the Throwable that caused the info message.
*/
public void info(String message, Throwable throwable);
/**
* Logs an info message.
*
* @param throwable the Throwable that caused the info message.
*/
public void info(Throwable throwable);
/**
* Logs a debug message.
*
* @param message the debug message.
*/
public void debug(String message);
/**
* Logs a debug message.
*
* @param message the debug message.
* @param throwable the Throwable that caused the debug message.
*/
public void debug(String message, Throwable throwable);
/**
* Logs a debug message.
*
* @param throwable the Throwable the caused the debug message.
*/
public void debug(Throwable throwable);
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/**
* $RCSfile$
* $Revision: 2591 $
* $Date: 2005-03-27 08:24:56 -0800 (Sun, 27 Mar 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.muc;
import org.dom4j.Element;
import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
/**
* DestroyRoom is a packet that when sent will ask the server to destroy a given room. The room to
* destroy must be specified in the TO attribute of the IQ packet. The server will send a presence
* unavailable together with the alternate room and reason for the destruction to all the room
* occupants before destroying the room.<p>
*
* When destroying a room it is possible to provide an alternate room which may be replacing the
* room about to be destroyed. It is also possible to provide a reason for the room destruction.
*/
public class DestroyRoom extends IQ {
/**
* Creates a new DestroyRoom with the reason for the destruction and an alternate room JID.
*
* @param alternateJID JID of the alternate room or <tt>null</tt> if none.
* @param reason reason for the destruction or <tt>null</tt> if none.
*/
public DestroyRoom(JID alternateJID, String reason) {
super();
setType(Type.set);
Element query = setChildElement("query", "http://jabber.org/protocol/muc#owner");
Element destroy = query.addElement("destroy");
if (alternateJID != null) {
destroy.addAttribute("jid", alternateJID.toString());
}
if (reason != null) {
destroy.addElement("reason").setText(reason);
}
}
}
/**
* $RCSfile$
* $Revision: 2576 $
* $Date: 2005-02-06 12:04:40 -0800 (Sun, 06 Feb 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.muc;
import org.dom4j.Element;
import org.xmpp.packet.Message;
/**
* Represents an invitation to a Multi-User Chat room from a room occupant to a user that is not
* an occupant of the room. The invitation must be <b>sent to the room</b> and it's the room
* responsibility to forward the invitation to the invitee. The <b>sender of the invitation must be
* the real full JID of the inviter</b>.<p>
*
* Code example:
* <pre>
* // Invite the someone to the room.
* Invitation invitation = new Invitation("invitee@jabber.org", "Join this excellent room");
* invitation.setTo("room@conference.jabber.org");
* invitation.setFrom("inviter@jabber.org/notebook");
*
* component.sendPacket(invitation);
* </pre>
*
* @author Gaston Dombiak
*/
public class Invitation extends Message {
/**
* Creates a new invitation.
*
* @param invitee the XMPP address of the invitee. The room will forward the invitation to this
* address.
* @param reason the reason why the invitation is being sent.
*/
public Invitation(String invitee, String reason) {
super();
Element element = addChildElement("x", "http://jabber.org/protocol/muc#user");
Element invite = element.addElement("invite");
invite.addAttribute("to", invitee);
if (reason != null && reason.length() > 0) {
invite.addElement("reason").setText(reason);
}
}
}
/**
* $RCSfile$
* $Revision: 2576 $
* $Date: 2005-02-06 12:04:40 -0800 (Sun, 06 Feb 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.muc;
import org.xmpp.packet.Presence;
/**
* Initial presence sent when joining an existing room or creating a new room. The JoinRoom presence
* indicates the posibility of the sender to speak MUC.<p>
*
* Code example:
* <pre>
* // Join an existing room or create a new one.
* JoinRoom joinRoom = new JoinRoom("john@jabber.org/notebook", "room@conference.jabber.org/nick");
*
* component.sendPacket(joinRoom);
* </pre>
*
* @author Gaston Dombiak
*/
public class JoinRoom extends Presence {
/**
* Creates a new Presence packet that could be sent to a MUC service in order to join
* an existing MUC room or create a new one.
*
* @param from the real full JID of the user that will join or create a MUC room.
* @param to a full JID where the bare JID is the MUC room address and the resource is the
* nickname of the user joining the room.
*/
public JoinRoom(String from, String to) {
super();
setFrom(from);
setTo(to);
addChildElement("x", "http://jabber.org/protocol/muc");
}
}
/**
* $RCSfile$
* $Revision: 2576 $
* $Date: 2005-02-06 12:04:40 -0800 (Sun, 06 Feb 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.muc;
import org.xmpp.packet.Presence;
/**
* Initial presence sent when joining an existing room or creating a new room. The JoinRoom presence
* indicates the posibility of the sender to speak MUC.<p>
*
* Code example:
* <pre>
* // Join an existing room or create a new one.
* JoinRoom joinRoom = new JoinRoom("john@jabber.org/notebook", "room@conference.jabber.org/nick");
*
* component.sendPacket(joinRoom);
* </pre>
*
* @author Gaston Dombiak
*/
public class LeaveRoom extends Presence {
/**
* Creates a new Presence packet that could be sent to a MUC service in order to leave the room.
*
* @param from the full JID of the user that wants to leave the room.
* @param to the room JID. That is the room address plus the nickname of the user as a resource.
*/
public LeaveRoom(String from, String to) {
super();
setFrom(from);
setTo(to);
setType(Type.unavailable);
}
}
/**
* $RCSfile$
* $Revision: 2576 $
* $Date: 2005-02-06 12:04:40 -0800 (Sun, 06 Feb 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.muc;
import org.dom4j.Element;
import org.xmpp.packet.IQ;
import java.util.Collection;
import java.util.Map;
/**
* RoomConfiguration is a packet that helps to set the configuration of MUC rooms. RoomConfiguration
* is a speacial IQ packet whose child element contains a data form. The data form holds the fields
* to set together with a list of values.<p>
*
* Code example:
* <pre>
* // Set the fields and the values.
* Map<String,Collection<String>> fields = new HashMap<String,Collection<String>>();
* // Make a non-public room
* List<String> values = new ArrayList<String>();
* values.add("0");
* fields.put("muc#roomconfig_publicroom", values);
*
* // Create a RoomConfiguration with the fields and values
* RoomConfiguration conf = new RoomConfiguration(fields);
* conf.setTo("room@conference.jabber.org");
* conf.setFrom("john@jabber.org/notebook");
*
* component.sendPacket(conf);
* </pre>
*
* @author Gaston Dombiak
*/
public class RoomConfiguration extends IQ {
/**
* Creates a new IQ packet that contains the field and values to send for setting the room
* configuration.
*
* @param fieldValues the list of fields associated with the list of values.
*/
public RoomConfiguration(Map<String,Collection<String>> fieldValues) {
super();
setType(Type.set);
Element query = setChildElement("query", "http://jabber.org/protocol/muc#owner");
Element form = query.addElement("x", "jabber:x:data");
form.addAttribute("type", "submit");
// Add static field
Element field = form.addElement("field");
field.addAttribute("var", "FORM_TYPE");
field.addElement("value").setText("http://jabber.org/protocol/muc#roomconfig");
// Add the specified fields and their corresponding values
for (String variable : fieldValues.keySet()) {
field = form.addElement("field");
field.addAttribute("var", variable);
for (String value : fieldValues.get(variable)) {
field.addElement("value").setText(value);
}
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* $RCSfile$
* $Revision: 2624 $
* $Date: 2005-05-11 12:56:11 -0700 (Wed, 11 May 2005) $
*
* Copyright 2004 Jive Software.
*
* All rights reserved. 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.
*/
package org.xmpp.packet;
import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import org.dom4j.QName;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* A packet extension represents a child element of a Packet for a given qualified name. The
* PacketExtension acts as a wrapper on a child element the same way Packet does for a whole
* element. The wrapper provides an easy way to handle the packet extension.<p>
*
* Subclasses of this class should be registered in the static variable
* <tt>registeredExtensions</tt> when loaded. The registration process associates the new subclass
* with a given qualified name (ie. element name and namespace). This information will be used by
* {@link Packet#getExtension(String, String)} for locating the corresponding PacketExtension
* subclass to return for the requested qualified name.
*
* @author Gaston Dombiak
*/
public abstract class PacketExtension {
protected static DocumentFactory docFactory = DocumentFactory.getInstance();
/**
* Subclasses of PacketExtension should register the element name and namespace that the
* subclass is using.
*/
protected static Map<QName, Class> registeredExtensions = new ConcurrentHashMap<QName, Class>();
protected Element element;
/**
* Returns the extension class to use for the specified element name and namespace. For
* instance, the DataForm class should be used for the element "x" and
* namespace "jabber:x:data".
*
* @param name the child element name.
* @param namespace the child element namespace.
* @return the extension class to use for the specified element name and namespace.
*/
public static Class getExtensionClass(String name, String namespace) {
return registeredExtensions.get(QName.get(name, namespace));
}
/**
* Constructs a new Packet extension using the specified name and namespace.
*
* @param name the child element name.
* @param namespace the child element namespace.
*/
public PacketExtension(String name, String namespace) {
this.element = docFactory.createDocument().addElement(name, namespace);
}
/**
* Constructs a new PacketExtension.
*
* @param element the XML Element that contains the packet extension contents.
*/
public PacketExtension(Element element) {
this.element = element;
}
/**
* Returns the DOM4J Element that backs the packet. The element is the definitive
* representation of the packet and can be manipulated directly to change
* packet contents.
*
* @return the DOM4J Element that represents the packet.
*/
public Element getElement() {
return element;
}
/**
* Creates a deep copy of this packet extension.
*
* @return a deep copy of this packet extension.
*/
public abstract PacketExtension createCopy();
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment