![]() |
Hubiquitus Android
0.3
Android client for hubiquitus protocol
|
00001 /* 00002 * Copyright (c) Novedia Group 2012. 00003 * 00004 * This file is part of Hubiquitus. 00005 * 00006 * Hubiquitus is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * Hubiquitus is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with Hubiquitus. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 package org.hubiquitus.hapi.transport.xmpp; 00021 00022 import org.jivesoftware.smack.packet.PacketExtension; 00023 import org.jivesoftware.smack.provider.PacketExtensionProvider; 00024 import org.xmlpull.v1.XmlPullParser; 00025 00033 public class HXMPPPubsubEntry implements PacketExtension{ 00034 00035 public static final String NAMESPACE = "http://jabber.org/protocol/pubsub"; 00036 public static final String ELEMENT_NAME = "entry"; 00037 private String entry = null; 00038 00039 public HXMPPPubsubEntry() { 00040 } 00041 00042 public HXMPPPubsubEntry(String content) { 00043 setContent(content); 00044 } 00045 00046 /* Getters & Setters */ 00047 00048 public String getContent(){ 00049 return this.entry; 00050 } 00051 00052 public void setContent(String content) { 00053 this.entry = content; 00054 } 00055 00056 @Override 00057 public String getElementName() { 00058 return HXMPPPubsubEntry.ELEMENT_NAME; 00059 } 00060 00061 @Override 00062 public String getNamespace() { 00063 return HXMPPPubsubEntry.NAMESPACE; 00064 } 00065 00066 @Override 00067 public String toXML() { 00068 StringBuilder localStringBuilder = new StringBuilder(); 00069 00070 localStringBuilder.append("<entry xmlns=\"").append(getNamespace()).append("\">"); 00071 localStringBuilder.append(getContent()); 00072 localStringBuilder.append("</entry>"); 00073 00074 return localStringBuilder.toString(); 00075 } 00076 00077 public static class Provider implements PacketExtensionProvider { 00078 public PacketExtension parseExtension(XmlPullParser paramXmlPullParser) throws Exception 00079 { 00080 paramXmlPullParser.next(); 00081 String content = paramXmlPullParser.getText(); 00082 return new HXMPPPubsubEntry(content); 00083 } 00084 } 00085 } 00086