KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > core > alert > AlertSourceFactory


1 /**
2 * Copyright (c) 2004-2005 jManage.org
3 *
4 * This is a free software; you can redistribute it and/or
5 * modify it under the terms of the license at
6 * http://www.jmanage.org.
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.jmanage.core.alert;
15
16 import org.jmanage.core.config.AlertSourceConfig;
17 import org.jmanage.core.alert.source.NotificationAlertSource;
18 import org.jmanage.core.alert.source.GaugeAlertSource;
19 import org.jmanage.core.alert.source.StringAlertSource;
20
21 /**
22  *
23  * Date: Jul 31, 2005
24  * @author Rakesh Kalra
25  */

26 public class AlertSourceFactory {
27
28     public static AlertSource getAlertSource(AlertSourceConfig sourceConfig) {
29         final String JavaDoc sourceType = sourceConfig.getSourceType();
30         if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_NOTIFICATION)){
31             return new NotificationAlertSource(sourceConfig);
32         }else if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR)){
33             return new GaugeAlertSource(sourceConfig);
34         }else if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR)){
35             return new StringAlertSource(sourceConfig);
36         }
37         assert false:"Unknown alert source type: " + sourceType;
38         return null;
39     }
40 }
41
Popular Tags