KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jdon > bussinessproxy > ServiceClientFactory


1 /**
2  * Copyright 2003-2006 the original author or authors.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6
7        http://www.apache.org/licenses/LICENSE-2.0
8
9   * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */

15
16 package com.jdon.bussinessproxy;
17
18 import com.jdon.util.Debug;
19 import com.jdon.bussinessproxy.remote.auth.AuthException;
20 import com.jdon.bussinessproxy.remote.http.HttpServerParam;
21 /**
22  *
23  * 远程客户端调用本类,通过具体实现进行http访问主机。
24  *
25  * @author banq
26  */

27 public abstract class ServiceClientFactory {
28
29   private final static String JavaDoc module = ServiceClientFactory.class.getName();
30
31   private static Object JavaDoc initLock = new Object JavaDoc();
32   private static String JavaDoc className =
33       "com.jdon.bussinessproxy.remote.ServiceHTTPImp";
34   private static ServiceClientFactory factory = null;
35
36   public static ServiceClientFactory getInstance() {
37     if (factory == null) {
38       synchronized (initLock) {
39         if (factory == null) {
40           try {
41             //Load the class and create an instance.
42
Class JavaDoc c = Class.forName(className);
43             factory = (ServiceClientFactory) c.newInstance();
44           } catch (Exception JavaDoc e) {
45             Debug.logError("[JdonFramework] get factory instance error:" + e, module);
46             return null;
47           }
48         }
49       }
50     }
51     return factory;
52   }
53
54   public abstract void setHttpServerParam(HttpServerParam httpServerParam);
55
56   public abstract String JavaDoc login(String JavaDoc loginName, String JavaDoc password) throws AuthException;
57
58   public abstract Object JavaDoc getService(TargetMetaDef targetMetaDef);
59
60
61
62
63 }
64
Popular Tags