public abstract class HttpDeployer extends Object implements Deployer
Deployers that use HTTP
as a file transfer mechanism.
Copyright (c) 2015. All Rights Reserved. Oracle Corporation.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpDeployer.ArtifactsHandler
A
HttpHandler implementation that serves a list
of DeploymentArtifacts as files. |
static class |
HttpDeployer.BufferSize
An
Option for the HttpDeployer.BufferSize. |
| Constructor and Description |
|---|
HttpDeployer(com.oracle.bedrock.Option... options)
Create a new
HttpDeployer. |
| Modifier and Type | Method and Description |
|---|---|
protected ExecutorService |
createExecutor()
Create the
Executor that will be used by the HttpServer
that this deployer runs. |
protected com.sun.net.httpserver.HttpServer |
createServer(ExecutorService executor,
Map<String,DeploymentArtifact> artifacts)
Start the HTTP server that will be used to serve the artifacts
to be deployed.
|
static HttpDeployer |
curl(com.oracle.bedrock.Option... options)
A static helper method to return an
HttpDeployer
that will use wget to retrieve artifacts. |
static HttpDeployer |
curlAt(String curlLocation,
com.oracle.bedrock.Option... options)
A static helper method to return an
HttpDeployer
that will use wget to retrieve artifacts. |
DeployedArtifacts |
deploy(List<DeploymentArtifact> artifactsToDeploy,
String remoteDirectory,
Platform platform,
com.oracle.bedrock.Option... deploymentOptions)
Deploy the list of
DeploymentArtifacts to the specified Platform, returning the
DeployedArtifacts representing the actual Files deployed and their location. |
protected void |
deployAllArtifacts(Map<String,DeploymentArtifact> artifacts,
String remoteDirectory,
Platform platform,
InetSocketAddress httpServerAddress,
com.oracle.bedrock.OptionsByType optionsByType,
DeployedArtifacts deployedArtifacts)
Deploy the all of the specified
DeploymentArtifacts. |
protected abstract void |
deployArtifact(URL sourceURL,
String targetFileName,
Platform platform)
Deploy the specified artifact.
|
DeployedArtifacts |
undeploy(DeployedArtifacts deployedArtifacts,
Platform platform,
com.oracle.bedrock.Option... deploymentOptions)
Undeploy the
DeployedArtifacts on the specified Platform, returning the
DeployedArtifacts that were not undeployed successfully. |
static HttpDeployer |
wget(com.oracle.bedrock.Option... options)
A static helper method to return an
HttpDeployer
that will use wget to retrieve artifacts. |
static HttpDeployer |
wgetAt(String wgetLocation,
com.oracle.bedrock.Option... options)
A static helper method to return an
HttpDeployer
that will use wget to retrieve artifacts. |
HttpDeployer |
withBufferSize(int size)
Set the size of the byte buffer that will be used to
send the response of a HTTP request.
|
HttpDeployer |
withBufferSizeInKB(int size)
Set the size of the byte buffer that will be used to
send the response of a HTTP request.
|
HttpDeployer |
withBufferSizeInMB(int size)
Set the size of the byte buffer that will be used to
send the response of a HTTP request.
|
public HttpDeployer(com.oracle.bedrock.Option... options)
HttpDeployer.options - the Options controlling this HttpDeployerpublic HttpDeployer withBufferSize(int size)
size - the size of the buffer in bytesHttpDeployer to allow a fluent method stylepublic HttpDeployer withBufferSizeInKB(int size)
size - the size of the buffer in kilo-bytesHttpDeployer to allow a fluent method stylepublic HttpDeployer withBufferSizeInMB(int size)
size - the size of the buffer in mega-bytesHttpDeployer to allow a fluent method stylepublic static HttpDeployer wget(com.oracle.bedrock.Option... options)
HttpDeployer
that will use wget to retrieve artifacts.options - the OptionsByTypeHttpDeployerpublic static HttpDeployer wgetAt(String wgetLocation, com.oracle.bedrock.Option... options)
HttpDeployer
that will use wget to retrieve artifacts.wgetLocation - the location of the wget executable
(for example "/usr/local/bin/wget")options - the Options controlling the deployerHttpDeployerpublic static HttpDeployer curl(com.oracle.bedrock.Option... options)
HttpDeployer
that will use wget to retrieve artifacts.options - the Options controlling the deployerHttpDeployerpublic static HttpDeployer curlAt(String curlLocation, com.oracle.bedrock.Option... options)
HttpDeployer
that will use wget to retrieve artifacts.curlLocation - the location of the curl executable
(for example "/usr/local/bin/curl")options - the Options controlling the deployerHttpDeployerpublic DeployedArtifacts deploy(List<DeploymentArtifact> artifactsToDeploy, String remoteDirectory, Platform platform, com.oracle.bedrock.Option... deploymentOptions)
DeployerDeploymentArtifacts to the specified Platform, returning the
DeployedArtifacts representing the actual Files deployed and their location.deploy in interface DeployerartifactsToDeploy - the DeploymentArtifacts to deployremoteDirectory - the target directory to deploy the DeploymentArtifacts to if no
destination is specified for a DeploymentArtifactplatform - the target Platform to deploy the DeploymentArtifacts todeploymentOptions - the Options that can be applied to control the deploymentDeployedArtifactsprotected void deployAllArtifacts(Map<String,DeploymentArtifact> artifacts, String remoteDirectory, Platform platform, InetSocketAddress httpServerAddress, com.oracle.bedrock.OptionsByType optionsByType, DeployedArtifacts deployedArtifacts)
DeploymentArtifacts.artifacts - a Map of DeploymentArtifacts to deploy
keyed by the URL path for each artifactremoteDirectory - the remote directory to deploy toplatform - the remote Platform to deploy tohttpServerAddress - the InetSocketAddress the HTTP server is listening onoptionsByType - the OptionsByTypes to usedeployedArtifacts - the DeployedArtifactspublic DeployedArtifacts undeploy(DeployedArtifacts deployedArtifacts, Platform platform, com.oracle.bedrock.Option... deploymentOptions)
DeployerDeployedArtifacts on the specified Platform, returning the
DeployedArtifacts that were not undeployed successfully.undeploy in interface DeployerdeployedArtifacts - the DeployedArtifacts to undeployplatform - the PlatformdeploymentOptions - the Options used for deployment and undeploymentDeployedArtifacts that were failed to undeployprotected ExecutorService createExecutor()
Executor that will be used by the HttpServer
that this deployer runs.
If a specific implementation of HttpDeployer will perform
parallel HTTP requests then it should use an Executor to provide
multiple threads to the HttpServer. If the deployer only deploys
artifacts one at a time then it can return null from this method.Executor to use for parallel deployments or null
if performing single threaded deployments.protected abstract void deployArtifact(URL sourceURL, String targetFileName, Platform platform)
sourceURL - the HTTP URL to download the artifact fromtargetFileName - the target file name to download the artifact toplatform - the remote Platform to download the artifact onprotected com.sun.net.httpserver.HttpServer createServer(ExecutorService executor, Map<String,DeploymentArtifact> artifacts)
executor - the Executor to pass to the HttpServerartifacts - a Map of DeploymentArtifacts to deploy
keyed by the URL path for each artifactHttpServerCopyright © 2017. All rights reserved.