org.wildfly.extras.creaper.commands.foundation.online
Class CliFile

java.lang.Object
  extended by org.wildfly.extras.creaper.commands.foundation.online.CliFile
All Implemented Interfaces:
Command, OnlineCommand

public final class CliFile
extends Object
implements OnlineCommand

Apply a list of CLI operations (a CLI script) read from a file. The file is treated as UTF-8 text.

The connect operations in the script are handled specially: bare connect operations without arguments are simply ignored, as we are already connected, and connect host:port operations (with an argument that specifies the host and port to connect to) are considered a failure. The script is scanned for the forbidden connect operations before is it executed, so if this error happens, no operation from the script has been performed yet.


Constructor Summary
CliFile(Class clazz)
          Apply a CLI script from the classpath.
CliFile(File file)
          Apply a CLI script from the filesystem (file).
 
Method Summary
 void apply(OnlineCommandContext ctx)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CliFile

public CliFile(File file)
Apply a CLI script from the filesystem (file).

Parameters:
file - an existing file on the filesystem
Throws:
IllegalArgumentException - if file is null or the file doesn't exist

CliFile

public CliFile(Class clazz)
Apply a CLI script from the classpath. The script must be stored in a file with the same name as the clazz and have the .cli extension. On the classpath, the script file must live along the class file.

Parameters:
clazz - the class that will be used for loading the script and also for discovering its name
Throws:
IllegalArgumentException - if the clazz is null
Method Detail

apply

public void apply(OnlineCommandContext ctx)
           throws IOException,
                  CliException,
                  CommandFailedException
Specified by:
apply in interface OnlineCommand
Throws:
IOException
CliException
CommandFailedException

toString

public String toString()
Specified by:
toString in interface OnlineCommand
Overrides:
toString in class Object


Copyright © 2016. All rights reserved.