CloudConnector
, OnPremConnector
public abstract class Connector extends Object
Imports can be carried out using the import* methods such as importConfiguration(java.io.InputStream, String)
.
Exports can in a similar manner be done with the export* methods such as exportConfiguration()
.
The XML data formats are documented in the section Importing data on Apptus Zone (http://zone.apptus.com).
The format for configuration and panels isn't documented publicly. They are generated by eSales Manager and these exports and
imports should be used for backup and migration only. Manually editing these files isn't supported and should not be done.
The procedure for imports can be found in the eSales tutorial on Apptus Zone (http://zone.apptus.com).
Use the session(String, String, String)
method to get Session
instances. These are used to notify eSales and query panels.
View the Session documentation for details.
Modifier and Type | Class | Description |
---|---|---|
protected static class |
Connector.ConnectorKey |
Modifier and Type | Method | Description |
---|---|---|
List<String> |
availableMarkets() |
Returns a list of available markets from the eSales cluster.
|
EventDataJobResult |
checkCustomerDataJobStatus(String jid) |
Check the status of a GDPR customer data job.
|
EventDataJobResult |
createExportCustomerDataJob(String customerKey) |
Start a GDPR job on the cluster to export all data related to the given customer key.
|
EventDataJobResult |
createRemoveCustomerDataJob(String customerKey) |
Start a GDPR job on the cluster to remove all data related to the given customer key.
|
InputStream |
downloadExportCustomerDataJobResult(String jid) |
Download the result of a GDPR export customer data job.
|
long |
downloadExportCustomerDataJobResult(String jid,
File destination) |
Download the result of a GDPR export customer data job.
|
InputStream |
exportAds() |
Exports ads from the eSales cluster as a full XML update document.
|
long |
exportAds(File dest) |
Exports ads from the eSales cluster as an update file.
|
InputStream |
exportConfiguration() |
Exports configuration from the eSales cluster as an XML update document.
|
long |
exportConfiguration(File dest) |
Exports configuration from the eSales cluster to an update file.
|
InputStream |
exportPanels() |
Exports panels from the eSales cluster as an XML document.
|
long |
exportPanels(File dest) |
Exports panels from the eSales cluster to a definition file.
|
InputStream |
exportProducts() |
Exports products and categories from the eSales cluster as a full XML update document.
|
long |
exportProducts(File dest) |
Exports products and categories from the eSales cluster as a full XML update file.
|
ProductStreamer |
exportProducts(String filter,
String presentationAttributes) |
Returns an Iterable
ProductStreamer that allows you to do filtered product exports, conveniently parsed into
Result.Product items. |
InputStream |
exportSynonyms() |
Exports synonyms from the eSales cluster as a full XML update document.
|
long |
exportSynonyms(File dest) |
Exports synonyms from the eSales cluster as an update file.
|
static String |
getVersion() |
Returns the connector version.
|
void |
importAds(File importFile,
String name) |
Imports ads from the specified file to the eSales cluster.
|
void |
importAds(InputStream importXml,
String name) |
Imports ads from the specified stream to the eSales cluster.
|
void |
importConfiguration(File importFile,
String name) |
Imports configuration from the specified file to the eSales cluster.
|
void |
importConfiguration(InputStream importXml,
String name) |
Imports configuration from the specified stream to the eSales cluster.
|
protected void |
importFile(String type,
File importFile,
String name,
Long timestampForTesting) |
|
protected void |
importFile(String type,
File importFile,
String name,
Long timestampForTesting,
Boolean force) |
|
void |
importPanels(File importFile,
String name) |
Imports panels from the specified file to the eSales cluster.
|
void |
importPanels(InputStream importXml,
String name) |
Imports panels of the specified stream to the eSales cluster.
|
void |
importProducts(File importFile,
String name) |
Imports products and categories from the specified file to the eSales cluster.
|
void |
importProducts(File importFile,
String name,
Boolean force) |
Imports products and categories from the specified file to the eSales cluster.
|
void |
importProducts(InputStream importXml,
String name) |
Imports products and categories of the specified stream to the eSales cluster.
|
void |
importProducts(InputStream importXml,
String name,
Boolean force) |
Imports products and categories of the specified stream to the eSales cluster.
|
void |
importSynonyms(File importFile,
String name) |
Imports synonyms from the specified file to the eSales cluster.
|
void |
importSynonyms(InputStream importXml,
String name) |
Imports synonyms from the specified stream to the eSales cluster.
|
String |
latestNotifications() |
Returns the last 100 notifications received by eSales.
|
String |
latestNotifications(Map<String,String> arguments) |
Returns the last 100 notifications received by eSales.
|
protected void |
putStrings(Map<? extends CharSequence,? extends CharSequence> arguments,
ArgMap args) |
|
Reporter |
reporter(String market,
TimeInterval interval) |
Creates a reporter for a market during a specified time interval.
|
Reporter |
reporterForUnknownMarket(TimeInterval interval) |
Creates a reporter for the unknown market (sessions without a market property), during a specified time interval.
|
protected long |
save(InputStream is,
File dest) |
Saves the content from an input stream to a file.
|
String |
serverLog(int serverIndex,
String name) |
Gets a log from a server.
|
List<String> |
serverLogNames() |
Gets a list of available log names.
|
Session |
session(String sessionKey) |
Deprecated.
use session(String sessionKey, String customerKey, String market) instead.
|
Session |
session(String sessionKey,
String customerKey,
String market) |
Creates a session for the specified session key with the specified customer key and market.
|
String |
status() |
Returns a status report from the eSales cluster as an XML document.
|
@Deprecated public final Session session(String sessionKey)
sessionKey
- The session key to identify the sessionpublic Session session(String sessionKey, String customerKey, String market)
sessionKey
- The session key to identify the sessioncustomerKey
- the customer key for this session. Can be nullmarket
- The market for this session. Can be nullprotected final void importFile(String type, File importFile, String name, Long timestampForTesting) throws IOException
IOException
protected final void importFile(String type, File importFile, String name, Long timestampForTesting, Boolean force) throws IOException
IOException
public final void importProducts(File importFile, String name) throws IOException
importFile
- A file with product dataname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errors or if the import is dangerouscom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importProducts(File importFile, String name, Boolean force) throws IOException
importFile
- A file with product dataname
- An identifier for the request, may be nullforce
- If the import should be forced through even if it is considered dangerous (e.g. drastically
reduces the product count).ClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errors or if the import is dangerouscom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importProducts(InputStream importXml, String name) throws IOException
importXml
- Stream with product dataname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.ResendException
- if the import failed and retries were impossible due to the input stream being consumedcom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importProducts(InputStream importXml, String name, Boolean force) throws IOException
importXml
- Stream with product dataname
- An identifier for the request, may be nullforce
- If the import should be forced through even if it is considered dangerous (e.g. drastically
reduces the product count).ClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.ResendException
- if the import failed and retries were impossible due to the input stream being consumedcom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importPanels(File importFile, String name) throws IOException
importFile
- A file with a panel configurationname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importPanels(InputStream importXml, String name) throws IOException
importXml
- Stream with a panel configurationname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.ResendException
- if the import failed and retries were impossible due to the input stream being
consumedcom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importConfiguration(File importFile, String name) throws IOException
importFile
- A file with an eSales configurationname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importConfiguration(InputStream importXml, String name) throws IOException
importXml
- Stream with an eSales configurationname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.ResendException
- if the import failed and retries were impossible due to the input stream being consumedcom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importSynonyms(File importFile, String name) throws IOException
importFile
- A file with synonym dataname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importSynonyms(InputStream importXml, String name) throws IOException
importXml
- Stream with synonym dataname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.ResendException
- if the import failed and retries were impossible due to the input stream being consumedcom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importAds(File importFile, String name) throws IOException
importFile
- A file with ad dataname
- An identifier for the request, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final void importAds(InputStream importXml, String name) throws IOException
importXml
- Stream with ad dataname
- An identifier for the request that can be referenced in logs, may be nullClusterUnavailableException
- if the cluster cannot be reached or all attempts failcom.apptus.util.http.BadRequestException
- if the import file contains errorscom.apptus.util.http.ResendException
- if the import failed and retries were impossible due to the input stream being consumedcom.apptus.util.http.SSLException
- if the secure socket layer cannot be initialized (cloud connector only)com.apptus.util.http.Response.BusyClusterIOException
- if the cluster is busy with another taskIOException
- if any other I/O error occurspublic final long exportProducts(File dest) throws IOException
dest
- Destination fileIOException
- if there was any error exporting or writing to the filepublic final InputStream exportProducts() throws IOException
IOException
- if there was any error exporting or writing to the filepublic final ProductStreamer exportProducts(String filter, String presentationAttributes)
ProductStreamer
that allows you to do filtered product exports, conveniently parsed into
Result.Product
items. Every new iteration on this class will result in a new request to eSales. Note that the
ProductStreamer
must be closed when done, which is most conveniently done by using a try-with-resources block as
in the example below:
try(ProductStreamer productStreamer = connector.exportProducts(null, null)){ for (Product p : productStreamer){ // Do something } }
While iterating, imports will be blocked from completing on a selected eSales server. Imports will not fail but will wait for the iteration to finish. This means that if you fail to close the ProductStreamer you might block imports indefinitely!
filter
- the filter expression to use in the product selection, null or empty filter will select all productspresentationAttributes
- the product attributes to include in the result, null or empty presentationAttributes will
return the configured default presentation attributes in the clusterProductStreamer
that can be used to iterate over the specified product selectionpublic final long exportPanels(File dest) throws IOException
dest
- Destination fileIOException
- if there was any error exporting or writing to the filepublic final InputStream exportPanels() throws IOException
IOException
- if there was any error exportingpublic final long exportConfiguration(File dest) throws IOException
dest
- Destination fileIOException
- if there was any error exporting or writing to the filepublic final InputStream exportConfiguration() throws IOException
IOException
- if there was any error exportingpublic final long exportSynonyms(File dest) throws IOException
dest
- Destination fileIOException
- if there was any error exporting or writing to the filepublic final InputStream exportSynonyms() throws IOException
IOException
- if there was any error exportingpublic final long exportAds(File dest) throws IOException
dest
- Destination fileIOException
- if there was any error exporting or writing to the filepublic final InputStream exportAds() throws IOException
IOException
- if there was any error exportingprotected final long save(InputStream is, File dest) throws IOException
is
- Input streamdest
- Destination fileIOException
- if there was any error saving to the dest filepublic List<String> availableMarkets() throws IOException
IOException
- if there was any problem getting markets.public Reporter reporter(String market, TimeInterval interval)
The reporter can be used to fetch reports from the eSales cluster.
interval
- The time interval for the reportsmarket
- The market for the reportspublic Reporter reporterForUnknownMarket(TimeInterval interval)
The reporter can be used to fetch reports from the eSales cluster.
interval
- The time interval for the reportspublic String latestNotifications() throws IOException
IOException
- if there was any error getting latest notificationspublic String latestNotifications(Map<String,String> arguments) throws IOException
arguments
- The arguments of the notifications, for the moment only 'type' is supportedIOException
- if there was any error getting notificationspublic String serverLog(int serverIndex, String name) throws IOException
serverLogNames()
.serverIndex
- An index in the range [0, number of servers - 1]name
- The name of the log to be retrieved.IOException
- if there was any error getting a server logpublic List<String> serverLogNames() throws IOException
IOException
- if there was any error getting server log namespublic String status() throws IOException
IOException
- if there was any error getting cluster statuspublic EventDataJobResult createRemoveCustomerDataJob(String customerKey) throws IOException
customerKey
- The customer key to remove.IOException
- if the response was unable to be parsed.public EventDataJobResult createExportCustomerDataJob(String customerKey) throws IOException
checkCustomerDataJobStatus(String)
and when the status is
EventDataJobResult.Status.DONE
, the resulting zip file can be downloaded using
downloadExportCustomerDataJobResult(String)
.customerKey
- The customer key to export.IOException
- if the response was unable to be parsed.public EventDataJobResult checkCustomerDataJobStatus(String jid) throws IOException
jid
- The job ID.IOException
- if the response was unable to be parsed.public InputStream downloadExportCustomerDataJobResult(String jid) throws IOException
jid
- The job ID.IOException
- if there was any error exporting customer data job resultpublic long downloadExportCustomerDataJobResult(String jid, File destination) throws IOException
jid
- The job ID.destination
- Where to save the resulting zip file.IOException
- if there was any error exporting or writing customer data job result to the filepublic static String getVersion()
protected void putStrings(Map<? extends CharSequence,? extends CharSequence> arguments, ArgMap args)
Copyright © 2021 Apptus Technologies AB. All rights reserved.