-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#10] Set notification callback to the SVNKit client
* start implementing adapters
- Loading branch information
1 parent
1e62b00
commit 8a4f6f2
Showing
13 changed files
with
696 additions
and
2 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...r.svnkit1_10/src/ru/arsysop/svn/connector/internal/adapt/ClientNotifyCallbackAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) ArSysOp 2020-2024 | ||
* | ||
* ArSysOp and its affiliates make no warranty of any kind | ||
* with regard to this material. | ||
* | ||
* ArSysOp expressly disclaims all warranties as to the material, express, | ||
* and implied, including but not limited to the implied warranties of | ||
* merchantability, fitness for a particular purpose and non-infringement of third | ||
* party rights. | ||
* | ||
* In no event shall ArSysOp be liable to you or any other person for any damages, | ||
* including, without limitation, any direct, indirect, incidental or consequential | ||
* damages, expenses, lost profits, lost data or other damages arising out of the use, | ||
* misuse or inability to use the material and any derived software, even if ArSysOp, | ||
* its affiliate or an authorized dealer has been advised of the possibility of such damages. | ||
* | ||
*/ | ||
|
||
package ru.arsysop.svn.connector.internal.adapt; | ||
|
||
import org.eclipse.team.svn.core.connector.ISVNNotificationCallback; | ||
|
||
public final class ClientNotifyCallbackAdapter implements org.apache.subversion.javahl.callback.ClientNotifyCallback { | ||
|
||
private final ISVNNotificationCallback callback; | ||
|
||
public ClientNotifyCallbackAdapter(ISVNNotificationCallback notify) { | ||
callback = notify; | ||
} | ||
|
||
public ISVNNotificationCallback callback() { | ||
return callback; | ||
} | ||
|
||
public void onNotify(org.apache.subversion.javahl.ClientNotifyInformation info) { | ||
callback.notify(new ClientNotifyInformationAdapter(info).adapt()); | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
..._10/src/ru/arsysop/svn/connector/internal/adapt/ClientNotifyInformationActionAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Copyright (c) ArSysOp 2020-2024 | ||
* | ||
* ArSysOp and its affiliates make no warranty of any kind | ||
* with regard to this material. | ||
* | ||
* ArSysOp expressly disclaims all warranties as to the material, express, | ||
* and implied, including but not limited to the implied warranties of | ||
* merchantability, fitness for a particular purpose and non-infringement of third | ||
* party rights. | ||
* | ||
* In no event shall ArSysOp be liable to you or any other person for any damages, | ||
* including, without limitation, any direct, indirect, incidental or consequential | ||
* damages, expenses, lost profits, lost data or other damages arising out of the use, | ||
* misuse or inability to use the material and any derived software, even if ArSysOp, | ||
* its affiliate or an authorized dealer has been advised of the possibility of such damages. | ||
* | ||
*/ | ||
|
||
package ru.arsysop.svn.connector.internal.adapt; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
import org.apache.subversion.javahl.ClientNotifyInformation.Action; | ||
import org.eclipse.team.svn.core.connector.SVNNotification; | ||
import org.eclipse.team.svn.core.connector.SVNNotification.PerformedAction; | ||
|
||
final class ClientNotifyInformationActionAdapter extends SvnTypeMap<Action, PerformedAction> { | ||
|
||
ClientNotifyInformationActionAdapter(Action source) { | ||
super(source); | ||
} | ||
|
||
@Override | ||
protected Map<Action, PerformedAction> fill() { | ||
Map<Action, PerformedAction> map = new LinkedHashMap<>(); | ||
map.put(Action.add, PerformedAction.ADD); | ||
map.put(Action.blame_revision, PerformedAction.BLAME_REVISION); | ||
map.put(Action.changelist_clear, PerformedAction.CHANGELIST_CLEAR); | ||
map.put(Action.changelist_moved, PerformedAction.CHANGELIST_MOVED); | ||
map.put(Action.changelist_set, PerformedAction.CHANGELIST_SET); | ||
map.put(Action.commit_added, PerformedAction.COMMIT_ADDED); | ||
map.put(Action.commit_copied, PerformedAction.COMMIT_COPIED); | ||
map.put(Action.commit_copied_replaced, PerformedAction.COMMIT_COPIED_REPLACED); | ||
map.put(Action.commit_deleted, PerformedAction.COMMIT_DELETED); | ||
map.put(Action.commit_modified, PerformedAction.COMMIT_MODIFIED); | ||
map.put(Action.commit_postfix_txdelta, PerformedAction.COMMIT_POSTFIX_TXDELTA); | ||
map.put(Action.commit_replaced, PerformedAction.COMMIT_REPLACED); | ||
map.put(Action.conflict_resolver_done, PerformedAction.CONFLICT_RESOLVER_DONE); | ||
map.put(Action.conflict_resolver_starting, PerformedAction.CONFLICT_RESOLVER_STARTING); | ||
map.put(Action.copy, PerformedAction.COPY); | ||
map.put(Action.delete, PerformedAction.DELETE); | ||
map.put(Action.exclude, PerformedAction.EXCLUDE); | ||
map.put(Action.exists, PerformedAction.EXISTS); | ||
map.put(Action.failed_conflict, PerformedAction.FAILED_CONFLICT); | ||
map.put(Action.failed_external, PerformedAction.FAILED_EXTERNAL); | ||
map.put(Action.failed_forbidden_by_server, PerformedAction.FAILED_FORBIDDEN_BY_SERVER); | ||
map.put(Action.failed_lock, PerformedAction.FAILED_LOCK); | ||
map.put(Action.failed_locked, PerformedAction.FAILED_LOCKED); | ||
map.put(Action.failed_missing, PerformedAction.FAILED_MISSING); | ||
map.put(Action.failed_no_parent, PerformedAction.FAILED_NO_PARENT); | ||
map.put(Action.failed_obstructed, PerformedAction.FAILED_OBSTRUCTED); | ||
map.put(Action.failed_out_of_date, PerformedAction.FAILED_OUT_OF_DATE); | ||
map.put(Action.failed_revert, PerformedAction.FAILED_REVERT); | ||
map.put(Action.failed_unlock, PerformedAction.FAILED_UNLOCK); | ||
map.put(Action.foreign_copy_begin, PerformedAction.FOREIGN_COPY_BEGIN); | ||
map.put(Action.foreign_merge_begin, PerformedAction.FOREIGN_MERGE_BEGIN); | ||
map.put(Action.left_local_modifications, PerformedAction.LEFT_LOCAL_MODIFICATIONS); | ||
map.put(Action.locked, PerformedAction.LOCKED); | ||
map.put(Action.merge_begin, PerformedAction.MERGE_BEGIN); | ||
map.put(Action.merge_completed, PerformedAction.MERGE_COMPLETED); | ||
map.put(Action.merge_elide_info, PerformedAction.MERGE_ELIDE_INFO); | ||
map.put(Action.merge_record_info, PerformedAction.MERGE_RECORD_INFO); | ||
map.put(Action.merge_record_info_begin, PerformedAction.MERGE_RECORD_INFO_BEGIN); | ||
map.put(Action.move_broken, PerformedAction.MOVE_BROKEN); | ||
map.put(Action.patch, PerformedAction.PATCH); | ||
map.put(Action.patch_applied_hunk, PerformedAction.PATCH_APPLIED_HUNK); | ||
map.put(Action.patch_hunk_already_applied, PerformedAction.PATCH_HUNK_ALREADY_APPLIED); | ||
map.put(Action.patch_rejected_hunk, PerformedAction.PATCH_REJECTED_HUNK); | ||
map.put(Action.path_nonexistent, PerformedAction.PATH_NONEXISTENT); | ||
map.put(Action.property_added, PerformedAction.PROPERTY_ADDED); | ||
map.put(Action.property_deleted, PerformedAction.PROPERTY_DELETED); | ||
map.put(Action.property_deleted_nonexistent, PerformedAction.PROPERTY_DELETED_NONEXISTENT); | ||
map.put(Action.property_modified, PerformedAction.PROPERTY_MODIFIED); | ||
map.put(Action.resolved, PerformedAction.RESOLVED); | ||
map.put(Action.restore, PerformedAction.RESTORE); | ||
map.put(Action.revert, PerformedAction.REVERT); | ||
map.put(Action.revprop_deleted, PerformedAction.REVPROP_DELETE); | ||
map.put(Action.revprop_set, PerformedAction.REVPROP_SET); | ||
map.put(Action.skip, PerformedAction.SKIP); | ||
map.put(Action.skip_conflicted, PerformedAction.SKIP_CONFLICTED); | ||
map.put(Action.status_completed, PerformedAction.STATUS_COMPLETED); | ||
map.put(Action.status_external, PerformedAction.STATUS_EXTERNAL); | ||
map.put(Action.tree_conflict, PerformedAction.TREE_CONFLICT); | ||
map.put(Action.unlocked, PerformedAction.UNLOCKED); | ||
map.put(Action.update_add, PerformedAction.UPDATE_ADD); | ||
map.put(Action.update_broken_lock, PerformedAction.UPDATE_BROKEN_LOCK); | ||
map.put(Action.update_completed, PerformedAction.UPDATE_COMPLETED); | ||
map.put(Action.update_delete, PerformedAction.UPDATE_DELETE); | ||
map.put(Action.update_external, PerformedAction.UPDATE_EXTERNAL); | ||
map.put(Action.update_external_removed, PerformedAction.UPDATE_EXTERNAL_REMOVED); | ||
map.put(Action.update_replaced, PerformedAction.UPDATE_REPLACED); | ||
map.put(Action.update_shadowed_add, PerformedAction.UPDATE_SHADOWED_ADD); | ||
map.put(Action.update_shadowed_delete, PerformedAction.UPDATE_SHADOWED_DELETE); | ||
map.put(Action.update_shadowed_update, PerformedAction.UPDATE_SHADOWED_UPDATE); | ||
map.put(Action.update_skip_access_denied, PerformedAction.UPDATE_SKIP_ACCESS_DENIED); | ||
map.put(Action.update_skip_obstruction, PerformedAction.UPDATE_SKIP_OBSTRUCTION); | ||
map.put(Action.update_skip_working_only, PerformedAction.UPDATE_SKIP_WORKING_ONLY); | ||
map.put(Action.update_started, PerformedAction.UPDATE_STARTED); | ||
map.put(Action.update_update, PerformedAction.UPDATE_UPDATE); | ||
map.put(Action.upgraded_path, PerformedAction.UPGRADED_PATH); | ||
map.put(Action.url_redirect, PerformedAction.URL_REDIRECT); | ||
return map; | ||
} | ||
|
||
@Override | ||
SVNNotification.PerformedAction defaults() { | ||
return SVNNotification.PerformedAction._UNKNOWN_ACTION; | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...vnkit1_10/src/ru/arsysop/svn/connector/internal/adapt/ClientNotifyInformationAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) ArSysOp 2020-2024 | ||
* | ||
* ArSysOp and its affiliates make no warranty of any kind | ||
* with regard to this material. | ||
* | ||
* ArSysOp expressly disclaims all warranties as to the material, express, | ||
* and implied, including but not limited to the implied warranties of | ||
* merchantability, fitness for a particular purpose and non-infringement of third | ||
* party rights. | ||
* | ||
* In no event shall ArSysOp be liable to you or any other person for any damages, | ||
* including, without limitation, any direct, indirect, incidental or consequential | ||
* damages, expenses, lost profits, lost data or other damages arising out of the use, | ||
* misuse or inability to use the material and any derived software, even if ArSysOp, | ||
* its affiliate or an authorized dealer has been advised of the possibility of such damages. | ||
* | ||
*/ | ||
|
||
package ru.arsysop.svn.connector.internal.adapt; | ||
|
||
import org.apache.subversion.javahl.ClientNotifyInformation; | ||
import org.eclipse.team.svn.core.connector.SVNNotification; | ||
|
||
final class ClientNotifyInformationAdapter extends SvnTypeConstructor<ClientNotifyInformation, SVNNotification> { | ||
|
||
ClientNotifyInformationAdapter(ClientNotifyInformation source) { | ||
super(source); | ||
} | ||
|
||
@Override | ||
public SVNNotification adapt() { | ||
return new SVNNotification(// | ||
source.getPath(), // | ||
new ClientNotifyInformationActionAdapter(source.getAction()).adapt(), // | ||
new NodeKindAdapter(source.getKind()).adapt(), // | ||
source.getMimeType(), // | ||
new LockAdapter(source.getLock()).adapt(), // | ||
source.getErrMsg(), // | ||
new ClientNotifyInformationStatusAdapter(source.getContentState()).adapt(), // | ||
new ClientNotifyInformationStatusAdapter(source.getPropState()).adapt(), // | ||
new LockStatusAdapter(source.getLockState()).adapt(), // | ||
source.getRevision()); | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
..._10/src/ru/arsysop/svn/connector/internal/adapt/ClientNotifyInformationStatusAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) ArSysOp 2020-2024 | ||
* | ||
* ArSysOp and its affiliates make no warranty of any kind | ||
* with regard to this material. | ||
* | ||
* ArSysOp expressly disclaims all warranties as to the material, express, | ||
* and implied, including but not limited to the implied warranties of | ||
* merchantability, fitness for a particular purpose and non-infringement of third | ||
* party rights. | ||
* | ||
* In no event shall ArSysOp be liable to you or any other person for any damages, | ||
* including, without limitation, any direct, indirect, incidental or consequential | ||
* damages, expenses, lost profits, lost data or other damages arising out of the use, | ||
* misuse or inability to use the material and any derived software, even if ArSysOp, | ||
* its affiliate or an authorized dealer has been advised of the possibility of such damages. | ||
* | ||
*/ | ||
|
||
package ru.arsysop.svn.connector.internal.adapt; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
import org.apache.subversion.javahl.ClientNotifyInformation; | ||
import org.apache.subversion.javahl.ClientNotifyInformation.Status; | ||
import org.eclipse.team.svn.core.connector.SVNNotification; | ||
import org.eclipse.team.svn.core.connector.SVNNotification.NodeStatus; | ||
|
||
final class ClientNotifyInformationStatusAdapter | ||
extends SvnTypeMap<org.apache.subversion.javahl.ClientNotifyInformation.Status, NodeStatus> { | ||
|
||
ClientNotifyInformationStatusAdapter(Status source) { | ||
super(source); | ||
} | ||
|
||
@Override | ||
protected Map<Status, NodeStatus> fill() { | ||
Map<Status, NodeStatus> map = new LinkedHashMap<>(); | ||
map.put(ClientNotifyInformation.Status.inapplicable, NodeStatus.INAPPLICABLE); | ||
map.put(ClientNotifyInformation.Status.unknown, NodeStatus.UNKNOWN); | ||
map.put(ClientNotifyInformation.Status.unchanged, NodeStatus.UNCHANGED); | ||
map.put(ClientNotifyInformation.Status.missing, NodeStatus.MISSING); | ||
map.put(ClientNotifyInformation.Status.obstructed, NodeStatus.OBSTRUCTED); | ||
map.put(ClientNotifyInformation.Status.changed, NodeStatus.CHANGED); | ||
map.put(ClientNotifyInformation.Status.merged, NodeStatus.MERGED); | ||
map.put(ClientNotifyInformation.Status.conflicted, SVNNotification.NodeStatus.CONFLICTED); | ||
return map; | ||
} | ||
|
||
@Override | ||
NodeStatus defaults() { | ||
return NodeStatus.UNKNOWN; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...sop.svn.connector.svnkit1_10/src/ru/arsysop/svn/connector/internal/adapt/LockAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) ArSysOp 2020-2024 | ||
* | ||
* ArSysOp and its affiliates make no warranty of any kind | ||
* with regard to this material. | ||
* | ||
* ArSysOp expressly disclaims all warranties as to the material, express, | ||
* and implied, including but not limited to the implied warranties of | ||
* merchantability, fitness for a particular purpose and non-infringement of third | ||
* party rights. | ||
* | ||
* In no event shall ArSysOp be liable to you or any other person for any damages, | ||
* including, without limitation, any direct, indirect, incidental or consequential | ||
* damages, expenses, lost profits, lost data or other damages arising out of the use, | ||
* misuse or inability to use the material and any derived software, even if ArSysOp, | ||
* its affiliate or an authorized dealer has been advised of the possibility of such damages. | ||
* | ||
*/ | ||
|
||
package ru.arsysop.svn.connector.internal.adapt; | ||
|
||
import org.apache.subversion.javahl.types.Lock; | ||
import org.eclipse.team.svn.core.connector.SVNLock; | ||
|
||
final class LockAdapter extends SvnTypeConstructor<Lock, SVNLock> { | ||
|
||
LockAdapter(Lock source) { | ||
super(source); | ||
} | ||
|
||
@Override | ||
public SVNLock adapt() { | ||
return new SVNLock( | ||
source.getOwner(), // | ||
source.getPath(), // | ||
source.getToken(), // | ||
source.getComment(), // | ||
source.getCreationDate() == null ? 0 : source.getCreationDate().getTime(), // | ||
source.getExpirationDate() == null ? 0 : source.getExpirationDate().getTime()// | ||
); | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
...n.connector.svnkit1_10/src/ru/arsysop/svn/connector/internal/adapt/LockStatusAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) ArSysOp 2020-2024 | ||
* | ||
* ArSysOp and its affiliates make no warranty of any kind | ||
* with regard to this material. | ||
* | ||
* ArSysOp expressly disclaims all warranties as to the material, express, | ||
* and implied, including but not limited to the implied warranties of | ||
* merchantability, fitness for a particular purpose and non-infringement of third | ||
* party rights. | ||
* | ||
* In no event shall ArSysOp be liable to you or any other person for any damages, | ||
* including, without limitation, any direct, indirect, incidental or consequential | ||
* damages, expenses, lost profits, lost data or other damages arising out of the use, | ||
* misuse or inability to use the material and any derived software, even if ArSysOp, | ||
* its affiliate or an authorized dealer has been advised of the possibility of such damages. | ||
* | ||
*/ | ||
|
||
package ru.arsysop.svn.connector.internal.adapt; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
import org.apache.subversion.javahl.ClientNotifyInformation.LockStatus; | ||
import org.eclipse.team.svn.core.connector.SVNNotification; | ||
import org.eclipse.team.svn.core.connector.SVNNotification.NodeLock; | ||
|
||
final class LockStatusAdapter extends SvnTypeMap<LockStatus, NodeLock> { | ||
|
||
LockStatusAdapter(LockStatus source) { | ||
super(source); | ||
} | ||
|
||
@Override | ||
protected Map<LockStatus, NodeLock> fill() { | ||
Map<LockStatus, NodeLock> map = new LinkedHashMap<>(); | ||
map.put(LockStatus.inapplicable, SVNNotification.NodeLock.INAPPLICABLE); | ||
map.put(LockStatus.unknown, SVNNotification.NodeLock.UNKNOWN); | ||
map.put(LockStatus.unchanged, SVNNotification.NodeLock.UNCHANGED); | ||
map.put(LockStatus.locked, SVNNotification.NodeLock.LOCKED); | ||
map.put(LockStatus.unlocked, SVNNotification.NodeLock.UNLOCKED); | ||
return map; | ||
} | ||
|
||
@Override | ||
NodeLock defaults() { | ||
return NodeLock.UNKNOWN; | ||
} | ||
|
||
} |
Oops, something went wrong.