Skip to content

Commit

Permalink
Move all library code to function-specific modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuujo committed Jun 20, 2017
1 parent 19047f3 commit efdef1d
Show file tree
Hide file tree
Showing 371 changed files with 1,090 additions and 482 deletions.
13 changes: 13 additions & 0 deletions cluster/pom.xml
Expand Up @@ -26,6 +26,19 @@
<artifactId>atomix-cluster</artifactId> <artifactId>atomix-cluster</artifactId>
<name>Atomix Cluster</name> <name>Atomix Cluster</name>


<dependencies>
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-event</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build> <build>
<plugins> <plugins>
<plugin> <plugin>
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/ */
package io.atomix.cluster; package io.atomix.cluster;


import io.atomix.util.Identifier; import io.atomix.utils.Identifier;


/** /**
* Controller cluster identity. * Controller cluster identity.
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/ */
package io.atomix.cluster; package io.atomix.cluster;


import io.atomix.util.Identifier; import io.atomix.utils.Identifier;


import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;


Expand Down
Expand Up @@ -13,8 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package io.atomix;


/** /**
* Atomix distributed systems protocols. * Atomix!
*/ */
package io.atomix.protocols; public interface Atomix {
}
17 changes: 15 additions & 2 deletions utils/event/pom.xml → event/pom.xml
Expand Up @@ -18,13 +18,26 @@


<parent> <parent>
<groupId>io.atomix</groupId> <groupId>io.atomix</groupId>
<artifactId>atomix-utils-parent</artifactId> <artifactId>atomix-parent</artifactId>
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>


<packaging>bundle</packaging> <packaging>bundle</packaging>
<artifactId>atomix-event</artifactId> <artifactId>atomix-event</artifactId>
<name>Atomix Utilities :: Event</name> <name>Atomix Event</name>

<dependencies>
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-logging</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-utils</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>


<build> <build>
<plugins> <plugins>
Expand Down
Expand Up @@ -15,13 +15,13 @@
*/ */
package io.atomix.event; package io.atomix.event;


import org.slf4j.Logger; import io.atomix.logging.Logger;
import io.atomix.logging.LoggerFactory;


import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;


import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;


/** /**
* Base implementation of an event sink and a registry capable of tracking * Base implementation of an event sink and a registry capable of tracking
Expand All @@ -32,7 +32,7 @@ public class ListenerRegistry<E extends Event, L extends EventListener<E>>


private static final long LIMIT = 1_800; // ms private static final long LIMIT = 1_800; // ms


private final Logger log = getLogger(getClass()); private final Logger log = LoggerFactory.getLogger(getClass());


private long lastStart; private long lastStart;
private L lastListener; private L lastListener;
Expand Down
4 changes: 2 additions & 2 deletions utils/logging/pom.xml → logging/api/pom.xml
Expand Up @@ -18,13 +18,13 @@


<parent> <parent>
<groupId>io.atomix</groupId> <groupId>io.atomix</groupId>
<artifactId>atomix-utils-parent</artifactId> <artifactId>atomix-logging-parent</artifactId>
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>


<packaging>bundle</packaging> <packaging>bundle</packaging>
<artifactId>atomix-logging</artifactId> <artifactId>atomix-logging</artifactId>
<name>Atomix Utilities :: Logging</name> <name>Atomix Logging</name>


<build> <build>
<plugins> <plugins>
Expand Down
66 changes: 66 additions & 0 deletions logging/api/src/main/java/io/atomix/logging/LoggerFactory.java
@@ -0,0 +1,66 @@
/*
* Copyright 2017-present Open Networking Laboratory
*
* 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 io.atomix.logging;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
* Logger factory.
*/
public final class LoggerFactory {
private static volatile LoggingService service;

static {
init();
}

/**
* Initializes the logger factory.
*/
private static void init() {
Iterator<LoggingService> iterator = ServiceLoader.load(LoggingService.class).iterator();
if (!iterator.hasNext()) {
throw new AssertionError("No logging service found");
}
service = iterator.next();
}

/**
* Returns a logger by name.
*
* @param name the logger name
* @return the logger
*/
public static Logger getLogger(String name) {
return service.getLogger(name);
}

/**
* Returns a logger by class.
*
* @param clazz the class for which to return the logger
* @return the logger for the given class
*/
public static Logger getLogger(Class<?> clazz) {
return service.getLogger(clazz);
}

// No constructor.
private LoggerFactory() {
}

}
39 changes: 39 additions & 0 deletions logging/api/src/main/java/io/atomix/logging/LoggingService.java
@@ -0,0 +1,39 @@
/*
* Copyright 2017-present Open Networking Laboratory
*
* 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 io.atomix.logging;

/**
* Logging service.
*/
public interface LoggingService {

/**
* Returns a logger by name.
*
* @param name the logger name
* @return the logger
*/
Logger getLogger(String name);

/**
* Returns a logger by class.
*
* @param clazz the class for which to return the logger
* @return the logger for the given class
*/
Logger getLogger(Class<?> clazz);

}
7 changes: 4 additions & 3 deletions serializers/pom.xml → logging/pom.xml
Expand Up @@ -23,10 +23,11 @@
</parent> </parent>


<packaging>pom</packaging> <packaging>pom</packaging>
<artifactId>atomix-serializers-parent</artifactId> <artifactId>atomix-logging-parent</artifactId>
<name>Atomix Serializers Parent</name> <name>Atomix Logging Parent</name>


<modules> <modules>
<module>kryo</module> <module>api</module>
<module>slf4j</module>
</modules> </modules>
</project> </project>
19 changes: 16 additions & 3 deletions serializers/kryo/pom.xml → logging/slf4j/pom.xml
Expand Up @@ -18,13 +18,26 @@


<parent> <parent>
<groupId>io.atomix</groupId> <groupId>io.atomix</groupId>
<artifactId>atomix-serializers-parent</artifactId> <artifactId>atomix-logging-parent</artifactId>
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>


<packaging>bundle</packaging> <packaging>bundle</packaging>
<artifactId>atomix-kryo</artifactId> <artifactId>atomix-slf4j</artifactId>
<name>Atomix Serializers :: Kryo</name> <name>Atomix Logging :: SLF4J</name>

<dependencies>
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-logging</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>


<build> <build>
<plugins> <plugins>
Expand Down
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package io.atomix.logging.impl; package io.atomix.logging.slf4j;


import io.atomix.logging.Logger; import io.atomix.logging.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
Expand Down
Expand Up @@ -13,15 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package io.atomix.logging; package io.atomix.logging.slf4j;


/** /**
* * Logger factory.
*/ */
public interface LoggingService { public class Slf4jLoggerFactory {

Logger getLogger(String name);

Logger getLogger(Class<?> clazz);

} }
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package io.atomix.logging.impl; package io.atomix.logging.slf4j;


import io.atomix.logging.Logger; import io.atomix.logging.Logger;
import io.atomix.logging.LoggingService; import io.atomix.logging.LoggingService;
Expand Down
@@ -0,0 +1,16 @@
#
# Copyright 2017-present Open Networking Laboratory
#
# 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.
#
io.atomix.logging.slf4j.Slf4jLoggingService
61 changes: 61 additions & 0 deletions messaging/api/pom.xml
@@ -0,0 +1,61 @@
<!--
~ Copyright 2017-present Open Networking Laboratory
~
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.atomix</groupId>
<artifactId>atomix-messaging-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<packaging>bundle</packaging>
<artifactId>atomix-messaging</artifactId>
<name>Atomix Messaging</name>

<dependencies>
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.atomix</groupId>
<artifactId>atomix-cluster</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
io.atomix.*
</Export-Package>
<Import-Package>
!sun.nio.ch,!sun.misc,*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit efdef1d

Please sign in to comment.