Last active
August 29, 2015 14:20
-
-
Save karanmalhi/febed0740872d1ed7881 to your computer and use it in GitHub Desktop.
Deployment Interceptor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import com.mulesoft.tcat.DeploymentInterceptor; | |
import com.mulesoft.tcat.Application; | |
import com.mulesoft.tcat.Deployment; | |
import com.mulesoft.tcat.DeploymentInterceptor; | |
import com.mulesoft.tcat.DeploymentVersion; | |
import com.mulesoft.tcat.Server; | |
def c = applicationContext | |
// copy into a local var, referenced in closure | |
def logger = log | |
def deploymentService = c.getBean("deploymentService"); | |
DeploymentInterceptor interceptor = new DeploymentInterceptor() { | |
public boolean intercept(DeploymentVersion deploymentVersion, | |
Server server, | |
Application application, | |
File expandedWarPath) { | |
try { | |
FileWriter writer = new FileWriter(new File(expandedWarPath, "test.txt")); | |
writer.write("hello"); | |
writer.close(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
return true; | |
} | |
}; | |
deploymentService.addDeploymentInterceptor(interceptor); | |
return "Interceptor added successfully" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment