public abstract class AbstractGradleServerProtocol extends Object implements ProcessLauncherServer.Protocol
| Modifier and Type | Class and Description |
|---|---|
class |
AbstractGradleServerProtocol.MyExecutionInfo |
| Modifier and Type | Field and Description |
|---|---|
protected MessageObject |
lastMessageReceived |
protected ProcessLauncherServer |
server |
| Constructor and Description |
|---|
AbstractGradleServerProtocol(File currentDirectory,
File gradleHomeDirectory,
File customGradleExecutor,
String fullCommandLine,
LogLevel logLevel,
ShowStacktrace stackTraceLevel) |
| Modifier and Type | Method and Description |
|---|---|
void |
aboutToKillProcess() |
protected abstract void |
addStatus(String status)
Notification of any status that might be helpful to the user.
|
void |
clientCommunicationStopped()
Notification that the client has stopped all communications.
|
void |
clientExited(int returnCode,
String output)
Notification that the client has shutdown.
|
protected void |
closeConnection()
Call this to stop communication
|
void |
connectionAccepted()
Notification that the connection was accepted by the client.
|
boolean |
continueConnection() |
protected File |
extractInitScriptFile(Class resourceClass,
String resourceName)
If you do have an init script that's a resource, this will extract it based on the name and write it to a temporary file and delete it on exit.
|
boolean |
extractResourceAsFile(Class resourceClass,
String name,
File file)
This extracts the given class' resource to the specified file if it doesn't already exist.
|
ExecutionInfo |
getExecutionInfo(int serverPort)
Fill in the ExecutionInfo object with information needed to execute the other process.
|
protected File |
getGradleExecutableFile() |
protected File |
getGradleHomeDirectory() |
abstract File |
getInitScriptFile()
This is called before we execute a command.
|
protected abstract boolean |
handleMessageReceived(MessageObject message)
Notification that a message was received that we didn't process.
|
protected void |
handShakeCompleted()
This provides you with a chance to do something when the handshaking is complete
|
void |
initialize(ProcessLauncherServer server)
Gives your protocol a chance to store this server so it can access its functions.
|
void |
killGradle() |
void |
messageReceived(MessageObject message)
Notification that a message has been received.
|
void |
readFailureOccurred()
Notification that a read failure occurred.
|
protected abstract void |
reportClientExit(boolean wasPremature,
int returnCode,
String output)
This is called if the client exits prematurely.
|
void |
setHasReceivedBuildCompleteNotification()
Call this to mark the build as completed (whether successfully or not).
|
protected ProcessLauncherServer server
protected MessageObject lastMessageReceived
public boolean continueConnection()
continueConnection in interface Server.Protocol<ProcessLauncherServer>public void connectionAccepted()
connectionAccepted in interface Server.Protocol<ProcessLauncherServer>public void initialize(ProcessLauncherServer server)
initialize in interface Server.Protocol<ProcessLauncherServer>protected void closeConnection()
public void messageReceived(MessageObject message)
messageReceived in interface Server.Protocol<ProcessLauncherServer>message - the message that was received.protected void handShakeCompleted()
protected abstract boolean handleMessageReceived(MessageObject message)
message - the message we received.public void setHasReceivedBuildCompleteNotification()
protected abstract void addStatus(String status)
status - a status messagepublic ExecutionInfo getExecutionInfo(int serverPort)
getExecutionInfo in interface ProcessLauncherServer.ProtocolserverPort - the port the server is listening on. The client should send messages hereprotected File getGradleExecutableFile()
public void clientCommunicationStopped()
clientCommunicationStopped in interface Server.Protocol<ProcessLauncherServer>public void clientExited(int returnCode,
String output)
clientExited in interface ProcessLauncherServer.ProtocolreturnCode - the return code of the client applicationoutput - the standard error and standard output of the client applicationprotected abstract void reportClientExit(boolean wasPremature,
int returnCode,
String output)
returnCode - the return code of the applicationpublic abstract File getInitScriptFile()
protected File extractInitScriptFile(Class resourceClass, String resourceName)
resourceClass - the class associated with the resourceresourceName - the name (minus extension or '.') of the resourcepublic boolean extractResourceAsFile(Class resourceClass, String name, File file)
resourceClass - the class associated with the resourcename - the resource's namefile - where to put the resourceprotected File getGradleHomeDirectory()
public void readFailureOccurred()
readFailureOccurred in interface Server.Protocol<ProcessLauncherServer>public void aboutToKillProcess()
aboutToKillProcess in interface ProcessLauncherServer.Protocolpublic void killGradle()
Copyright © 2013. All rights reserved