1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.module.launcher.application; |
8 | |
|
9 | |
import org.mule.module.launcher.AppBloodhound; |
10 | |
import org.mule.module.launcher.DefaultAppBloodhound; |
11 | |
import org.mule.module.launcher.DeploymentService; |
12 | |
import org.mule.module.launcher.descriptor.ApplicationDescriptor; |
13 | |
|
14 | |
import java.io.IOException; |
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
public class ApplicationFactory |
21 | |
{ |
22 | |
protected DeploymentService deploymentService; |
23 | |
|
24 | |
public ApplicationFactory(DeploymentService deploymentService) |
25 | 0 | { |
26 | 0 | this.deploymentService = deploymentService; |
27 | 0 | } |
28 | |
|
29 | |
public Application createApp(String appName) throws IOException |
30 | |
{ |
31 | 0 | AppBloodhound bh = new DefaultAppBloodhound(); |
32 | 0 | final ApplicationDescriptor descriptor = bh.fetch(appName); |
33 | 0 | if (descriptor.isPriviledged()) |
34 | |
{ |
35 | 0 | final PriviledgedMuleApplication delegate = new PriviledgedMuleApplication(appName); |
36 | 0 | delegate.setDeploymentService(deploymentService); |
37 | 0 | return new ApplicationWrapper(delegate); |
38 | |
} |
39 | |
else |
40 | |
{ |
41 | 0 | return new ApplicationWrapper(new DefaultMuleApplication(appName)); |
42 | |
} |
43 | |
} |
44 | |
} |