Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7cd98b3
Backtick ID in diag message
alexander-yevsyukov May 13, 2019
f5a37a5
Annotate methods that must be called
alexander-yevsyukov May 13, 2019
11ca233
Make class final
alexander-yevsyukov May 13, 2019
44ca299
Fix Javadoc layout
alexander-yevsyukov May 13, 2019
647bffa
Introduce `DispatchingRepository`
alexander-yevsyukov May 13, 2019
a35c16b
Allow state dispatching only to projections
alexander-yevsyukov May 13, 2019
72371cb
Fix Javadoc language
alexander-yevsyukov May 13, 2019
0ea0619
Add initialization callback for repositories
alexander-yevsyukov May 13, 2019
0f31e9d
Fix state routing customization
alexander-yevsyukov May 13, 2019
b05ad38
Fix state routing
alexander-yevsyukov May 14, 2019
1a17878
Rename method
alexander-yevsyukov May 14, 2019
0c3de2d
Fix diag message layout
alexander-yevsyukov May 14, 2019
8936c9f
Improve default command routing
alexander-yevsyukov May 14, 2019
8580267
Check the ID type explicitly during routing
alexander-yevsyukov May 14, 2019
07cae85
Have common interface for standard rejections
alexander-yevsyukov May 15, 2019
af55b4d
Have customization callback for state routing
alexander-yevsyukov May 15, 2019
e6db517
Consolidate repo configurations in `init()`
alexander-yevsyukov May 15, 2019
0907424
Improve Javadoc
alexander-yevsyukov May 15, 2019
5b2500b
Prohibit overwriting set value of a Bounded Context
alexander-yevsyukov May 15, 2019
edbc6d8
Pass `BoundedContext` to repo init
alexander-yevsyukov May 15, 2019
c5f382a
Fix Javadoc
alexander-yevsyukov May 15, 2019
fb29185
Fix Javadoc
alexander-yevsyukov May 15, 2019
c2c1877
Add event routing callback
alexander-yevsyukov May 15, 2019
cdb6c4b
Customize event routing via callback
alexander-yevsyukov May 15, 2019
2628629
Customize event import routing via callback
alexander-yevsyukov May 15, 2019
a4dc437
Customize command routing for process managers
alexander-yevsyukov May 15, 2019
0368cae
Hide `eventRouting()`
alexander-yevsyukov May 15, 2019
d8d08fb
Split tests of event import
alexander-yevsyukov May 15, 2019
921fca9
Revert making `final`
alexander-yevsyukov May 15, 2019
69fa883
Hide event import routing
alexander-yevsyukov May 16, 2019
70867d4
Test routability of a command message
alexander-yevsyukov May 16, 2019
b07ac44
Merge remote-tracking branch 'remotes/origin/master' into more-on-sta…
alexander-yevsyukov May 16, 2019
d32ec7d
Merge remote-tracking branch 'remotes/origin/master' into more-on-sta…
alexander-yevsyukov May 16, 2019
eaad21b
Migrate off VBuilder classes
alexander-yevsyukov May 16, 2019
ee0d0f1
Migrate to new compiled protos
alexander-yevsyukov May 17, 2019
34d816b
Migrate to new compiled protos
alexander-yevsyukov May 17, 2019
d630c48
Migrate to new compiled protos
alexander-yevsyukov May 17, 2019
ad726df
Annotate stub class immutable
alexander-yevsyukov May 17, 2019
51baaf6
Extract common default event routing def.
alexander-yevsyukov May 17, 2019
800a73e
Test empty command validation
alexander-yevsyukov May 17, 2019
1a7d271
Improve names
alexander-yevsyukov May 17, 2019
018d707
Improve Javadoc
alexander-yevsyukov May 17, 2019
44a96e6
Improve Javadoc
alexander-yevsyukov May 17, 2019
621ca32
Reference issue in todo
alexander-yevsyukov May 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/src/main/java/io/spine/client/CommandFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ private CommandContext createContext(int targetVersion) {
private static CommandContext withCurrentTime(CommandContext value) {
ActorContext withCurrentTime =
value.getActorContext()
.toVBuilder()
.toBuilder()
.setTimestamp(currentTime())
.build();
CommandContext result =
value.toVBuilder()
value.toBuilder()
.setActorContext(withCurrentTime)
.build();
return result;
Expand Down
2 changes: 1 addition & 1 deletion client/src/main/java/io/spine/client/Queries.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private Queries() {

public static QueryId generateId() {
String formattedId = format(QUERY_ID_FORMAT, Identifier.newUuid());
return QueryId.vBuilder()
return QueryId.newBuilder()
.setValue(formattedId)
.build();
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/java/io/spine/client/QueryBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private Optional<Pagination> pagination() {
if (limit == 0) {
return Optional.empty();
}
Pagination result = Pagination.vBuilder()
Pagination result = Pagination.newBuilder()
.setPageSize(limit)
.build();
return Optional.of(result);
Expand All @@ -149,7 +149,7 @@ private Optional<OrderBy> orderBy() {
if (orderingColumn == null) {
return Optional.empty();
}
OrderBy result = OrderBy.vBuilder()
OrderBy result = OrderBy.newBuilder()
.setColumn(orderingColumn)
.setDirection(direction)
.build();
Expand Down
7 changes: 4 additions & 3 deletions client/src/main/java/io/spine/client/Targets.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public static Target allOf(Class<? extends Message> targetClass) {
* a set of predicates which target entity state or event message must match
* @return a {@code Target} instance formed according to the provided parameters
*/
@SuppressWarnings("CheckReturnValue")
public static Target composeTarget(Class<? extends Message> targetClass,
@Nullable Iterable<?> ids,
@Nullable Iterable<CompositeFilter> filters) {
Expand All @@ -103,7 +104,7 @@ public static Target composeTarget(Class<? extends Message> targetClass,
boolean includeAll = (ids == null && filters == null);

TypeUrl typeUrl = TypeUrl.of(targetClass);
TargetVBuilder builder = Target.vBuilder()
Target.Builder builder = Target.newBuilder()
.setType(typeUrl.value());
if (includeAll) {
builder.setIncludeAll(true);
Expand Down Expand Up @@ -132,7 +133,7 @@ private static IdFilter composeIdFilter(Collection<?> items) {

private static IdFilter idFilter(List<Any> ids) {
return IdFilter
.vBuilder()
.newBuilder()
.addAllIds(ids)
.build();
}
Expand All @@ -154,7 +155,7 @@ private static <I> I checkId(I item) {
}

private static TargetFilters targetFilters(List<CompositeFilter> filters, IdFilter idFilter) {
return TargetFilters.vBuilder()
return TargetFilters.newBuilder()
.setIdFilter(idFilter)
.addAllFilter(filters)
.build();
Expand Down
2 changes: 1 addition & 1 deletion config
6 changes: 3 additions & 3 deletions core/src/main/java/io/spine/core/EventMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ default boolean isRejection() {
default Event clearEnrichments() {
EventContext context = context();
EventContext.OriginCase originCase = context.getOriginCase();
EventContextVBuilder resultContext = context.toVBuilder()
EventContext.Builder resultContext = context.toBuilder()
.clearEnrichment();
if (originCase == EVENT_CONTEXT) {
resultContext.setEventContext(context.getEventContext()
.toVBuilder()
.toBuilder()
.clearEnrichment()
.build());
}
Event thisEvent = (Event) this;
Event result = thisEvent.toVBuilder()
Event result = thisEvent.toBuilder()
.setContext(resultContext.build())
.build();
return result;
Expand Down
16 changes: 8 additions & 8 deletions license-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:26 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:03 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -821,7 +821,7 @@ This report was generated on **Mon May 13 10:24:26 EEST 2019** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:27 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:03 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -1359,7 +1359,7 @@ This report was generated on **Mon May 13 10:24:27 EEST 2019** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:27 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:04 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -2059,7 +2059,7 @@ This report was generated on **Mon May 13 10:24:27 EEST 2019** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:28 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:04 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -2603,7 +2603,7 @@ This report was generated on **Mon May 13 10:24:28 EEST 2019** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:29 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:05 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -3108,7 +3108,7 @@ This report was generated on **Mon May 13 10:24:29 EEST 2019** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:29 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:05 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -3621,7 +3621,7 @@ This report was generated on **Mon May 13 10:24:29 EEST 2019** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:30 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:05 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -4234,4 +4234,4 @@ This report was generated on **Mon May 13 10:24:30 EEST 2019** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon May 13 10:24:30 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Fri May 17 11:12:06 EEST 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
38 changes: 26 additions & 12 deletions server/src/main/java/io/spine/server/BoundedContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ private static CommandBus buildCommandBus(BoundedContextBuilder builder, EventBu
/**
* Creates a new instance of {@link IntegrationBus} with the given parameters.
*
* @param builder the {@link BoundedContextBuilder} to obtain
* the {@link IntegrationBus.Builder} from
* @param eventBus the initialized {@link EventBus}
* @param name the name of the constructed Bounded Context
* @param builder
* the {@link BoundedContextBuilder} to obtain the {@link IntegrationBus.Builder} from
* @param eventBus
* the initialized {@link EventBus}
* @param name
* the name of the constructed Bounded Context
* @return new instance of {@link IntegrationBus}
*/
private static IntegrationBus buildIntegrationBus(BoundedContextBuilder builder,
Expand Down Expand Up @@ -216,7 +218,7 @@ public static BoundedContextBuilder newBuilder() {
*/
public <I, E extends Entity<I, ?>> void register(Repository<I, E> repository) {
checkNotNull(repository);
repository.setBoundedContext(this);
repository.setContext(this);
guard.register(repository);
repository.onRegistered();
registerEventDispatcher(stand());
Expand Down Expand Up @@ -270,10 +272,13 @@ private void registerWithIntegrationBus(ExternalDispatcherFactory<?> dispatcher)
}

/**
* Registers the passed event dispatcher with the {@code EventBus} of
* this {@code BoundedContext}, if it dispatches domestic events.
* Registers the passed event dispatcher with the buses of this {@code BoundedContext}.
*
* <p>If the passed instance dispatches domestic events, registers it with the {@code EventBus}.
* If the passed instance dispatches external events, registers it with
* the {@code IntegrationBus}.
*
* @see #registerEventDispatcher(EventDispatcherDelegate)
*/
public void registerEventDispatcher(EventDispatcher<?> dispatcher) {
checkNotNull(dispatcher);
Expand All @@ -288,10 +293,10 @@ public void registerEventDispatcher(EventDispatcher<?> dispatcher) {
}

/**
* Registers the passed event dispatcher with the {@code EventBus} of
* this {@code BoundedContext}, if it dispatchers domestic events.
* If the passed instance dispatches external events, registers it with
* the {@code IntegrationBus}.
* Registers the passed delegate of an {@link EventDispatcher} with the buses of this
* {@code BoundedContext}.
*
* @see #registerEventDispatcher(EventDispatcher)
*/
public void registerEventDispatcher(EventDispatcherDelegate<?> dispatcher) {
checkNotNull(dispatcher);
Expand All @@ -305,7 +310,8 @@ public void registerEventDispatcher(EventDispatcherDelegate<?> dispatcher) {
*/
private static
Supplier<IllegalStateException> notExternalDispatcherFrom(Object dispatcher) {
return () -> newIllegalStateException("No external dispatcher provided by %s", dispatcher);
return () -> newIllegalStateException(
"No external dispatcher provided by `%s`.", dispatcher);
}

/**
Expand Down Expand Up @@ -518,4 +524,12 @@ private void shutDownRepositories() {
tenantIndex.close();
}
}

/**
* Returns the name of this Bounded Context.
*/
@Override
public String toString() {
return name.getValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

package io.spine.server.aggregate;

import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper;
import io.spine.annotation.Internal;
import io.spine.server.BoundedContext;
import io.spine.server.aggregate.model.AggregatePartClass;

import static io.spine.server.aggregate.model.AggregatePartClass.asAggregatePartClass;
Expand All @@ -47,11 +49,19 @@ protected AggregatePartRepository() {
super();
}

/**
* Registers itself with the {@link io.spine.server.BoundedContext#aggregateRootDirectory()
* AggregateRootDirectory} of the parent {@code BoundedContext}.
*
* @param context
* the Bounded Context of this repository
*/
@Override
public void onRegistered() {
super.onRegistered();
boundedContext().aggregateRootDirectory()
.register(this);
@OverridingMethodsMustInvokeSuper
protected void init(BoundedContext context) {
super.init(context);
context.aggregateRootDirectory()
.register(this);
}

@Override
Expand All @@ -71,9 +81,8 @@ AggregatePartClass<A> aggregatePartClass() {
return (AggregatePartClass<A>) entityModelClass();
}

//TODO:2017-06-06:alexander.yevsyukov: Cache aggregate roots shared among part repositories
private AggregateRoot<I> createAggregateRoot(I id) {
AggregateRoot<I> result = aggregatePartClass().createRoot(boundedContext(), id);
AggregateRoot<I> result = aggregatePartClass().createRoot(context(), id);
return result;
}

Expand Down
Loading