Package org.alfresco.repo.transfer
Class HttpClientTransmitterImpl
- java.lang.Object
-
- org.alfresco.repo.transfer.HttpClientTransmitterImpl
-
- All Implemented Interfaces:
TransferTransmitter
public class HttpClientTransmitterImpl extends java.lang.Object implements TransferTransmitter
HTTP implementation of TransferTransmitter. Sends data via HTTP to the server.- Author:
- brian
-
-
Constructor Summary
Constructors Constructor Description HttpClientTransmitterImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Transfer transfer)Abort the transferTransferbegin(TransferTarget target, java.lang.String fromRepositoryId, TransferVersion fromVersion)Begin a transfer, the transfer object returned will be used by subsequent calls to the transfer service.voidcommit(Transfer transfer)ContentServicegetContentService()protected org.apache.commons.httpclient.methods.PostMethodgetPostMethod()TransferProgressgetStatus(Transfer transfer)Get the status of an in process transfervoidgetTransferReport(Transfer transfer, java.io.OutputStream result)Get the destination side transfer report from the destination and write it to the specified output stream.voidinit()voidprepare(Transfer transfer)voidsendContent(Transfer transfer, java.util.Set<org.alfresco.service.cmr.repository.ContentData> data)Send the content of the specified urlsvoidsendManifest(Transfer transfer, java.io.File manifest, java.io.OutputStream result)voidsetContentService(ContentService contentService)voidsetHttpClient(org.apache.commons.httpclient.HttpClient httpClient)By default, this class uses a plain HttpClient instance with the only non-default option being the multi-threaded connection manager.voidsetHttpMethodFactory(HttpMethodFactory httpMethodFactory)voidsetHttpsSocketFactory(org.apache.commons.httpclient.protocol.ProtocolSocketFactory socketFactory)By default this class uses the standard SSLProtocolSocketFactory, but this method allows this to be overridden.voidsetIsAuthenticationPreemptive(boolean isAuthenticationPreemptive)Whether httpClient will use preemptive authentication or not.voidsetJsonErrorSerializer(JsonSerializer<java.lang.Throwable,org.json.JSONObject> jsonErrorSerializer)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidverifyTarget(TransferTarget target)Verify that the target is available
-
-
-
Method Detail
-
init
public void init()
-
setHttpsSocketFactory
public void setHttpsSocketFactory(org.apache.commons.httpclient.protocol.ProtocolSocketFactory socketFactory)
By default this class uses the standard SSLProtocolSocketFactory, but this method allows this to be overridden. Useful if, for example, one wishes to permit support of self-signed certificates on the target.- Parameters:
socketFactory- ProtocolSocketFactory
-
setHttpClient
public void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
By default, this class uses a plain HttpClient instance with the only non-default option being the multi-threaded connection manager. Use this method to replace this with your own HttpClient instance configured how you wish- Parameters:
httpClient- HttpClient
-
setIsAuthenticationPreemptive
public void setIsAuthenticationPreemptive(boolean isAuthenticationPreemptive)
Whether httpClient will use preemptive authentication or not.- Parameters:
isAuthenticationPreemptive- boolean
-
verifyTarget
public void verifyTarget(TransferTarget target) throws TransferException
Description copied from interface:TransferTransmitterVerify that the target is available- Specified by:
verifyTargetin interfaceTransferTransmitter- Parameters:
target- TransferTarget- Throws:
TransferException
-
begin
public Transfer begin(TransferTarget target, java.lang.String fromRepositoryId, TransferVersion fromVersion) throws TransferException
Description copied from interface:TransferTransmitterBegin a transfer, the transfer object returned will be used by subsequent calls to the transfer service.- Specified by:
beginin interfaceTransferTransmitter- Parameters:
target- definition of where to transfer to.fromRepositoryId- the repositoryID of the sending systemfromVersion- the version of the repository sending- Returns:
- the transfer object or null if the target cannot be locked.
- Throws:
TransferException
-
sendManifest
public void sendManifest(Transfer transfer, java.io.File manifest, java.io.OutputStream result) throws TransferException
- Specified by:
sendManifestin interfaceTransferTransmitter- Parameters:
transfer- the transfer object returned by an earlier call to beginmanifest- the transfer manifest fileresult- - where to write the results, probably a temporary file the output steam should be open and will be closed before the method returns.- Throws:
TransferException
-
abort
public void abort(Transfer transfer) throws TransferException
Description copied from interface:TransferTransmitterAbort the transfer- Specified by:
abortin interfaceTransferTransmitter- Parameters:
transfer- the transfer object returned by an earlier call to begin- Throws:
TransferException
-
commit
public void commit(Transfer transfer) throws TransferException
- Specified by:
commitin interfaceTransferTransmitter- Parameters:
transfer- the transfer object returned by an earlier call to begin- Throws:
TransferException
-
prepare
public void prepare(Transfer transfer) throws TransferException
- Specified by:
preparein interfaceTransferTransmitter- Parameters:
transfer- the transfer object returned by an earlier call to begin- Throws:
TransferException
-
sendContent
public void sendContent(Transfer transfer, java.util.Set<org.alfresco.service.cmr.repository.ContentData> data) throws TransferException
Description copied from interface:TransferTransmitterSend the content of the specified urls- Specified by:
sendContentin interfaceTransferTransmitter- Parameters:
transfer- the transfer object returned by an earlier call to begindata- the content to send- Throws:
TransferException
-
getStatus
public TransferProgress getStatus(Transfer transfer) throws TransferException
Description copied from interface:TransferTransmitterGet the status of an in process transfer- Specified by:
getStatusin interfaceTransferTransmitter- Throws:
TransferException
-
getTransferReport
public void getTransferReport(Transfer transfer, java.io.OutputStream result)
Description copied from interface:TransferTransmitterGet the destination side transfer report from the destination and write it to the specified output stream.The result stream will be closed.
- Specified by:
getTransferReportin interfaceTransferTransmitter- Parameters:
transfer- the transfer object returned by an earlier call to beginresult- - where to write the contents of the transfer report.
-
getPostMethod
protected org.apache.commons.httpclient.methods.PostMethod getPostMethod()
-
setContentService
public void setContentService(ContentService contentService)
-
getContentService
public ContentService getContentService()
-
setHttpMethodFactory
public void setHttpMethodFactory(HttpMethodFactory httpMethodFactory)
-
setJsonErrorSerializer
public void setJsonErrorSerializer(JsonSerializer<java.lang.Throwable,org.json.JSONObject> jsonErrorSerializer)
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
-
-