1 17 package org.apache.activemq.blob; 18 19 25 public class BlobTransferPolicy { 26 private String defaultUploadUrl = "http://localhost:8080/uploads/"; 27 private String brokerUploadUrl; 28 private String uploadUrl; 29 private int bufferSize = 128 * 1024; 30 private BlobUploadStrategy uploadStrategy; 31 32 35 public BlobTransferPolicy copy() { 36 BlobTransferPolicy that = new BlobTransferPolicy(); 37 that.defaultUploadUrl = this.defaultUploadUrl; 38 that.brokerUploadUrl = this.brokerUploadUrl; 39 that.uploadUrl = this.uploadUrl; 40 that.uploadStrategy = this.uploadStrategy; 41 return that; 42 } 43 44 public String getUploadUrl() { 45 if (uploadUrl == null) { 46 uploadUrl = getBrokerUploadUrl(); 47 if (uploadUrl == null) { 48 uploadUrl = getDefaultUploadUrl(); 49 } 50 } 51 return uploadUrl; 52 } 53 54 59 public void setUploadUrl(String uploadUrl) { 60 this.uploadUrl = uploadUrl; 61 } 62 63 public String getBrokerUploadUrl() { 64 return brokerUploadUrl; 65 } 66 67 70 public void setBrokerUploadUrl(String brokerUploadUrl) { 71 this.brokerUploadUrl = brokerUploadUrl; 72 } 73 74 public String getDefaultUploadUrl() { 75 return defaultUploadUrl; 76 } 77 78 82 public void setDefaultUploadUrl(String defaultUploadUrl) { 83 this.defaultUploadUrl = defaultUploadUrl; 84 } 85 86 public BlobUploadStrategy getUploadStrategy() { 87 if (uploadStrategy == null) { 88 uploadStrategy = createUploadStrategy(); 89 } 90 return uploadStrategy; 91 } 92 93 96 public void setUploadStrategy(BlobUploadStrategy uploadStrategy) { 97 this.uploadStrategy = uploadStrategy; 98 } 99 100 public int getBufferSize() { 101 return bufferSize; 102 } 103 104 107 public void setBufferSize(int bufferSize) { 108 this.bufferSize = bufferSize; 109 } 110 111 protected BlobUploadStrategy createUploadStrategy() { 112 return new DefaultBlobUploadStrategy(this); 113 } 114 } 115 | Popular Tags |