001/** 002 * 003 * Copyright the original author or authors 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.pubsub; 018 019import java.util.Arrays; 020import java.util.Collections; 021import java.util.List; 022 023import org.jivesoftware.smack.packet.PacketExtension; 024 025/** 026 * Represents the <b>configuration</b> element of a pubsub message event which 027 * associates a configuration form to the node which was configured. The form 028 * contains the current node configuration. 029 * 030 * @author Robin Collier 031 */ 032public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketExtension 033{ 034 private ConfigureForm form; 035 036 public ConfigurationEvent(String nodeId) 037 { 038 super(PubSubElementType.CONFIGURATION, nodeId); 039 } 040 041 public ConfigurationEvent(String nodeId, ConfigureForm configForm) 042 { 043 super(PubSubElementType.CONFIGURATION, nodeId); 044 form = configForm; 045 } 046 047 public ConfigureForm getConfiguration() 048 { 049 return form; 050 } 051 052 public List<PacketExtension> getExtensions() 053 { 054 if (getConfiguration() == null) 055 return Collections.emptyList(); 056 else 057 return Arrays.asList(((PacketExtension)getConfiguration().getDataFormToSend())); 058 } 059}