Skip to content

Commit

Permalink
0002327: Add an install method to the REST api that takes a propertie…
Browse files Browse the repository at this point in the history
…s file and installs it in the engines directory and starts the node
  • Loading branch information
chenson42 committed Jun 22, 2015
1 parent fd9746b commit 3938a67
Showing 1 changed file with 24 additions and 1 deletion.
Expand Up @@ -34,6 +34,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import javax.servlet.ServletContext;
Expand Down Expand Up @@ -300,7 +301,7 @@ public final NodeList getChildrenByEngine(@PathVariable("engine") String engineN
/**
* Takes a snapshot for this engine and streams it to the client. The result
* of this call is a stream that should be written to a zip file. The zip
* contains configuration and operational information about the installation
* contains configuration and operational information about the sureation
* and can be used to diagnose state of the node
*/
@ApiOperation(value = "Take a diagnostic snapshot for the single engine")
Expand Down Expand Up @@ -362,6 +363,28 @@ public final void getSnapshot(@PathVariable("engine") String engineName,
IOUtils.closeQuietly(bis);
}
}

/**
* Installs and starts a new node
*
* @param file
* A file stream that contains the node's properties.
*/
@ApiOperation(value = "Load a configuration file to the single engine")
@RequestMapping(value = "engine/install", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody
public final void postInstall(@RequestParam MultipartFile file) {
try {
Properties properties = new Properties();
properties.load(file.getInputStream());
getSymmetricEngineHolder().install(properties);
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}

/**
* Loads a configuration profile for the single engine on the node.
Expand Down

0 comments on commit 3938a67

Please sign in to comment.