package org.onap.policy.apex.core.deployment;
-import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;
* The Class {@link BatchDeployer} deploys an Apex model held as an XML or Json file onto an Apex engine. It uses the
* EngDep protocol to communicate with the engine, with the EngDep protocol being carried on Java web sockets.
*
- * <p>This deployer is a simple command line deployer that reads the communication parameters and the location of the
- * Apex model file as arguments.
+ * <p>
+ * This deployer is a simple command line deployer that reads the communication parameters and the location of the Apex
+ * model file as arguments.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
try {
engineServiceFacade.init();
} catch (final ApexException e) {
- String errorMessage = "model deployment failed on parameters " + hostName + " " + port;
+ final String errorMessage = "model deployment failed on parameters " + hostName + " " + port;
LOGGER.error(errorMessage, e);
throw new ApexDeploymentException(errorMessage);
}
* @param ignoreConflicts true if conflicts between context in polices is to be ignored
* @param force true if the model is to be applied even if it is incompatible with the existing model
* @throws ApexException on Apex errors
- * @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force)
- throws ApexException {
+ throws ApexException {
engineServiceFacade.deployModel(modelFileName, ignoreConflicts, force);
}
* @param ignoreConflicts true if conflicts between context in polices is to be ignored
* @param force true if the model is to be applied even if it is incompatible with the existing model
* @throws ApexException on Apex errors
- * @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force)
- throws ApexException {
+ throws ApexException {
engineServiceFacade.deployModel(policyModel, ignoreConflicts, force);
}
/**
* Get the engine service facade of the event manager. This method is used for testing only.
- *
+ *
* @return the engine service facade
*/
protected EngineServiceFacade getEngineServiceFacade() {
*/
public static void main(final String[] args) throws ApexException {
if (args.length != NUM_ARGUMENTS) {
- String message = "invalid arguments: " + Arrays.toString(args)
- + "\nusage: BatchDeployer <server address> <port address> <model file path";
+ final String message = "invalid arguments: " + Arrays.toString(args)
+ + "\nusage: BatchDeployer <server address> <port address> <model file path";
LOGGER.error(message);
throw new ApexDeploymentException(message);
}
int port;
try {
port = Integer.parseInt(args[1]);
- } catch (NumberFormatException nfe) {
+ } catch (final NumberFormatException nfe) {
throw new ApexDeploymentException("argument port is invalid", nfe);
}
-
- BatchDeployer deployer = new BatchDeployer(args[0], port, System.out);
+
+ final BatchDeployer deployer = new BatchDeployer(args[0], port, System.out);
deployer.init();
deployer.deployModel(args[2], false, false);
deployer.close();