• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  *     http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  */
14 package org.jivesoftware.smackx.pubsub;
15 
16 import java.util.Arrays;
17 import java.util.Collections;
18 import java.util.List;
19 
20 import org.jivesoftware.smack.packet.PacketExtension;
21 
22 /**
23  * Represents the <b>configuration</b> element of a pubsub message event which
24  * associates a configuration form to the node which was configured.  The form
25  * contains the current node configuration.
26  *
27  * @author Robin Collier
28  */
29 public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketExtension
30 {
31 	private ConfigureForm form;
32 
ConfigurationEvent(String nodeId)33 	public ConfigurationEvent(String nodeId)
34 	{
35 		super(PubSubElementType.CONFIGURATION, nodeId);
36 	}
37 
ConfigurationEvent(String nodeId, ConfigureForm configForm)38 	public ConfigurationEvent(String nodeId, ConfigureForm configForm)
39 	{
40 		super(PubSubElementType.CONFIGURATION, nodeId);
41 		form = configForm;
42 	}
43 
getConfiguration()44 	public ConfigureForm getConfiguration()
45 	{
46 		return form;
47 	}
48 
getExtensions()49 	public List<PacketExtension> getExtensions()
50 	{
51 		if (getConfiguration() == null)
52 			return Collections.EMPTY_LIST;
53 		else
54 			return Arrays.asList(((PacketExtension)getConfiguration().getDataFormToSend()));
55 	}
56 }
57