Skip to content

Commit

Permalink
fix: wsimport handshake must be sent in client token
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Oct 10, 2023
1 parent 8bf396d commit 1db32f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public void execute(SendResponse resp) throws ArcException {
executeIf(ServletArc.METADATA, () -> this.clientDao.createTablePeriodicite());

stopHandShake();
// on renvoie l'id du client avec son timestamp

// on renvoie l'id du client avec son timestamp
resp.send(arcClientIdentifier.getEnvironnement()+ Delimiters.SQL_SCHEMA_DELIMITER + arcClientIdentifier.getClient()
+ Delimiters.SQL_TOKEN_DELIMITER + arcClientIdentifier.getTimestamp());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,35 @@ public class ImportStep2GetTableNameService {

protected static final Logger LOGGER = LogManager.getLogger(ImportStep2GetTableNameService.class);


private ClientDao clientDao;
private JSONObject dsnRequest;

private ArcClientIdentifier arcClientIdentifier;

private boolean reprise;

private boolean reprise;

public ImportStep2GetTableNameService(JSONObject dsnRequest) {
super();

this.dsnRequest = dsnRequest;

this.arcClientIdentifier = new ArcClientIdentifier(dsnRequest);

reprise = this.dsnRequest.getBoolean(JsonKeys.REPRISE.getKey());

clientDao = new ClientDao(arcClientIdentifier);

}

}

public void execute(SendResponse resp) throws ArcException {

try {
StringBuilder type = new StringBuilder();

String tableName = this.clientDao.getAClientTable();

if (tableName == null) {
tableName = this.clientDao.getIdTable();
tableName = this.clientDao.getIdTable();

if (!reprise) {
this.clientDao.updatePilotage(tableName);
Expand All @@ -73,7 +70,7 @@ public void execute(SendResponse resp) throws ArcException {
}

// renvoie un nom de table du client si il en reste une
resp.send(tableName + " " + type);
resp.send(arcClientIdentifier.getHandshake() + tableName + " " + type);
resp.endSending();

} catch (ArcException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public ArcClientIdentifier(JSONObject dsnRequest) {
this.dsnRequest = dsnRequest;

this.client = getKeyIfExists(JsonKeys.CLIENT, t -> { return ManipString.substringAfterLast(t, Delimiters.HANDSHAKE_DELIMITER); });
this.handshake = getKeyIfExists(JsonKeys.CLIENT, t -> {return t.substring(0, t.length() - this.client.length());});
this.timestamp = System.currentTimeMillis();
this.environnement = getKeyIfExists(JsonKeys.ENVIRONNEMENT, Patch::normalizeSchemaName);
this.famille = getKeyIfExists(JsonKeys.FAMILLE);
Expand All @@ -31,6 +32,9 @@ public ArcClientIdentifier(JSONObject dsnRequest) {
private String client;

private String famille;

private String handshake;


private String getKeyIfExists(JsonKeys key, UnaryOperator<String> f )
{
Expand All @@ -46,34 +50,22 @@ public long getTimestamp() {
return timestamp;
}

public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}

public String getEnvironnement() {
return environnement;
}

public void setEnvironnement(String environnement) {
this.environnement = environnement;
}

public String getClient() {
return client;
}

public void setClient(String client) {
this.client = client;
}

public String getFamille() {
return famille;
}

public void setFamille(String famille) {
this.famille = famille;
}

public String getHandshake() {
return handshake;
}



Expand Down

0 comments on commit 1db32f2

Please sign in to comment.