Package org.openstreetmap.josm.io
Class UploadStrategySpecification
- java.lang.Object
-
- org.openstreetmap.josm.io.UploadStrategySpecification
-
public class UploadStrategySpecification extends java.lang.Object
An UploadStrategySpecification consists of the parameter describing the strategy for uploading a collection ofOsmPrimitive.This includes:
- a decision on which
UploadStrategyto use - the upload chunk size
- whether to close the changeset used after the upload
- Since:
- 12687 (moved from
gui.iopackage)
- a decision on which
-
-
Field Summary
Fields Modifier and Type Field Description private intchunkSizeprivate booleancloseChangesetAfterUploadprivate MaxChangesetSizeExceededPolicypolicyprivate UploadStrategystrategystatic intUNSPECIFIED_CHUNK_SIZEindicates that the chunk size isn't specified
-
Constructor Summary
Constructors Constructor Description UploadStrategySpecification()Creates a new upload strategy with default values.UploadStrategySpecification(UploadStrategySpecification other)Clones another upload strategy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)intgetChunkSize()Gets the chunk sizeintgetNumRequests(int numObjects)Gets the number of requests that will be required to upload the objectsMaxChangesetSizeExceededPolicygetPolicy()Gets the policy that is used when the server max changeset size is exceeded.UploadStrategygetStrategy()Replies the upload strategystatic intgetUnspecifiedChunkSize()Gets a special value that is used to indicate that the chunk size was not specifiedinthashCode()booleanisCloseChangesetAfterUpload()Gets if the changeset should be closed after this uploadUploadStrategySpecificationsetChunkSize(int chunkSize)Sets the upload chunk sizeUploadStrategySpecificationsetCloseChangesetAfterUpload(boolean closeChangesetAfterUpload)Sets whether to close the changeset after this uploadUploadStrategySpecificationsetPolicy(MaxChangesetSizeExceededPolicy policy)Sets the policy to use when the max changeset size is exceededUploadStrategySpecificationsetStrategy(UploadStrategy strategy)Sets the upload strategy (chunk mode)java.lang.StringtoString()
-
-
-
Field Detail
-
UNSPECIFIED_CHUNK_SIZE
public static final int UNSPECIFIED_CHUNK_SIZE
indicates that the chunk size isn't specified- See Also:
- Constant Field Values
-
strategy
private UploadStrategy strategy
-
chunkSize
private int chunkSize
-
policy
private MaxChangesetSizeExceededPolicy policy
-
closeChangesetAfterUpload
private boolean closeChangesetAfterUpload
-
-
Constructor Detail
-
UploadStrategySpecification
public UploadStrategySpecification()
Creates a new upload strategy with default values.
-
UploadStrategySpecification
public UploadStrategySpecification(UploadStrategySpecification other)
Clones another upload strategy. If other is null, assumes default values.- Parameters:
other- the other upload strategy
-
-
Method Detail
-
getStrategy
public UploadStrategy getStrategy()
Replies the upload strategy- Returns:
- the upload strategy
-
getChunkSize
public int getChunkSize()
Gets the chunk size- Returns:
- The max size of each upload chunk
-
getUnspecifiedChunkSize
public static int getUnspecifiedChunkSize()
Gets a special value that is used to indicate that the chunk size was not specified- Returns:
- A special integer
-
getPolicy
public MaxChangesetSizeExceededPolicy getPolicy()
Gets the policy that is used when the server max changeset size is exceeded.- Returns:
- What to do when the changeset size is exceeded
-
setStrategy
public UploadStrategySpecification setStrategy(UploadStrategy strategy)
Sets the upload strategy (chunk mode)- Parameters:
strategy- The upload strategy- Returns:
- This object, for easy chaining
-
setChunkSize
public UploadStrategySpecification setChunkSize(int chunkSize)
Sets the upload chunk size- Parameters:
chunkSize- The chunk size- Returns:
- This object, for easy chaining
-
setPolicy
public UploadStrategySpecification setPolicy(MaxChangesetSizeExceededPolicy policy)
Sets the policy to use when the max changeset size is exceeded- Parameters:
policy- The policy- Returns:
- This object, for easy chaining
-
setCloseChangesetAfterUpload
public UploadStrategySpecification setCloseChangesetAfterUpload(boolean closeChangesetAfterUpload)
Sets whether to close the changeset after this upload- Parameters:
closeChangesetAfterUpload-trueto close it- Returns:
- This object, for easy chaining
-
isCloseChangesetAfterUpload
public boolean isCloseChangesetAfterUpload()
Gets if the changeset should be closed after this upload- Returns:
trueto close it
-
getNumRequests
public int getNumRequests(int numObjects)
Gets the number of requests that will be required to upload the objects- Parameters:
numObjects- The number of objects- Returns:
- The number of requests
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-