01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.gbean;
17:
18: import java.io.Serializable;
19: import java.util.Collections;
20: import java.util.Iterator;
21: import java.util.Set;
22:
23: /**
24: * Describes a notification of a GBean.
25: *
26: * @version $Rev: 564284 $ $Date: 2007-08-09 10:21:54 -0700 (Thu, 09 Aug 2007) $
27: */
28: public final class GNotificationInfo implements Serializable {
29: private static final long serialVersionUID = 2241808021653786721L;
30:
31: private final String name;
32: private final Set notificationTypes;
33:
34: public GNotificationInfo(String name, Set notificationTypes) {
35: this .name = name;
36: this .notificationTypes = Collections
37: .unmodifiableSet(notificationTypes);
38: }
39:
40: public String getName() {
41: return name;
42: }
43:
44: public Set getNotificationTypes() {
45: return notificationTypes;
46: }
47:
48: public String toString() {
49: return "[GNotificationInfo:" + " name=" + name
50: + " notificationTypes=" + notificationTypes + "]";
51: }
52:
53: public String toXML() {
54: String xml = "";
55:
56: xml += "<gNotificationInfo ";
57: xml += "name='" + name + "' ";
58: xml += ">";
59:
60: for (Iterator loop = notificationTypes.iterator(); loop
61: .hasNext();) {
62: xml += "<notificationType>" + loop.next().toString()
63: + "</notificationType>";
64: }
65:
66: xml += "</gNotificationInfo>";
67:
68: return xml;
69: }
70: }
|