KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > backend > DeployerFactory


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * DeployerFactory.java
26  *
27  * Created on December 11, 2001, 6:25 PM
28  */

29
30 package com.sun.enterprise.deployment.backend;
31
32 import com.sun.enterprise.util.i18n.StringManager;
33
34 /**
35  *
36  * @author bnevins
37  * @version
38  */

39 public class DeployerFactory
40 {
41     private static StringManager localStrings =
42         StringManager.getManager( DeployerFactory.class );
43
44     private DeployerFactory()
45     {
46     }
47     
48     ///////////////////////////////////////////////////////////////////////////
49

50     public static Deployer getDeployer(DeploymentRequest request) throws IASDeploymentException
51     {
52         assert request != null;
53         request.verify();
54         
55         if(request.isApplication())
56             return getAppDeployer(request);
57         else if(request.isEjbModule())
58             return new EjbModuleDeployer(request);
59         else if(request.isWebModule())
60             return new WebModuleDeployer(request);
61         else if(request.isConnectorModule())
62             return new ConnectorModuleDeployer(request);
63         else if (request.isAppClientModule())
64         {
65             if(request.isDirectory())
66             {
67                 String JavaDoc msg = localStrings.getStringWithDefault
68                 (
69                     "enterprise.deployment.backend.DirDeployOfAppClient",
70                     "App Client Directory-Deployment not supported"
71                 );
72                 throw new IASDeploymentException(msg);
73             }
74             else
75                 return new AppClientModuleDeployer(request);
76         }
77         else {
78             String JavaDoc msg = localStrings.getString(
79                     "enterprise.deployment.backend.deployment_not_supported" );
80             throw new IASDeploymentException( msg );
81         }
82     }
83     
84     ///////////////////////////////////////////////////////////////////////////
85

86     public static Deployer getAppDeployer(DeploymentRequest request) throws IASDeploymentException
87     {
88         if(request.isDeploy())
89         {
90             return new AppDeployer(request);
91         }
92         else if(request.isReDeploy())
93         {
94             return new AppReDeployer(request);
95         }
96         else if(request.isUnDeploy())
97         {
98             return new AppUnDeployer(request);
99         }
100         else {
101             String JavaDoc msg = localStrings.getString(
102             "enterprise.deployment.backend.unknown_deployment_request_type" );
103             throw new IASDeploymentException( msg );
104         }
105     }
106 }
107
Popular Tags