-
Notifications
You must be signed in to change notification settings - Fork 45
[AIT-928] Added basic impl. for PathObject and Instance interfaces #1217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sacOO7
merged 11 commits into
feature/path-based-liveobjects-implementation
from
chore/liveobjects-add-basic-implementation
Jun 22, 2026
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6227b75
Added basic impl. for PathObject and Instance liveobjects interfaces
sacOO7 68edd4b
Merge remote-tracking branch 'origin/feature/path-based-liveobjects-i…
sacOO7 548c0b5
Added impl. for DefaultObjectMessage and WireObjectMessage along with…
sacOO7 af0b39e
Added default skeleton implementation for LiveCounter and LiveMap
sacOO7 f74ae1d
Updated instance types to return specific JsonPrimitive/JsonObject/Js…
sacOO7 54ae53f
- Implemented ResolvedValue class for resolving value at given path
sacOO7 0a9ea02
Implemented resolveValueAtPath guards for terminal operations similar…
sacOO7 3c25c13
Added liveobjects read/write operation validation
sacOO7 94b96a4
Refactored javadoc for Instance interface, fixed other spec doc comments
sacOO7 c8a283d
Updated PathObject#value checks for primitives as per spec
sacOO7 3e8f70c
- Updated Adapter#getChannel with readonly way to retrieve channel
sacOO7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
53 changes: 53 additions & 0 deletions
53
lib/src/main/java/io/ably/lib/object/adapter/AblyClientAdapter.java
This file contains hidden or 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,53 @@ | ||
| package io.ably.lib.object.adapter; | ||
|
|
||
| import io.ably.lib.realtime.ChannelBase; | ||
| import io.ably.lib.realtime.Connection; | ||
| import io.ably.lib.types.AblyException; | ||
| import io.ably.lib.types.ClientOptions; | ||
| import org.jetbrains.annotations.Blocking; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| /** | ||
| * Bridges the path-based LiveObjects implementation to the core Ably client, exposing the | ||
| * client configuration, connection and channel state it needs without coupling it to the | ||
| * concrete {@link io.ably.lib.realtime.AblyRealtime} type. | ||
| * | ||
| * <p>This is the adapter for the path-based {@code io.ably.lib.object} API and is intentionally | ||
| * kept independent of the legacy {@code io.ably.lib.objects} package. | ||
| */ | ||
| public interface AblyClientAdapter { | ||
| /** | ||
| * Retrieves the client options configured for the Ably client. | ||
| * Used to access client configuration parameters such as echoMessages setting | ||
| * that affect the behavior of Objects operations. | ||
| * | ||
| * @return the client options containing configuration parameters | ||
| */ | ||
| @NotNull ClientOptions getClientOptions(); | ||
|
|
||
| /** | ||
| * Retrieves the connection instance for handling connection state and operations. | ||
| * Used to check connection status, obtain error information, and manage | ||
| * message transmission across the Ably connection. | ||
| * | ||
| * @return the connection instance | ||
| */ | ||
| @NotNull Connection getConnection(); | ||
|
|
||
| /** | ||
| * Retrieves the current time in milliseconds from the Ably server. | ||
| * Spec: RTO16 | ||
| */ | ||
| @Blocking | ||
| long getTime() throws AblyException; | ||
|
|
||
| /** | ||
| * Retrieves the channel instance for the specified channel name. | ||
| * If the channel does not exist, an AblyException is thrown. | ||
| * | ||
| * @param channelName the name of the channel to retrieve | ||
| * @return the ChannelBase instance for the specified channel | ||
| * @throws AblyException if the channel is not found or cannot be retrieved | ||
| */ | ||
| @NotNull ChannelBase getChannel(@NotNull String channelName) throws AblyException; | ||
| } |
This file contains hidden or 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,50 @@ | ||
| package io.ably.lib.object.adapter; | ||
|
|
||
| import io.ably.lib.realtime.AblyRealtime; | ||
| import io.ably.lib.realtime.ChannelBase; | ||
| import io.ably.lib.realtime.Connection; | ||
| import io.ably.lib.types.AblyException; | ||
| import io.ably.lib.types.ClientOptions; | ||
| import io.ably.lib.types.ErrorInfo; | ||
| import io.ably.lib.util.Log; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| /** | ||
| * Default {@link AblyClientAdapter} implementation backed by an {@link AblyRealtime} client. | ||
| * Holding the {@code AblyRealtime} reference gives the path-based LiveObjects implementation | ||
| * access to the full client configuration and runtime state it may need. | ||
| */ | ||
| public class Adapter implements AblyClientAdapter { | ||
| private final AblyRealtime ably; | ||
| private static final String TAG = AblyClientAdapter.class.getName(); | ||
|
|
||
| public Adapter(@NotNull AblyRealtime ably) { | ||
| this.ably = ably; | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull ClientOptions getClientOptions() { | ||
| return ably.options; | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull Connection getConnection() { | ||
| return ably.connection; | ||
| } | ||
|
|
||
| @Override | ||
| public long getTime() throws AblyException { | ||
| return ably.time(); | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull ChannelBase getChannel(@NotNull String channelName) throws AblyException { | ||
| if (ably.channels.containsKey(channelName)) { | ||
| return ably.channels.get(channelName); | ||
| } else { | ||
| Log.e(TAG, "getChannel(): channel not found: " + channelName); | ||
| ErrorInfo errorInfo = new ErrorInfo("Channel not found: " + channelName, 404); | ||
| throw AblyException.fromErrorInfo(errorInfo); | ||
| } | ||
| } | ||
| } | ||
10 changes: 10 additions & 0 deletions
10
lib/src/main/java/io/ably/lib/object/adapter/package-info.java
This file contains hidden or 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,10 @@ | ||
| /** | ||
| * Adapter layer bridging the path-based LiveObjects implementation to the core Ably client. | ||
| * {@link io.ably.lib.object.adapter.AblyClientAdapter} is the abstraction the implementation | ||
| * depends on; {@link io.ably.lib.object.adapter.Adapter} is the default implementation backed | ||
| * by an {@link io.ably.lib.realtime.AblyRealtime} client. | ||
| * | ||
| * <p>This package is intentionally independent of the legacy {@code io.ably.lib.objects} | ||
| * package so the path-based API can evolve on its own. | ||
| */ | ||
| package io.ably.lib.object.adapter; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
35 changes: 35 additions & 0 deletions
35
liveobjects/src/main/kotlin/io/ably/lib/object/DefaultRealtimeObject.kt
This file contains hidden or 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,35 @@ | ||
| package io.ably.lib.`object` | ||
|
|
||
| import io.ably.lib.`object`.adapter.AblyClientAdapter | ||
| import io.ably.lib.`object`.path.types.LiveMapPathObject | ||
| import io.ably.lib.`object`.state.ObjectStateChange | ||
| import io.ably.lib.`object`.state.ObjectStateEvent | ||
| import java.util.concurrent.CompletableFuture | ||
|
|
||
| /** | ||
| * Default implementation of [RealtimeObject], the entry point to the strongly-typed, | ||
| * path-based LiveObjects API for a single channel. | ||
| * | ||
| * This is currently a skeleton: the path-based read and subscribe operations are not yet | ||
| * implemented. The method bodies will be filled in as the path-based API is built out. | ||
| * | ||
| * Spec: RTO23 | ||
| */ | ||
| internal class DefaultRealtimeObject( | ||
| internal val channelName: String, | ||
| internal val adapter: AblyClientAdapter, | ||
| ) : RealtimeObject { | ||
|
|
||
| override fun get(): CompletableFuture<LiveMapPathObject> = TODO("Not yet implemented") | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| override fun on(event: ObjectStateEvent, listener: ObjectStateChange.Listener): Subscription { | ||
| // TODO - subscribe logic goes here | ||
| return onceSubscription { | ||
| // TODO - remove ObjectStateChange.Listener | ||
| } | ||
| } | ||
|
|
||
| override fun off(listener: ObjectStateChange.Listener): Unit = TODO("Not yet implemented") | ||
|
|
||
| override fun offAll(): Unit = TODO("Not yet implemented") | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.