Skip to content
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

Better OSGi support #269

Merged
merged 2 commits into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ target/
logs/
*.releaseBackup
*.versionsBackup
.vscode/
.settings/
.project

# Created by './scripts/run_etcd.sh'
/external/
bin/
2 changes: 1 addition & 1 deletion etc/scripts/run_etcd_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ docker run \
--name etcd-ssl \
--hostname etcd-ssl \
--network etcd \
--volume $CERT_HOME:/etc/ssl/etcd \
--volume $CERT_HOME:/etc/ssl/etcd:Z \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's Z option for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Z is for SElinux, it should jave no effects on systems were SELinux is disabled

--publish 42379:2379 \
gcr.io/etcd-development/etcd:${ETCD_VERSION} \
etcd \
Expand Down
60 changes: 56 additions & 4 deletions jetcd-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,27 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>jetcd-all</artifactId>
<packaging>jar</packaging>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>com.coreos</groupId>
<artifactId>jetcd-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coreos</groupId>
<artifactId>jetcd-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coreos</groupId>
<artifactId>jetcd-discovery-dns-srv</artifactId>
<artifactId>jetcd-resolver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coreos</groupId>
<artifactId>jetcd-resolver-dns-srv</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down Expand Up @@ -67,7 +77,8 @@
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>com.coreos.jetcd.shaded.com.google</shadedPattern>
<shadedPattern>com.coreos.jetcd.shaded.com.google
</shadedPattern>
</relocation>
<relocation>
<pattern>io.grpc</pattern>
Expand All @@ -81,11 +92,52 @@
<pattern>javax.annotation</pattern>
<shadedPattern>com.coreos.jetcd.shaded.javax.annotation</shadedPattern>
</relocation>
</relocations>
<relocation>
<pattern>io.opencensus</pattern>
<shadedPattern>com.coreos.jetcd.shaded.io.opencensus
</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>CoreOS :: ${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>com.coreos.jetcd.*</Export-Package>
<Export-Package>
com.coreos.jetcd.common.exception,
com.coreos.jetcd.resolver,
com.coreos.jetcd.resolver.dnssrv,
com.coreos.jetcd,
com.coreos.jetcd.auth,
com.coreos.jetcd.cluster,
com.coreos.jetcd.data,
com.coreos.jetcd.kv,
com.coreos.jetcd.lease,
com.coreos.jetcd.lock,
com.coreos.jetcd.maintenance,
com.coreos.jetcd.op,
com.coreos.jetcd.options,
com.coreos.jetcd.watch
</Export-Package>
<Import-Package>
org.slf4j;version="[1.7,2)",
javax.net.ssl;resolution:=optional
</Import-Package>
</instructions>
<unpackBundle>true</unpackBundle>
</configuration>
</plugin>

</plugins>
</build>

Expand Down
17 changes: 17 additions & 0 deletions jetcd-all/src/main/java/com/coreos/jetcd/all/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright 2017 The jetcd authors
*
* 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 com.coreos.jetcd.all;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line?

101 changes: 101 additions & 0 deletions jetcd-common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2017 The jetcd authors

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">

<parent>
<groupId>com.coreos</groupId>
<artifactId>jetcd-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>jetcd-common</artifactId>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>target/classes</directory>
<includes>
<include>**/META-INF/services/*</include>
</includes>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>com/coreos/jetcd/api/**</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>CoreOS :: ${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>com.coreos.jetcd.common.*;-noimport:=true</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

public class ClosedClientException extends EtcdException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

public class ClosedKeepAliveListenerException extends EtcdException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

public class ClosedSnapshotException extends EtcdException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

public class ClosedWatcherException extends EtcdException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

/**
* CompactedException is thrown when a operation wants to retrieve key at a revision that has
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

import io.grpc.Status;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.coreos.jetcd.exception;
package com.coreos.jetcd.common.exception;

import static com.google.common.base.Preconditions.checkNotNull;
import static io.grpc.Status.fromThrowable;
Expand Down
20 changes: 9 additions & 11 deletions jetcd-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jetcd-common</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jetcd-resolver</artifactId>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
Expand Down Expand Up @@ -194,17 +203,6 @@
<Export-Package>com.coreos.jetcd.*;-noimport:=true</Export-Package>
</instructions>
</configuration>
<executions>
<!--
This execution makes sure that the manifest is available
when the tests are executed
-->
<execution>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
5 changes: 3 additions & 2 deletions jetcd-core/src/main/java/com/coreos/jetcd/ClientBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

import com.coreos.jetcd.common.exception.EtcdException;
import com.coreos.jetcd.common.exception.EtcdExceptionFactory;
import com.coreos.jetcd.data.ByteSequence;
import com.coreos.jetcd.exception.EtcdExceptionFactory;
import com.coreos.jetcd.internal.impl.ClientImpl;
import com.coreos.jetcd.resolver.URIResolverLoader;
import io.grpc.LoadBalancer;
Expand Down Expand Up @@ -208,7 +209,7 @@ public ClientBuilder uriResolverLoader(URIResolverLoader loader) {
* build a new Client.
*
* @return Client instance.
* @throws com.coreos.jetcd.exception.EtcdException if client experiences build error.
* @throws EtcdException if client experiences build error.
*/
public Client build() {
checkState(
Expand Down
9 changes: 6 additions & 3 deletions jetcd-core/src/main/java/com/coreos/jetcd/Lease.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package com.coreos.jetcd;

import com.coreos.jetcd.common.exception.ClosedClientException;
import com.coreos.jetcd.common.exception.ClosedKeepAliveListenerException;
import com.coreos.jetcd.common.exception.EtcdException;
import com.coreos.jetcd.internal.impl.CloseableClient;
import com.coreos.jetcd.lease.LeaseGrantResponse;
import com.coreos.jetcd.lease.LeaseKeepAliveResponse;
Expand Down Expand Up @@ -78,11 +81,11 @@ interface KeepAliveListener {
* Listen for keep-alive events.
*
* @return listen blocks until it receives a LeaseKeepAliveResponse.
* @throws com.coreos.jetcd.exception.ClosedClientException if Lease client has been closed.
* @throws com.coreos.jetcd.exception.ClosedKeepAliveListenerException if listener has been
* @throws ClosedClientException if Lease client has been closed.
* @throws ClosedKeepAliveListenerException if listener has been
* closed.
* @throws InterruptedException if listen is interrupted.
* @throws com.coreos.jetcd.exception.EtcdException if KeepAliveListener encounters client side
* @throws EtcdException if KeepAliveListener encounters client side
* and server side errors.
*/
LeaseKeepAliveResponse listen() throws InterruptedException;
Expand Down
Loading