-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from RedRoma/release/1.0
Release/1.0
- Loading branch information
Showing
92 changed files
with
3,744 additions
and
694 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1,47 @@ | ||
Banana Service Data Operations | ||
Aroma Service Data Operations | ||
============================================== | ||
|
||
[<img src="https://raw.githubusercontent.com/RedRoma/banana/develop/Graphics/Logo.png" width="300">](https://github.com/RedRoma/banana) | ||
[<img src="https://raw.githubusercontent.com/RedRoma/aroma/develop/Graphics/Logo.png" width="300">](http://aroma.redroma.tech/) | ||
|
||
[![Build Status](http://jenkins.sirwellington.tech/job/Banana%20Data%20Operations/badge/icon)](http://jenkins.sirwellington.tech/job/Banana%20Data%20Operations/) | ||
[![Build Status](http://jenkins.redroma.tech/job/Aroma%20Data%20Operations/badge/icon)](http://jenkins.redroma.tech/job/Aroma%20Data%20Operations/) | ||
|
||
Defines the Data Interfaces and Operations used by the various Banana Services. | ||
Defines the Data Interfaces and Operations used by the various Aroma Services. | ||
|
||
These Data Operations are used by Business Logic living within the various Banana Services. | ||
These Data Operations are used by Business Logic living within the various Aroma Services. | ||
|
||
For example, the Application Service needs the MessageRepository to store messages, and the Banana | ||
For example, the Application Service needs the MessageRepository to store messages, and the Aroma | ||
Service needs it to retrieve Messages. | ||
|
||
|
||
# Download | ||
|
||
To use, simply add the following maven dependency. | ||
|
||
## Release | ||
```xml | ||
<dependency> | ||
<groupId>tech.aroma</groupId> | ||
<artifactId>aroma-data-operations</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
``` | ||
|
||
## Snapshot | ||
|
||
>First add the Snapshot Repository | ||
```xml | ||
<repository> | ||
<id>ossrh</id> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
</repository> | ||
``` | ||
|
||
```xml | ||
<dependency> | ||
<groupId>tech.aroma</groupId> | ||
<artifactId>aroma-data-operations</artifactId> | ||
<version>1.1-SNAPSHOT</version> | ||
</dependency> | ||
``` | ||
|
||
# [Javadocs](http://www.javadoc.io/doc/tech.aroma/aroma-data-operations/) |
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 |
---|---|---|
|
@@ -3,32 +3,32 @@ | |
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>tech.aroma.banana</groupId> | ||
<artifactId>banana</artifactId> | ||
<version>1.3</version> | ||
<groupId>tech.aroma</groupId> | ||
<artifactId>aroma</artifactId> | ||
<version>1.4</version> | ||
</parent> | ||
|
||
<artifactId>banana-data-operations</artifactId> | ||
<artifactId>aroma-data-operations</artifactId> | ||
<version>1.0</version> | ||
<name>${project.artifactId}</name> | ||
<packaging>jar</packaging> | ||
|
||
<url>https://github.com/RedRoma/banana-data-operations</url> | ||
<url>https://github.com/RedRoma/aroma-data-operations</url> | ||
<description> | ||
Part of the Banana Service Project. | ||
Part of the Aroma Project. | ||
Simplicity is paramount. | ||
Defines the Data Repositories and provides implementations for use in various Banana Services. | ||
Defines the Data Repositories and provides implementations for use in various Aroma Services. | ||
</description> | ||
|
||
<issueManagement> | ||
<system>GitHub Issues</system> | ||
<url>https://github.com/RedRoma/banana-data-operations/issues</url> | ||
<url>https://github.com/RedRoma/aroma-data-operations/issues</url> | ||
</issueManagement> | ||
|
||
<scm> | ||
<connection>scm:git:[email protected]:RedRoma/banana-data-operations.git</connection> | ||
<developerConnection>scm:git:[email protected]:RedRoma/banana-data-operations.git</developerConnection> | ||
<url>[email protected]:RedRoma/banana-data-operations-annotations.git</url> | ||
<connection>scm:git:[email protected]:RedRoma/aroma-data-operations.git</connection> | ||
<developerConnection>scm:git:[email protected]:RedRoma/aroma-data-operations.git</developerConnection> | ||
<url>[email protected]:RedRoma/aroma-data-operations-annotations.git</url> | ||
</scm> | ||
|
||
<inceptionYear>2015</inceptionYear> | ||
|
@@ -72,7 +72,6 @@ | |
<dependency> | ||
<groupId>tech.sirwellington.alchemy</groupId> | ||
<artifactId>alchemy-annotations</artifactId> | ||
<version>1.5</version> | ||
</dependency> | ||
|
||
<dependency> | ||
|
@@ -92,12 +91,19 @@ | |
|
||
|
||
<!--=======================--> | ||
<!--BANANA DEPENDENCIES--> | ||
<!--AROMA DEPENDENCIES--> | ||
<!--=======================--> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>banana-thrift</artifactId> | ||
<version>1.6</version> | ||
<artifactId>aroma-thrift</artifactId> | ||
<version>1.9</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>aroma-thrift-generators</artifactId> | ||
<version>1.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
|
||
|
@@ -108,7 +114,7 @@ | |
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
</dependency> | ||
|
||
<!--Decorater Pattern for Guice--> | ||
<dependency> | ||
<groupId>tech.sirwellington.decorice</groupId> | ||
|
@@ -121,8 +127,9 @@ | |
<dependency> | ||
<groupId>com.datastax.cassandra</groupId> | ||
<artifactId>cassandra-driver-core</artifactId> | ||
<version>2.2.0-rc3</version> | ||
</dependency> | ||
|
||
<!--=======================--> | ||
<!--EXPIRING MAP--> | ||
<!--=======================--> | ||
|
@@ -139,7 +146,7 @@ | |
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
|
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,85 @@ | ||
/* | ||
* Copyright 2016 RedRoma, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
package tech.aroma.data; | ||
|
||
import java.util.List; | ||
import org.apache.thrift.TException; | ||
import sir.wellington.alchemy.collections.lists.Lists; | ||
import tech.aroma.thrift.LengthOfTime; | ||
import tech.aroma.thrift.User; | ||
import tech.aroma.thrift.events.Event; | ||
import tech.aroma.thrift.exceptions.InvalidArgumentException; | ||
import tech.aroma.thrift.service.AromaServiceConstants; | ||
import tech.sirwellington.alchemy.annotations.arguments.Required; | ||
|
||
import static tech.sirwellington.alchemy.arguments.Arguments.checkThat; | ||
import static tech.sirwellington.alchemy.arguments.assertions.CollectionAssertions.nonEmptyList; | ||
|
||
|
||
/** | ||
* Responsible for storage of User Activity, represented by Aroma {@linkplain Event Events}. | ||
* | ||
* | ||
* @author SirWellington | ||
*/ | ||
public interface ActivityRepository | ||
{ | ||
default void saveEvent(Event event, User forUser) throws TException | ||
{ | ||
this.saveEvent(event, forUser, AromaServiceConstants.DEFAULT_ACTIVITY_LIFETIME); | ||
} | ||
|
||
void saveEvent(Event event, User forUser, LengthOfTime lifetime) throws TException; | ||
|
||
default void saveEvents(@Required Event event, List<User> users) throws TException | ||
{ | ||
checkThat(users) | ||
.throwing(InvalidArgumentException.class) | ||
.is(nonEmptyList()); | ||
|
||
List<TException> exceptions = Lists.create(); | ||
|
||
users.parallelStream().forEach(user -> | ||
{ | ||
try | ||
{ | ||
this.saveEvent(event, user); | ||
} | ||
catch (TException ex) | ||
{ | ||
exceptions.add(ex); | ||
} | ||
}); | ||
|
||
if (!Lists.isEmpty(exceptions)) | ||
{ | ||
throw Lists.oneOf(exceptions); | ||
} | ||
|
||
} | ||
|
||
boolean containsEvent(@Required String eventId, @Required User user) throws TException; | ||
|
||
Event getEvent(@Required String eventId, @Required User user) throws TException; | ||
|
||
List<Event> getAllEventsFor(@Required User user) throws TException; | ||
|
||
void deleteEvent(@Required String eventId, @Required User user) throws TException; | ||
|
||
void deleteAllEventsFor(@Required User user) throws TException; | ||
} |
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
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
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
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
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
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
Oops, something went wrong.