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
UploadStrategy
to use - the upload chunk size
- whether to close the changeset used after the upload
- Since:
- 12687 (moved from
gui.io
package)
- a decision on which
-
-
Field Summary
Fields Modifier and Type Field Description private int
chunkSize
private boolean
closeChangesetAfterUpload
private MaxChangesetSizeExceededPolicy
policy
private UploadStrategy
strategy
static int
UNSPECIFIED_CHUNK_SIZE
indicates 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 boolean
equals(java.lang.Object obj)
int
getChunkSize()
Gets the chunk sizeint
getNumRequests(int numObjects)
Gets the number of requests that will be required to upload the objectsMaxChangesetSizeExceededPolicy
getPolicy()
Gets the policy that is used when the server max changeset size is exceeded.UploadStrategy
getStrategy()
Replies the upload strategystatic int
getUnspecifiedChunkSize()
Gets a special value that is used to indicate that the chunk size was not specifiedint
hashCode()
boolean
isCloseChangesetAfterUpload()
Gets if the changeset should be closed after this uploadUploadStrategySpecification
setChunkSize(int chunkSize)
Sets the upload chunk sizeUploadStrategySpecification
setCloseChangesetAfterUpload(boolean closeChangesetAfterUpload)
Sets whether to close the changeset after this uploadUploadStrategySpecification
setPolicy(MaxChangesetSizeExceededPolicy policy)
Sets the policy to use when the max changeset size is exceededUploadStrategySpecification
setStrategy(UploadStrategy strategy)
Sets the upload strategy (chunk mode)java.lang.String
toString()
-
-
-
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
-true
to close it- Returns:
- This object, for easy chaining
-
isCloseChangesetAfterUpload
public boolean isCloseChangesetAfterUpload()
Gets if the changeset should be closed after this upload- Returns:
true
to 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:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-