01: /*
02: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: //
07: package com.sun.portal.ffj.deploy;
08:
09: import com.sun.portal.ffj.util.ParEntry;
10:
11: import org.openide.TopManager;
12: import org.openide.ErrorManager;
13:
14: public class DeployFactory {
15: //
16: private static String DEPLOY_PACKAGE_NAME = null;
17: private static final String SUFFIX = "Deploy";
18: private static String DEFAULT_DEPLOY = null;
19:
20: //
21: static {
22: DeployFactory df = new DeployFactory();
23: DEPLOY_PACKAGE_NAME = df.getClass().getPackage().getName();
24:
25: DEFAULT_DEPLOY = DEPLOY_PACKAGE_NAME + Deploy.PACKAGE_SEPARATOR
26: + "JavaProvider" + SUFFIX;
27: }
28:
29: //
30: //
31: //
32: public static Deploy getDeployInstance(ParEntry pe) {
33: //
34: String method = "getDeployInstance: ";
35: String providerClass = pe.getProviderClass();
36:
37: int index = providerClass.lastIndexOf(Deploy.PACKAGE_SEPARATOR);
38: String deployClass = providerClass.substring(index + 1);
39: deployClass += SUFFIX;
40: deployClass = DEPLOY_PACKAGE_NAME + Deploy.PACKAGE_SEPARATOR
41: + deployClass;
42:
43: //
44: try {
45: // The deploy can be for JSPProvider extension.
46: return (Deploy) Class.forName(deployClass).newInstance();
47: } catch (Exception e) {
48: TopManager.getDefault().getErrorManager().notify(
49: ErrorManager.INFORMATIONAL, e);
50: }
51:
52: try {
53: return (Deploy) Class.forName(DEFAULT_DEPLOY).newInstance();
54: } catch (Exception e) {
55: TopManager.getDefault().getErrorManager().notify(
56: ErrorManager.ERROR, e);
57: return null;
58: }
59: }
60: }
|