1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.module.launcher.application; |
12 | |
|
13 | |
import org.mule.api.registry.RegistrationException; |
14 | |
import org.mule.config.i18n.MessageFactory; |
15 | |
import org.mule.module.launcher.DeploymentInitException; |
16 | |
import org.mule.module.launcher.DeploymentService; |
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
public class PriviledgedMuleApplication extends DefaultMuleApplication |
22 | |
{ |
23 | |
|
24 | |
public static final String REGISTRY_KEY_DEPLOYMENT_SERVICE = "_deploymentService"; |
25 | |
|
26 | |
protected DeploymentService deploymentService; |
27 | |
|
28 | |
protected PriviledgedMuleApplication(String appName) |
29 | |
{ |
30 | 0 | super(appName); |
31 | 0 | } |
32 | |
|
33 | |
@Override |
34 | |
public void init() |
35 | |
{ |
36 | 0 | if (this.deploymentService == null) |
37 | |
{ |
38 | 0 | final String msg = String.format("Deployment service ref wasn't provided for priviledged app '%s'", getAppName()); |
39 | 0 | throw new DeploymentInitException(MessageFactory.createStaticMessage(msg)); |
40 | |
} |
41 | |
|
42 | 0 | super.init(); |
43 | |
try |
44 | |
{ |
45 | 0 | if (getDescriptor().isPriviledged()) |
46 | |
{ |
47 | 0 | getMuleContext().getRegistry().registerObject(REGISTRY_KEY_DEPLOYMENT_SERVICE, deploymentService); |
48 | |
} |
49 | |
} |
50 | 0 | catch (RegistrationException e) |
51 | |
{ |
52 | 0 | final String msg = String.format("Failed to init a priviledged app: [%s]", getDescriptor().getAppName()); |
53 | 0 | throw new DeploymentInitException(MessageFactory.createStaticMessage(msg), e); |
54 | 0 | } |
55 | 0 | } |
56 | |
|
57 | |
public void setDeploymentService(DeploymentService deploymentService) |
58 | |
{ |
59 | 0 | this.deploymentService = deploymentService; |
60 | 0 | } |
61 | |
} |