Class ExternalSystem
- java.lang.Object
-
- org.openbravo.service.externalsystem.ExternalSystem
-
- Direct Known Subclasses:
HttpExternalSystem
public abstract class ExternalSystem extends Object
Used to define the communication with an external system. Classes extending this class must be annotated withProtocol
to declare the communication protocol it uses. The class must be used to retrieve instances of this class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExternalSystem.Operation
Operations that can be applied in the external system when sending the information
-
Constructor Summary
Constructors Constructor Description ExternalSystem()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
configure(ExternalSystemData configuration)
Configures the external system instance with the provided configuration.protected ExternalSystem.Operation
getDefaultOperation()
protected String
getName()
CompletableFuture<ExternalSystemResponse>
send(Supplier<? extends InputStream> payloadSupplier)
Sends information to the external system with the default operation.CompletableFuture<ExternalSystemResponse>
send(ExternalSystem.Operation operation, String path)
Sends information to the external system using the provided operation and path but without using a payload supplier nor additional configuration.CompletableFuture<ExternalSystemResponse>
send(ExternalSystem.Operation operation, String path, Map<String,Object> configuration)
Sends information to the external system using the provided operation, path and configuration but without using a payload supplier.CompletableFuture<ExternalSystemResponse>
send(ExternalSystem.Operation operation, Supplier<? extends InputStream> payloadSupplier)
Sends information to the external system using the provided operation and payload supplier but without using a path nor additional configuration.CompletableFuture<ExternalSystemResponse>
send(ExternalSystem.Operation operation, Supplier<? extends InputStream> payloadSupplier, String path)
Sends information to the external system using the provided operation, payload supplier and path but without using additional configuration.abstract CompletableFuture<ExternalSystemResponse>
send(ExternalSystem.Operation operation, Supplier<? extends InputStream> payloadSupplier, String path, Map<String,Object> configuration)
Sends information to the external systemCompletableFuture<ExternalSystemResponse>
send(ExternalSystem.Operation operation, Map<String,Object> configuration)
Sends information to the external system using the provided operation and configuration but without using a payload supplier nor a path.
-
-
-
Method Detail
-
send
public abstract CompletableFuture<ExternalSystemResponse> send(ExternalSystem.Operation operation, Supplier<? extends InputStream> payloadSupplier, String path, Map<String,Object> configuration)
Sends information to the external system- Parameters:
operation
- The operation to be applied in the external system with the sent informationpayloadSupplier
- A supplier of the input stream with the data to be sentpath
- An optional sequence of segments separated by a slash (/) that be appended to the base external system URI where the information will be eventually sent. It can be null if not needed.configuration
- Additional information used to configure the send operation- Returns:
- a CompletableFuture
containing the response data coming from the external system
-
send
public final CompletableFuture<ExternalSystemResponse> send(Supplier<? extends InputStream> payloadSupplier)
Sends information to the external system with the default operation.- Parameters:
payloadSupplier
- A supplier of the input stream with the data to be sent- Returns:
- a CompletableFuture
containing the response data coming from the external system - See Also:
getDefaultOperation()
-
getDefaultOperation
protected ExternalSystem.Operation getDefaultOperation()
- Returns:
- the operation used by default when invoking the
send(Supplier)
method
-
send
public final CompletableFuture<ExternalSystemResponse> send(ExternalSystem.Operation operation, Supplier<? extends InputStream> payloadSupplier, String path)
Sends information to the external system using the provided operation, payload supplier and path but without using additional configuration.- See Also:
send(Operation, Supplier, String, Map)
-
send
public final CompletableFuture<ExternalSystemResponse> send(ExternalSystem.Operation operation, Supplier<? extends InputStream> payloadSupplier)
Sends information to the external system using the provided operation and payload supplier but without using a path nor additional configuration.- See Also:
send(Operation, Supplier, String)
-
send
public final CompletableFuture<ExternalSystemResponse> send(ExternalSystem.Operation operation, String path)
Sends information to the external system using the provided operation and path but without using a payload supplier nor additional configuration.- See Also:
send(Operation, String, Map)
-
send
public final CompletableFuture<ExternalSystemResponse> send(ExternalSystem.Operation operation, Map<String,Object> configuration)
Sends information to the external system using the provided operation and configuration but without using a payload supplier nor a path.- See Also:
send(Operation, String, Map)
-
send
public final CompletableFuture<ExternalSystemResponse> send(ExternalSystem.Operation operation, String path, Map<String,Object> configuration)
Sends information to the external system using the provided operation, path and configuration but without using a payload supplier.- See Also:
send(Operation, Supplier, String, Map)
-
configure
protected void configure(ExternalSystemData configuration)
Configures the external system instance with the provided configuration. The extensions of this class must use this method to initialize their own configuration fields.- Parameters:
configuration
- Provides the configuration data of the external system- Throws:
ExternalSystemConfigurationError
- in case the external system cannot be properly configured
-
getName
protected String getName()
- Returns:
- the name of the external system
-
-