org.n0pe.asadmin
Class AbstractAsAdminCmd

java.lang.Object
  extended by org.n0pe.asadmin.AbstractAsAdminCmd
All Implemented Interfaces:
IAsAdminCmd
Direct Known Subclasses:
AddResources, Cluster, CreateAuthRealm, CreateFileUser, CreateJdbcConnectionPool, CreateJdbcResource, CreateMessageSecurityProvider, Database, DeleteFileUser, DeleteJdbcConnectionPool, DeleteJdbcResource, DeleteMessageSecurityProvider, Deployment, Domain, EnableSecureAdmin, Get, GetHealth, ListApplicationRefs, ListDomains, ListFileUsers, PingConnectionPool, Set, UpdateFileUser, Uptime

public abstract class AbstractAsAdminCmd
extends Object
implements IAsAdminCmd


Field Summary
static String[] EMPTY_ARRAY
           
 
Constructor Summary
AbstractAsAdminCmd()
           
 
Method Summary
 boolean failOnNonZeroExit()
          If asadmin command return is non zero the command will be given the change to say whether they wish to fail based on the contents of stdout and stderr they have been passed.
 Reader getErrorOutput()
           
 Reader getStandardOutput()
           
 String handlePasswordFile(String configuredPasswordFile)
          Hooks called by AsAdmin to allow commands to impact the configured password file.
 void setOkayErrorPattern(Pattern pattern)
          Pass a Pattern which can be used to match the stderr output if the asadmin exits with a non zero value.
 void setOkayStdOutPattern(Pattern pattern)
          Pass a Pattern which can be used to match the stdout output if the asadmin exits with a non zero value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.n0pe.asadmin.IAsAdminCmd
getActionCommand, getParameters, needCredentials
 

Field Detail

EMPTY_ARRAY

public static final String[] EMPTY_ARRAY
Constructor Detail

AbstractAsAdminCmd

public AbstractAsAdminCmd()
Method Detail

getStandardOutput

public final Reader getStandardOutput()
Specified by:
getStandardOutput in interface IAsAdminCmd

getErrorOutput

public final Reader getErrorOutput()
Specified by:
getErrorOutput in interface IAsAdminCmd

failOnNonZeroExit

public boolean failOnNonZeroExit()
Description copied from interface: IAsAdminCmd
If asadmin command return is non zero the command will be given the change to say whether they wish to fail based on the contents of stdout and stderr they have been passed. For example a DeployMojo executing an undeploy command which has failOnCommandSpecificErrors set to false will elect not to fail if the error output was along the lines of "remote failure: Application my-ear is not deployed on this target [server]" during an mvn clean or testing cycle...

Specified by:
failOnNonZeroExit in interface IAsAdminCmd
Returns:
whether this command should cause the plugin to fail, or whether it is acceptable to continue.

setOkayErrorPattern

public void setOkayErrorPattern(Pattern pattern)
Description copied from interface: IAsAdminCmd
Pass a Pattern which can be used to match the stderr output if the asadmin exits with a non zero value. If the Pattern matches the stderr output (multiline) the plugin will not throw an exception but just log the fact that it is continuing

Specified by:
setOkayErrorPattern in interface IAsAdminCmd

setOkayStdOutPattern

public void setOkayStdOutPattern(Pattern pattern)
Description copied from interface: IAsAdminCmd
Pass a Pattern which can be used to match the stdout output if the asadmin exits with a non zero value. If the Pattern matches the stdout output (multiline) the plugin will not throw an exception but just log the fact that it is continuing This is necessary as some asadmin subcommands cause it to exit with non zero, but it writes the error to stdout. start-domain writes its output there. If setOkayErrorPattern is not set then only setOkayStdOutPattern will be checked, which by default determines the value returned by failOnNonZeroExit If setOkayErrorPattern is set and setOkayStdOutPattern is not set then only setOkayErrorPattern will determine what failOnNonZeroExit returns If setOkayErrorPattern is set and setOkayStdOutPattern is set then BOTH setOkayErrorPattern and setOkayStdOutPattern must match if failOnNonZeroExit is to return false

Specified by:
setOkayStdOutPattern in interface IAsAdminCmd

handlePasswordFile

public String handlePasswordFile(String configuredPasswordFile)
                          throws AsAdminException
Description copied from interface: IAsAdminCmd
Hooks called by AsAdmin to allow commands to impact the configured password file.

Specified by:
handlePasswordFile in interface IAsAdminCmd
Parameters:
configuredPasswordFile - Configured password file
Returns:
Password file, same or changed if needed
Throws:
AsAdminException


Copyright © 2013. All Rights Reserved.