You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by am...@apache.org on 2019/11/14 09:51:34 UTC
[aries-rsa] 07/09: Fix indentation and whitespace
This is an automated email from the ASF dual-hosted git repository.
amichai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-rsa.git
commit 3c608ada855dddcc3d685630db9d4ad04eb4b257
Author: Amichai Rothman <am...@apache.org>
AuthorDate: Wed Nov 13 11:14:11 2019 +0200
Fix indentation and whitespace
---
Readme.md | 4 +-
discovery/command/Readme.md | 6 +-
.../rsa/discovery/command/EndpointsCommand.java | 9 +-
.../rsa/discovery/config/PropertyValidator.java | 2 +-
discovery/local/Readme.md | 8 +-
discovery/local/bnd.bnd | 4 +-
discovery/local/pom.xml | 4 +-
.../endpoint/EndpointDescriptionParserImpl.java | 8 +-
.../rsa/discovery/endpoint/PropertiesMapper.java | 4 +-
.../local/EndpointDescriptionBundleParser.java | 4 +-
.../aries/rsa/discovery/local/LocalDiscovery.java | 6 +-
.../src/main/resources/endpoint-description.xsd | 4 +-
.../discovery/endpoint/PropertiesMapperTest.java | 2 +-
.../local/EndpointDescriptionBundleParserTest.java | 4 +-
.../rsa/discovery/local/LocalDiscoveryTest.java | 4 +-
discovery/pom.xml | 2 +-
discovery/zookeeper/Readme.md | 12 +-
discovery/zookeeper/pom.xml | 2 +-
.../aries/rsa/discovery/zookeeper/Interest.java | 16 +-
.../rsa/discovery/zookeeper/InterestManager.java | 22 +-
.../zookeeper/PublishingEndpointListener.java | 9 +-
.../discovery/zookeeper/client/ClientManager.java | 2 +-
.../client/ZookeeperEndpointListener.java | 16 +-
.../client/ZookeeperEndpointRepository.java | 25 ++-
.../zookeeper/server/MyZooKeeperServerMain.java | 2 +-
.../zookeeper/server/ZookeeperStarter.java | 2 +-
.../main/resources/OSGI-INF/metatype/zookeeper.xml | 32 +--
.../discovery/zookeeper/InterestManagerTest.java | 8 +-
.../zookeeper/PublishingEndpointListenerTest.java | 2 +-
.../zookeeper/ZookeeperDiscoveryTest.java | 22 +-
.../zookeeper/client/ClientManagerTest.java | 22 +-
.../ZookeeperEndpointRepositoryPathTest.java | 4 +-
.../zookeeper/server/ZookeeperStarterTest.java | 4 +-
discovery/zookeeper/src/test/resources/logback.xml | 4 +-
eapub/bnd.bnd | 4 +-
.../apache/aries/rsa/eapub/EventAdminHelper.java | 4 +-
.../aries/rsa/eapub/EventAdminHelperTest.java | 3 +-
examples/echofastbin/Readme.md | 4 +-
examples/echofastbin/fbapi/bnd.bnd | 6 +-
.../rsa/examples/fastbin/api/EchoService.java | 6 +-
examples/echofastbin/fbconsumer/bnd.bnd | 6 +-
.../examples/fastbin/consumer/EchoConsumer.java | 15 +-
examples/echofastbin/fbservice/bnd.bnd | 4 +-
.../examples/fastbin/service/EchoServiceImpl.java | 50 ++---
examples/echofastbin/pom.xml | 18 +-
examples/echotcp/api/bnd.bnd | 6 +-
examples/echotcp/consumer/bnd.bnd | 6 +-
.../examples/echotcp/consumer/EchoConsumer.java | 2 +-
examples/echotcp/service/bnd.bnd | 4 +-
examples/pom.xml | 4 +-
features/src/main/resources/features.xml | 9 +-
itests/felix/pom.xml | 4 +-
.../apache/aries/rsa/itests/felix/RsaTestBase.java | 30 ++-
.../rsa/itests/felix/TwoContainerPaxExam.java | 5 +-
.../config/TestConfigDiscoveryRoundTrip.java | 22 +-
.../itests/felix/fastbin/TestFastbinRoundTrip.java | 34 ++--
.../rsa/itests/felix/rsa/TestRSAListener.java | 23 +--
.../rsa/itests/felix/tcp/TestDiscoveryExport.java | 6 +-
.../rsa/itests/felix/tcp/TestDiscoveryImport.java | 4 +-
itests/felix/src/test/resources/logback.xml | 4 +-
itests/tck/README.md | 7 +-
itests/tck/pom.xml | 21 +-
itests/tck/tck.bndrun | 4 +-
parent/pom.xml | 30 +--
provider/fastbin/Readme.md | 3 -
provider/fastbin/bnd.bnd | 4 +-
provider/fastbin/pom.xml | 66 +++---
.../aries/rsa/provider/fastbin/Activator.java | 3 +-
.../rsa/provider/fastbin/FastBinProvider.java | 22 +-
.../fastbin/api/ObjectSerializationStrategy.java | 2 -
.../fastbin/api/ProtobufSerializationStrategy.java | 3 -
.../rsa/provider/fastbin/io/ProtocolCodec.java | 7 +-
.../aries/rsa/provider/fastbin/io/Service.java | 1 -
.../aries/rsa/provider/fastbin/io/Transport.java | 9 +-
.../fastbin/io/TransportAcceptListener.java | 4 +-
.../rsa/provider/fastbin/io/TransportListener.java | 7 +-
.../rsa/provider/fastbin/io/TransportServer.java | 4 +-
.../aries/rsa/provider/fastbin/streams/Chunk.java | 4 -
.../provider/fastbin/streams/InputStreamProxy.java | 3 -
.../fastbin/streams/OutputStreamProxy.java | 6 -
.../provider/fastbin/streams/StreamProvider.java | 3 -
.../fastbin/streams/StreamProviderImpl.java | 4 -
.../fastbin/tcp/AbstractInvocationStrategy.java | 8 +-
.../fastbin/tcp/AsyncFutureInvocationStrategy.java | 7 +-
.../fastbin/tcp/AsyncInvocationStrategy.java | 4 +-
.../tcp/AsyncPromiseInvocationStrategy.java | 7 +-
.../fastbin/tcp/BlockingInvocationStrategy.java | 1 -
.../provider/fastbin/tcp/ClientInvokerImpl.java | 1 -
.../rsa/provider/fastbin/tcp/InvocationType.java | 8 +-
.../provider/fastbin/tcp/LengthPrefixedCodec.java | 1 -
.../provider/fastbin/tcp/ServerInvokerImpl.java | 6 -
.../rsa/provider/fastbin/tcp/TcpTransport.java | 11 +-
.../provider/fastbin/tcp/TcpTransportFactory.java | 2 -
.../provider/fastbin/tcp/TcpTransportServer.java | 1 -
.../fastbin/util/IntrospectionSupport.java | 28 ++-
.../rsa/provider/fastbin/util/StringSupport.java | 4 +-
.../rsa/provider/fastbin/util/URISupport.java | 4 +-
.../rsa/provider/fastbin/util/UuidGenerator.java | 27 ++-
.../rsa/provider/fastbin/FutureInvocationTest.java | 52 ++---
.../aries/rsa/provider/fastbin/InvocationTest.java | 205 +++++++++----------
.../aries/rsa/provider/fastbin/ManagerTest.java | 1 -
.../provider/fastbin/PromiseInvocationTest.java | 34 +---
.../rsa/provider/fastbin/StreamInvocationTest.java | 22 +-
.../rsa/provider/fastbin/TransportFailureTest.java | 1 -
.../fastbin/streams/InputStreamProxyTest.java | 8 +-
.../fastbin/streams/OutputStreamProxyTest.java | 3 -
.../fastbin/tcp/LengthPrefixedCodecTest.java | 222 ++++++++++-----------
provider/pom.xml | 4 +-
provider/tcp/bnd.bnd | 6 +-
provider/tcp/pom.xml | 54 ++---
.../rsa/provider/tcp/EndpointPropertiesParser.java | 14 +-
.../aries/rsa/provider/tcp/MethodInvoker.java | 8 +-
.../apache/aries/rsa/provider/tcp/TCPProvider.java | 8 +-
.../apache/aries/rsa/provider/tcp/TCPServer.java | 4 +-
.../apache/aries/rsa/provider/tcp/TcpEndpoint.java | 5 +-
.../rsa/provider/tcp/TcpInvocationHandler.java | 4 +-
.../provider/tcp/ser/BasicObjectInputStream.java | 2 +-
.../aries/rsa/provider/tcp/ser/DTOMarker.java | 8 +-
.../aries/rsa/provider/tcp/ser/VersionMarker.java | 8 +-
.../aries/rsa/provider/tcp/ActivatorTest.java | 6 +-
.../aries/rsa/provider/tcp/EndpointParserTest.java | 12 +-
.../aries/rsa/provider/tcp/TcpEndpointTest.java | 7 +-
.../rsa/provider/tcp/TcpProviderIntentTest.java | 9 +-
.../rsa/provider/tcp/TcpProviderPrimitiveTest.java | 32 +--
.../aries/rsa/provider/tcp/TcpProviderTest.java | 30 +--
.../rsa/provider/tcp/myservice/MyService.java | 10 +-
.../rsa/provider/tcp/myservice/MyServiceImpl.java | 16 +-
.../provider/tcp/myservice/PrimitiveService.java | 10 +-
.../tcp/myservice/PrimitiveServiceImpl.java | 10 +-
repository/pom.xml | 6 +-
rsa/Readme.md | 4 +-
rsa/bnd.bnd | 4 +-
.../rsa/core/DistributionProviderTracker.java | 6 +-
.../aries/rsa/core/ExportRegistrationImpl.java | 8 +-
.../org/apache/aries/rsa/core/PackageUtil.java | 4 +-
.../aries/rsa/core/RemoteServiceAdminCore.java | 41 ++--
.../aries/rsa/core/event/EventAdminSender.java | 26 +--
.../apache/aries/rsa/core/event/EventProducer.java | 5 +-
.../aries/rsa/core/ClientServiceFactoryTest.java | 12 +-
.../rsa/core/DistributionProviderTrackerTest.java | 15 +-
.../aries/rsa/core/OverlayPropertiesTest.java | 4 +-
.../aries/rsa/core/RemoteServiceAdminCoreTest.java | 22 +-
.../aries/rsa/core/event/EventProducerTest.java | 8 +-
.../apache/aries/rsa/spi/DistributionProvider.java | 10 +-
.../aries/rsa/spi/EndpointDescriptionParser.java | 6 +-
.../org/apache/aries/rsa/spi/ExportPolicy.java | 7 +-
.../org/apache/aries/rsa/util/EndpointHelper.java | 2 +-
.../java/org/apache/aries/rsa/util/StringPlus.java | 2 +-
topology-manager/Readme.md | 6 +-
topology-manager/pom.xml | 10 +-
.../aries/rsa/topologymanager/Activator.java | 4 +-
.../EndpointEventListenerTracker.java | 8 +-
.../exporter/EndpointListenerAdapter.java | 2 +-
.../exporter/EndpointListenerNotifier.java | 12 +-
.../exporter/ServiceExportsRepository.java | 20 +-
.../exporter/TopologyManagerExport.java | 10 +-
.../rsa/topologymanager/importer/MultiMap.java | 4 +-
.../importer/TopologyManagerImport.java | 16 +-
.../importer/local/EndpointListenerManager.java | 15 +-
.../importer/local/FilterHelper.java | 12 +-
.../topologymanager/importer/local/RSFindHook.java | 8 +-
.../aries/rsa/topologymanager/ActivatorTest.java | 2 +-
.../exporter/EndpointListenerNotifierTest.java | 20 +-
.../exporter/RecordingEndpointEventListener.java | 4 +-
.../exporter/TopologyManagerExportTest.java | 4 +-
.../importer/TopologyManagerImportTest.java | 4 +-
.../importer/local/EndpointListenerImplTest.java | 6 +-
.../importer/local/FilterHelperTest.java | 18 +-
.../importer/local/ListenerHookImplTest.java | 6 +-
169 files changed, 945 insertions(+), 1154 deletions(-)
diff --git a/Readme.md b/Readme.md
index 544c494..84b02cf 100644
--- a/Readme.md
+++ b/Readme.md
@@ -29,15 +29,13 @@ The discovery providers are responsible for finding the available endpoint descr
mvn clean release:prepare -DskipTests -Darguments=-DskipTests
mvn release:perform -DskipTests -Darguments=-DskipTests
-
+
This creates a staging repository. After all artifacts are deployed login to the [Apache maven repo](https://repository.apache.org) and close the staging repository.
### Vote
### Promote in Apache Repository
-
-
### Copy to apache release svn
The source zip needs to be copied to the [Apache release svn](https://dist.apache.org/repos/dist/release/aries).
diff --git a/discovery/command/Readme.md b/discovery/command/Readme.md
index 622e6ff..38951c9 100644
--- a/discovery/command/Readme.md
+++ b/discovery/command/Readme.md
@@ -1,15 +1,13 @@
# Discovery Gogo Commands
-
## endpoints
Lists all discovered endpoints
- endpoints
+ endpoints
## endpoint
Shows the properties of an endpoint identified by its id
-
- endpoint <id>
+ endpoint <id>
diff --git a/discovery/command/src/main/java/org/apache/aries/rsa/discovery/command/EndpointsCommand.java b/discovery/command/src/main/java/org/apache/aries/rsa/discovery/command/EndpointsCommand.java
index 54d313a..8df5aea 100644
--- a/discovery/command/src/main/java/org/apache/aries/rsa/discovery/command/EndpointsCommand.java
+++ b/discovery/command/src/main/java/org/apache/aries/rsa/discovery/command/EndpointsCommand.java
@@ -37,17 +37,16 @@ import org.osgi.service.remoteserviceadmin.EndpointEventListener;
"osgi.command.function=endpoints",
"osgi.command.function=endpoint",
"endpoint.listener.scope=(endpoint.framework.uuid=*)"
-
})
public class EndpointsCommand implements EndpointEventListener {
Set<EndpointDescription> endpoints = new HashSet<>();
private String frameworkId;
-
+
@Activate
public void activate(BundleContext context) {
this.frameworkId = context.getProperty(Constants.FRAMEWORK_UUID);
}
-
+
public void endpoint(String id) {
EndpointDescription epd = getEndpoint(id);
ShellTable table = new ShellTable();
@@ -114,12 +113,12 @@ public class EndpointsCommand implements EndpointEventListener {
case EndpointEvent.REMOVED:
endpoints.remove(endpoint);
break;
-
+
case EndpointEvent.MODIFIED:
endpoints.remove(endpoint);
endpoints.add(endpoint);
break;
-
+
case EndpointEvent.MODIFIED_ENDMATCH:
endpoints.remove(endpoint);
break;
diff --git a/discovery/config/src/main/java/org/apache/aries/rsa/discovery/config/PropertyValidator.java b/discovery/config/src/main/java/org/apache/aries/rsa/discovery/config/PropertyValidator.java
index b4c5c55..4c9e4b5 100644
--- a/discovery/config/src/main/java/org/apache/aries/rsa/discovery/config/PropertyValidator.java
+++ b/discovery/config/src/main/java/org/apache/aries/rsa/discovery/config/PropertyValidator.java
@@ -53,7 +53,7 @@ class PropertyValidator {
static String[] convertToStringArray(Object o) {
String[] result;
-
+
if (o == null) {
result = new String[0];
} else if (o instanceof List) {
diff --git a/discovery/local/Readme.md b/discovery/local/Readme.md
index c0e5303..a7c0eb2 100644
--- a/discovery/local/Readme.md
+++ b/discovery/local/Readme.md
@@ -1,11 +1,11 @@
# Local Discovery
Scans bundles for endpoint descriptions in the path `OSGI-INF/remote-service/*.xml`. The descriptions must
-use the namespace http://www.osgi.org/xmlns/rsa/v1.0.0 defined in the Remote Service Admin Spec.
-Each endpoint-description record in the file represents a remote endpoint.
+use the namespace http://www.osgi.org/xmlns/rsa/v1.0.0 defined in the Remote Service Admin Spec.
+Each endpoint-description record in the file represents a remote endpoint.
-The local discovery module will notify all interested EndpointListeners of each described endpoint.
-This will cause the TopologyManager to let the RemoteServiceAdmin create local proxy services for
+The local discovery module will notify all interested EndpointListeners of each described endpoint.
+This will cause the TopologyManager to let the RemoteServiceAdmin create local proxy services for
the remote endpoints.
## Example
diff --git a/discovery/local/bnd.bnd b/discovery/local/bnd.bnd
index 49cbb3e..3069835 100644
--- a/discovery/local/bnd.bnd
+++ b/discovery/local/bnd.bnd
@@ -6,9 +6,9 @@
# to you 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
diff --git a/discovery/local/pom.xml b/discovery/local/pom.xml
index aff4b5c..1ae7e08 100644
--- a/discovery/local/pom.xml
+++ b/discovery/local/pom.xml
@@ -27,7 +27,7 @@
<version>1.15.0-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
-
+
<groupId>org.apache.aries.rsa.discovery</groupId>
<artifactId>org.apache.aries.rsa.discovery.local</artifactId>
<packaging>jar</packaging>
@@ -66,7 +66,7 @@
</execution>
</executions>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
diff --git a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/EndpointDescriptionParserImpl.java b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/EndpointDescriptionParserImpl.java
index e82124f..f4c8145 100644
--- a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/EndpointDescriptionParserImpl.java
+++ b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/EndpointDescriptionParserImpl.java
@@ -64,7 +64,7 @@ public class EndpointDescriptionParserImpl implements EndpointDescriptionParser
throw new RuntimeException(ex.getMessage(), ex);
}
}
-
+
public List<EndpointDescription> readEndpoints(InputStream is) {
List<EndpointDescriptionType> epdts = readEpdts(is);
List<EndpointDescription> epds = new ArrayList<>();
@@ -73,7 +73,7 @@ public class EndpointDescriptionParserImpl implements EndpointDescriptionParser
}
return epds;
}
-
+
public EndpointDescription readEndpoint(InputStream is) {
List<EndpointDescription> endpoints = readEndpoints(is);
if (endpoints.isEmpty()) {
@@ -85,7 +85,7 @@ public class EndpointDescriptionParserImpl implements EndpointDescriptionParser
public void writeEndpoint(EndpointDescription epd, OutputStream os) {
writeEpdt(convert(epd), os);
}
-
+
private void writeEpdt(EndpointDescriptionType endpointDescription, OutputStream os) {
try {
Marshaller marshaller = jaxbContext.createMarshaller();
@@ -119,8 +119,6 @@ public class EndpointDescriptionParserImpl implements EndpointDescriptionParser
private EndpointDescription convert(EndpointDescriptionType epdt) {
Map<String, Object> props = new PropertiesMapper().toProps(epdt.getProperty());
return new EndpointDescription(props);
-
}
-
}
diff --git a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java
index 3843dce..257d12e 100644
--- a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java
+++ b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java
@@ -148,7 +148,7 @@ class PropertiesMapper {
}
return value;
}
-
+
private Object getValue(ValueType value, String type) {
if (value.getContent().size() == 1 && value.getContent().get(0) instanceof String) {
return handleValue((String)value.getContent().get(0), type);
@@ -229,7 +229,7 @@ class PropertiesMapper {
return null;
}
}
-
+
public List<PropertyType> fromProps(Map<String, Object> m) {
List<PropertyType> props = new ArrayList<>();
for (Map.Entry<String, Object> entry : m.entrySet()) {
diff --git a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java
index 084b8b2..e45af33 100644
--- a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java
+++ b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParser.java
@@ -56,10 +56,10 @@ public final class EndpointDescriptionBundleParser {
}
return elements;
}
-
+
private Enumeration<URL> getEndpointDescriptionURLs(Bundle b) {
String origDir = getRemoteServicesDir(b);
-
+
// Split origDir into dir and file pattern
String filePattern = "*.xml";
String dir;
diff --git a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/LocalDiscovery.java b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/LocalDiscovery.java
index 53159cd..a98a717 100644
--- a/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/LocalDiscovery.java
+++ b/discovery/local/src/main/java/org/apache/aries/rsa/discovery/local/LocalDiscovery.java
@@ -59,14 +59,14 @@ public class LocalDiscovery implements BundleListener {
public LocalDiscovery() {
this.bundleParser = new EndpointDescriptionBundleParser();
}
-
+
@Activate
public void activate(BundleContext context) {
Bundle[] bundles = context.getBundles();
processExistingBundles(bundles);
context.addBundleListener(this);
}
-
+
@Deactivate
public void deactivate(BundleContext context) {
context.removeBundleListener(this);
@@ -209,7 +209,7 @@ public class LocalDiscovery implements BundleListener {
if (filter == null) {
return false;
}
-
+
try {
Filter f = FrameworkUtil.createFilter(filter);
Dictionary<String, Object> dict = new Hashtable<>(endpoint.getProperties());
diff --git a/discovery/local/src/main/resources/endpoint-description.xsd b/discovery/local/src/main/resources/endpoint-description.xsd
index 0f3aa85..240ee63 100644
--- a/discovery/local/src/main/resources/endpoint-description.xsd
+++ b/discovery/local/src/main/resources/endpoint-description.xsd
@@ -21,7 +21,7 @@
<element name="endpoint-descriptions"
type="tns:EndpointDescriptionsType">
</element>
-
+
<complexType name="EndpointDescriptionsType">
<sequence>
<element maxOccurs="unbounded" minOccurs="0"
@@ -76,4 +76,4 @@
<element ref="tns:xml"></element>
</sequence>
</complexType>
-</schema>
\ No newline at end of file
+</schema>
diff --git a/discovery/local/src/test/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapperTest.java b/discovery/local/src/test/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapperTest.java
index 3014584..9e94101 100644
--- a/discovery/local/src/test/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapperTest.java
+++ b/discovery/local/src/test/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapperTest.java
@@ -85,7 +85,7 @@ public class PropertiesMapperTest {
System.out.println(new String(epData));
URL edURL = getClass().getResource("/ed2-generated.xml");
InputSource expectedXml = new InputSource(edURL.openStream());
- InputSource actualXml = new InputSource(new ByteArrayInputStream(epData));
+ InputSource actualXml = new InputSource(new ByteArrayInputStream(epData));
XMLAssert.assertXMLEqual(expectedXml, actualXml);
}
diff --git a/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParserTest.java b/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParserTest.java
index 7fc197e..a6d81e1 100644
--- a/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParserTest.java
+++ b/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/EndpointDescriptionBundleParserTest.java
@@ -54,7 +54,7 @@ public class EndpointDescriptionBundleParserTest extends TestCase {
EasyMock.replay(b);
return b;
}
-
+
@Test
public void testNoRemoteServicesXMLFiles() {
Bundle b = EasyMock.createNiceMock(Bundle.class);
@@ -149,7 +149,7 @@ public class EndpointDescriptionBundleParserTest extends TestCase {
List<?> l = (List<?>) props.get("other2");
assertEquals(1, l.size());
- assertEquals(EndpointDescriptionBundleParserTest.normXML("<other:t2 xmlns:other='http://www.acme.org/xmlns/other/v1.0.0' "
+ assertEquals(EndpointDescriptionBundleParserTest.normXML("<other:t2 xmlns:other='http://www.acme.org/xmlns/other/v1.0.0' "
+ "xmlns='http://www.osgi.org/xmlns/rsa/v1.0.0'/>"),
EndpointDescriptionBundleParserTest.normXML((String) l.get(0)));
}
diff --git a/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/LocalDiscoveryTest.java b/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/LocalDiscoveryTest.java
index c2e4a82..565d75c 100644
--- a/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/LocalDiscoveryTest.java
+++ b/discovery/local/src/test/java/org/apache/aries/rsa/discovery/local/LocalDiscoveryTest.java
@@ -301,7 +301,7 @@ public class LocalDiscoveryTest {
props.put(EndpointEventListener.ENDPOINT_LISTENER_SCOPE, new String[] {scope});
return mockService(props);
}
-
+
private ServiceReference<EndpointEventListener> mockService(final Map<String, Object> props) {
@SuppressWarnings("unchecked")
ServiceReference<EndpointEventListener> sr = EasyMock.createMock(ServiceReference.class);
@@ -311,7 +311,7 @@ public class LocalDiscoveryTest {
return props.get(EasyMock.getCurrentArguments()[0]);
}
}).anyTimes();
-
+
EasyMock.replay(sr);
return sr;
}
diff --git a/discovery/pom.xml b/discovery/pom.xml
index 6706855..077f0eb 100644
--- a/discovery/pom.xml
+++ b/discovery/pom.xml
@@ -26,7 +26,7 @@
<version>1.15.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
-
+
<artifactId>org.apache.aries.rsa.discovery</artifactId>
<packaging>pom</packaging>
<name>Aries Remote Service Admin Discovery</name>
diff --git a/discovery/zookeeper/Readme.md b/discovery/zookeeper/Readme.md
index a5599db..7a008ad 100644
--- a/discovery/zookeeper/Readme.md
+++ b/discovery/zookeeper/Readme.md
@@ -1,6 +1,6 @@
# Zookeeper Discovery
-Manages endpoint descriptions as zookeeper nodes.
+Manages endpoint descriptions as zookeeper nodes.
* Local endpoints are published to zookeeper
* Interests for services in the form of EndpointListener scopes are looked up in zookeeper and the listeners are informed about any changes
@@ -22,11 +22,11 @@ At least an empty config must be present to start the zookeeper discovery. The k
PID: org.apache.aries.rsa.discovery.zookeeper.server
-| Key | Default | Description
-| ------------------| -------------:| --------------------------------------------
-| clientPort | 2181 | Port to listen on for client connections
-| tickTime | 2000 |
-| initLimit | 10 |
+| Key | Default | Description
+| ------------------| -------------:| --------------------------------------------
+| clientPort | 2181 | Port to listen on for client connections
+| tickTime | 2000 |
+| initLimit | 10 |
| syncLimit | 5 |
| dataDir | zkdata |
diff --git a/discovery/zookeeper/pom.xml b/discovery/zookeeper/pom.xml
index 08c5b88..bd3f7e9 100644
--- a/discovery/zookeeper/pom.xml
+++ b/discovery/zookeeper/pom.xml
@@ -81,7 +81,7 @@
<artifactId>org.apache.aries.rsa.discovery.local</artifactId>
<version>${project.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/Interest.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/Interest.java
index 8549055..21c2eaf 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/Interest.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/Interest.java
@@ -35,21 +35,21 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("deprecation")
public class Interest {
private static final Logger LOG = LoggerFactory.getLogger(Interest.class);
-
+
private final ServiceReference<?> sref;
private final List<String> scopes;
private final Object epListener;
-
+
public Interest(ServiceReference<?> sref) {
this(sref, null);
}
-
+
public Interest(ServiceReference<?> sref, Object epListener) {
this.sref = sref;
this.scopes = StringPlus.normalize(sref.getProperty(ENDPOINT_LISTENER_SCOPE));
this.epListener = epListener;
}
-
+
public List<String> getScopes() {
return scopes;
}
@@ -57,7 +57,7 @@ public class Interest {
public Object getEpListener() {
return epListener;
}
-
+
public void notifyListener(EndpointEvent event) {
EndpointDescription endpoint = event.getEndpoint();
Optional<String> currentScope = getFirstMatch(endpoint);
@@ -71,7 +71,7 @@ public class Interest {
}
}
}
-
+
private Optional<String> getFirstMatch(EndpointDescription endpoint) {
return scopes.stream().filter(endpoint::matches).findFirst();
}
@@ -82,7 +82,7 @@ public class Interest {
listener, currentScope, event.getType(), endpoint);
listener.endpointChanged(event, currentScope);
}
-
+
private void notifyEListener(EndpointEvent event, String currentScope, EndpointListener listener) {
EndpointDescription endpoint = event.getEndpoint();
LOG.info("Calling old listener on class {} for filter {}, type {}, endpoint {} ",
@@ -132,5 +132,5 @@ public class Interest {
public String toString() {
return "Interest [scopes=" + scopes + ", epListener=" + epListener.getClass() + "]";
}
-
+
}
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/InterestManager.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/InterestManager.java
index e4b6de0..3d4f59e 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/InterestManager.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/InterestManager.java
@@ -47,18 +47,18 @@ public class InterestManager {
private static final Logger LOG = LoggerFactory.getLogger(InterestManager.class);
private Set<Interest> interests = ConcurrentHashMap.newKeySet();
-
+
private ZookeeperEndpointListener listener;
-
+
public InterestManager() {
}
-
+
// Using ARepository name to make sure it is injected first
@Reference
public void bindARepository(ZookeeperEndpointRepository repository) {
this.listener = repository.createListener(this::onEndpointChanged);
}
-
+
@Deactivate
public void deactivate() {
this.listener.close();
@@ -68,16 +68,16 @@ public class InterestManager {
private void onEndpointChanged(EndpointEvent event, String filter) {
interests.forEach(interest -> interest.notifyListener(event));
}
-
+
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void bindEndpointEventListener(ServiceReference<EndpointEventListener> sref, EndpointEventListener epListener) {
addInterest(sref, epListener);
}
-
+
public void updatedEndpointEventListener(ServiceReference<EndpointEventListener> sref, EndpointEventListener epListener) {
addInterest(sref, epListener);
}
-
+
public void unbindEndpointEventListener(ServiceReference<EndpointEventListener> sref) {
interests.remove(new Interest(sref));
}
@@ -86,11 +86,11 @@ public class InterestManager {
public void bindEndpointListener(ServiceReference<EndpointListener> sref, EndpointListener epListener) {
addInterest(sref, epListener);
}
-
+
public void updatedEndpointListener(ServiceReference<EndpointListener> sref, EndpointListener epListener) {
addInterest(sref, epListener);
}
-
+
public void unbindEndpointListener(ServiceReference<EndpointListener> sref) {
interests.remove(new Interest(sref));
}
@@ -115,9 +115,9 @@ public class InterestManager {
private static boolean isOurOwnEndpointEventListener(ServiceReference<?> endpointEventListener) {
return Boolean.parseBoolean(String.valueOf(
- endpointEventListener.getProperty(ClientManager.DISCOVERY_ZOOKEEPER_ID)));
+ endpointEventListener.getProperty(ClientManager.DISCOVERY_ZOOKEEPER_ID)));
}
-
+
Set<Interest> getInterests() {
return interests;
}
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListener.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListener.java
index 01b2691..d5526fc 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListener.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListener.java
@@ -37,7 +37,7 @@ import org.osgi.service.remoteserviceadmin.EndpointListener;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
/**
- * Listens for local {@link EndpointEvent}s using {@link EndpointEventListener} and old style {@link EndpointListener}
+ * Listens for local {@link EndpointEvent}s using {@link EndpointEventListener} and old style {@link EndpointListener}
* and publishes changes to the {@link ZooKeeperEndpointRepository}
*/
@SuppressWarnings("deprecation")
@@ -45,7 +45,7 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
public class PublishingEndpointListener implements EndpointEventListener, EndpointListener {
private ServiceRegistration<?> listenerReg;
-
+
@Reference
private ZookeeperEndpointRepository repository;
@@ -66,7 +66,7 @@ public class PublishingEndpointListener implements EndpointEventListener, Endpoi
public void endpointChanged(EndpointEvent event, String filter) {
repository.endpointChanged(event);
}
-
+
@Override
public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
endpointChanged(new EndpointEvent(EndpointEvent.ADDED, endpoint), matchedFilter);
@@ -78,7 +78,7 @@ public class PublishingEndpointListener implements EndpointEventListener, Endpoi
}
private Dictionary<String, String> serviceProperties(String uuid) {
- String scope = String.format("(&(%s=*)(%s=%s))", Constants.OBJECTCLASS,
+ String scope = String.format("(&(%s=*)(%s=%s))", Constants.OBJECTCLASS,
RemoteConstants.ENDPOINT_FRAMEWORK_UUID, uuid);
Dictionary<String, String> props = new Hashtable<>();
props.put(EndpointEventListener.ENDPOINT_LISTENER_SCOPE, scope);
@@ -86,5 +86,4 @@ public class PublishingEndpointListener implements EndpointEventListener, Endpoi
return props;
}
-
}
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java
index e538d22..b3aaad0 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManager.java
@@ -82,7 +82,7 @@ public class ClientManager implements Watcher {
public synchronized void stop() {
// Load ZooTrace class early to avoid ClassNotFoundException on shutdown
ZooTrace.getTextTraceLevel();
-
+
if (reg != null) {
reg.unregister();
}
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointListener.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointListener.java
index 65fc952..fbacfe4 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointListener.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointListener.java
@@ -40,26 +40,26 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Listens to endpoint changes in Zookeeper and forwards changes in Endpoints to InterestManager.
+ * Listens to endpoint changes in Zookeeper and forwards changes in Endpoints to InterestManager.
*/
public class ZookeeperEndpointListener implements Closeable {
private static final Logger LOG = LoggerFactory.getLogger(ZookeeperEndpointListener.class);
-
+
private Map<String, EndpointDescription> endpoints = new ConcurrentHashMap<>();
-
+
private ZooKeeper zk;
-
+
private EndpointDescriptionParser parser;
-
+
private EndpointEventListener listener;
-
+
ZookeeperEndpointListener(ZooKeeper zk, EndpointDescriptionParser parser, EndpointEventListener listener) {
this.zk = zk;
this.parser = parser;
this.listener = listener;
watchRecursive(ZookeeperEndpointRepository.PATH_PREFIX);
}
-
+
public void sendExistingEndpoints(Interest interest) {
endpoints.values().stream()
.map(endpoint -> new EndpointEvent(EndpointEvent.ADDED, endpoint))
@@ -111,7 +111,7 @@ public class ZookeeperEndpointListener implements Closeable {
LOG.info(e.getMessage(), e);
}
}
-
+
private void onChanged(String path, EndpointDescription endpoint) {
EndpointDescription old = endpoints.put(path, endpoint);
int type = old == null ? EndpointEvent.ADDED : EndpointEvent.MODIFIED;
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepository.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepository.java
index 7880489..4e2472a 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepository.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepository.java
@@ -43,34 +43,34 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Is called by PublishingEndpointListener with local Endpoint changes and forward the changes to Zookeeper.
+ * Is called by PublishingEndpointListener with local Endpoint changes and forward the changes to Zookeeper.
*/
@Component(service = ZookeeperEndpointRepository.class)
public class ZookeeperEndpointRepository {
public static final String PATH_PREFIX = "/osgi/service_registry";
private static final Logger LOG = LoggerFactory.getLogger(ZookeeperEndpointRepository.class);
private final Map<Integer, String> typeNames = new HashMap<>();
-
+
@Reference
private ZooKeeper zk;
-
+
@Reference
private EndpointDescriptionParser parser;
-
+
public ZookeeperEndpointRepository() {
typeNames.put(EndpointEvent.ADDED, "added");
typeNames.put(EndpointEvent.MODIFIED, "modified");
typeNames.put(EndpointEvent.MODIFIED_ENDMATCH, "modified");
typeNames.put(EndpointEvent.REMOVED, "removed");
}
-
+
public ZookeeperEndpointRepository(ZooKeeper zk, EndpointDescriptionParser parser) {
this();
this.zk = zk;
this.parser = parser;
}
- @Activate
+ @Activate
public void activate() {
try {
createPath(PATH_PREFIX);
@@ -78,7 +78,7 @@ public class ZookeeperEndpointRepository {
throw new IllegalStateException("Unable to create base path", e);
}
}
-
+
public ZookeeperEndpointListener createListener(EndpointEventListener listener) {
return new ZookeeperEndpointListener(zk, parser, listener);
}
@@ -104,13 +104,12 @@ public class ZookeeperEndpointRepository {
logException(typeNames.get(event.getType()), event.getEndpoint(), e);
}
}
-
+
private void logException(String operation, EndpointDescription endpoint, Exception ex) {
String msg = String.format("Exception during %s of endpoint %s", operation, endpoint.getId());
LOG.error(msg, ex);
}
-
private void add(EndpointDescription endpoint) throws KeeperException, InterruptedException {
String path = getZooKeeperPath(endpoint.getId());
LOG.info("Exporting path: {}, Endpoint: {}", path, endpoint);
@@ -125,13 +124,13 @@ public class ZookeeperEndpointRepository {
createBasePath();
zk.setData(path, getData(endpoint), -1);
}
-
+
private void remove(EndpointDescription endpoint) throws KeeperException, InterruptedException {
String path = getZooKeeperPath(endpoint.getId());
LOG.info("Removing endpoint in zookeeper. Endpoint: {}, Path: {}", endpoint, path);
zk.delete(path, -1);
}
-
+
private boolean notEmpty(String part) {
return part != null && !part.isEmpty();
}
@@ -150,7 +149,7 @@ public class ZookeeperEndpointRepository {
parser.writeEndpoint(epd, bos);
return bos.toByteArray();
}
-
+
private void createEphemeralNode(String fullPath, byte[] data) throws KeeperException, InterruptedException {
try {
zk.create(fullPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
@@ -168,7 +167,7 @@ public class ZookeeperEndpointRepository {
zk.create(fullPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
}
}
-
+
private void createPath(String path) throws KeeperException, InterruptedException {
List<String> parts = asList(path.split("/")).stream()
.filter(this::notEmpty)
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/MyZooKeeperServerMain.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/MyZooKeeperServerMain.java
index 7176efe..a99275e 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/MyZooKeeperServerMain.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/MyZooKeeperServerMain.java
@@ -27,7 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class MyZooKeeperServerMain extends ZooKeeperServerMain implements ZookeeperServer {
- private static final Logger LOG = LoggerFactory.getLogger(MyZooKeeperServerMain.class);
+ private static final Logger LOG = LoggerFactory.getLogger(MyZooKeeperServerMain.class);
private QuorumPeerConfig config;
diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java
index 4e06361..893a449 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarter.java
@@ -108,7 +108,7 @@ public class ZookeeperStarter {
* Remove entries whose values are empty from the given dictionary.
*
* @param dict a dictionary
- * @return
+ * @return
*/
private static Properties copyWithoutEmptyValues(Map<String, ?> dict) {
Properties props = new Properties();
diff --git a/discovery/zookeeper/src/main/resources/OSGI-INF/metatype/zookeeper.xml b/discovery/zookeeper/src/main/resources/OSGI-INF/metatype/zookeeper.xml
index 04fcc46..e93af3d 100644
--- a/discovery/zookeeper/src/main/resources/OSGI-INF/metatype/zookeeper.xml
+++ b/discovery/zookeeper/src/main/resources/OSGI-INF/metatype/zookeeper.xml
@@ -18,26 +18,26 @@
under the License.
-->
<MetaData xmlns="http://www.osgi.org/xmlns/metatype/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.osgi.org/xmlns/metatype/v1.0.0 http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd
- ">
- <OCD description="" name="Zookeeper server config" id="zookeeper.server">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/metatype/v1.0.0 http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd
+ ">
+ <OCD description="" name="Zookeeper server config" id="zookeeper.server">
<AD id="clientPort" required="false" type="String" default="2181" description=""/>
- <AD id="tickTime" required="false" type="String" default="2000" description=""/>
+ <AD id="tickTime" required="false" type="String" default="2000" description=""/>
<AD id="initLimit" required="false" type="String" default="10" description=""/>
<AD id="syncLimit" required="false" type="String" default="5" description=""/>
- </OCD>
- <Designate pid="org.apache.aries.rsa.discovery.zookeeper.server">
- <Object ocdref="zookeeper.server"/>
- </Designate>
-
- <OCD description="" name="Zookeeper discovery config" id="zookeeper.discovery">
+ </OCD>
+ <Designate pid="org.apache.aries.rsa.discovery.zookeeper.server">
+ <Object ocdref="zookeeper.server"/>
+ </Designate>
+
+ <OCD description="" name="Zookeeper discovery config" id="zookeeper.discovery">
<AD id="zookeeper.host" required="false" type="String" default="localhost" description=""/>
<AD id="zookeeper.port" required="false" type="String" default="2181" description=""/>
<AD id="zookeeper.timeout" required="false" type="String" default="3000" description=""/>
- </OCD>
- <Designate pid="org.apache.aries.rsa.discovery.zookeeper">
+ </OCD>
+ <Designate pid="org.apache.aries.rsa.discovery.zookeeper">
<Object ocdref="zookeeper.discovery"/>
- </Designate>
-</MetaData>
\ No newline at end of file
+ </Designate>
+</MetaData>
diff --git a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/InterestManagerTest.java b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/InterestManagerTest.java
index 1b104be..15b2327 100644
--- a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/InterestManagerTest.java
+++ b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/InterestManagerTest.java
@@ -33,13 +33,13 @@ import org.osgi.service.remoteserviceadmin.EndpointEventListener;
@RunWith(MockitoJUnitRunner.class)
public class InterestManagerTest {
-
+
@Mock
private ZookeeperEndpointRepository repository;
-
+
@Mock
private EndpointEventListener epListener1;
-
+
@Mock
private EndpointEventListener epListener2;
@@ -47,7 +47,7 @@ public class InterestManagerTest {
private ZookeeperEndpointListener listener;
private InterestManager im;
-
+
@Test
public void testEndpointListenerTrackerCustomizer() {
when(repository.createListener(Mockito.any())).thenReturn(listener);
diff --git a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListenerTest.java b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListenerTest.java
index 50a05aa..25dd622 100644
--- a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListenerTest.java
+++ b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/PublishingEndpointListenerTest.java
@@ -50,7 +50,7 @@ public class PublishingEndpointListenerTest {
eli.endpointChanged(event1, null);
EndpointEvent event2 = new EndpointEvent(EndpointEvent.REMOVED, endpoint);
eli.endpointChanged(event2, null);
-
+
verify(repository).endpointChanged(event1);
verify(repository).endpointChanged(event2);
}
diff --git a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/ZookeeperDiscoveryTest.java b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/ZookeeperDiscoveryTest.java
index b2cf46e..bcb7fd0 100644
--- a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/ZookeeperDiscoveryTest.java
+++ b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/ZookeeperDiscoveryTest.java
@@ -73,7 +73,7 @@ public class ZookeeperDiscoveryTest {
private ServerCnxnFactory factory;
private List<EndpointEvent> events = new ArrayList<>();
private EndpointDescriptionParserImpl parser = new EndpointDescriptionParserImpl();
-
+
@Mock
private ServiceReference<EndpointEventListener> sref;
@@ -83,10 +83,10 @@ public class ZookeeperDiscoveryTest {
zk = new ZooKeeper("localhost:" + server.getClientPort(), 1000, this::process);
printNodes("/");
}
-
+
@After
public void after() throws InterruptedException {
- //zk.close(); // Seems to cause SessionTimeout error
+ //zk.close(); // Seems to cause SessionTimeout error
factory.shutdown();
}
@@ -96,24 +96,24 @@ public class ZookeeperDiscoveryTest {
repository.activate();
InterestManager im = new InterestManager();
im.bindARepository(repository);
-
+
String scope = "("+ Constants.OBJECTCLASS +"=*)";
Mockito.when(sref.getProperty(Mockito.eq(EndpointEventListener.ENDPOINT_LISTENER_SCOPE))).thenReturn(scope);
im.bindEndpointEventListener(sref, this::onEndpointChanged);
-
+
assertThat(semConnected.tryAcquire(1, SECONDS), equalTo(true));
-
+
EndpointDescription endpoint = createEndpoint();
repository.endpointChanged(new EndpointEvent(EndpointEvent.ADDED, endpoint));
-
+
assertThat(sem.tryAcquire(100, SECONDS), equalTo(true));
-
+
String path = "/osgi/service_registry/http:##test.de#service1";
EndpointDescription ep2 = read(path);
assertNotNull(ep2);
repository.endpointChanged(new EndpointEvent(EndpointEvent.REMOVED, endpoint));
-
+
assertThat(sem.tryAcquire(1000, TimeUnit.SECONDS), equalTo(true));
assertThat(events.get(0).getType(), equalTo(EndpointEvent.ADDED));
assertThat(events.get(1).getType(), equalTo(EndpointEvent.REMOVED));
@@ -121,7 +121,7 @@ public class ZookeeperDiscoveryTest {
assertThat(events.get(1).getEndpoint(), equalTo(endpoint));
im.deactivate();
}
-
+
private EndpointDescription read(String path) throws KeeperException, InterruptedException {
Stat stat = new Stat();
byte[] data = zk.getData(path, this::process, stat);
@@ -148,7 +148,7 @@ public class ZookeeperDiscoveryTest {
factory.configure(new InetSocketAddress(clientPort), 10);
factory.startup(server);
}
-
+
private int getClientPort() throws IOException {
try (ServerSocket serverSocket = new ServerSocket(0)) {
return serverSocket.getLocalPort();
diff --git a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManagerTest.java b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManagerTest.java
index 662fcb8..deb7453 100644
--- a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManagerTest.java
+++ b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ClientManagerTest.java
@@ -42,18 +42,18 @@ public class ClientManagerTest {
@Rule
public MockitoRule rule = MockitoJUnit.rule();
-
+
@Mock
BundleContext context;
-
+
@Mock
ZooKeeper zookeeper;
-
+
Semaphore sem = new Semaphore(0);
-
+
private DiscoveryConfig config;
private ClientManager zkd;
-
+
@Before
public void before() {
zkd = new ClientManager() {
@@ -62,16 +62,16 @@ public class ClientManagerTest {
ClientManagerTest.this.config = config;
sem.release();
return zookeeper;
- }
+ }
};
}
-
+
@Test
public void testDefaults() throws ConfigurationException, InstantiationException, IllegalAccessException, InterruptedException {
Map<String, Object> configuration = new HashMap<>();
-
+
zkd.activate(convert(configuration), context);
-
+
sem.tryAcquire(10, TimeUnit.SECONDS);
assertEquals("localhost", config.zookeeper_host());
assertEquals("2181", config.zookeeper_port());
@@ -84,11 +84,11 @@ public class ClientManagerTest {
configuration.put("zookeeper.host", "myhost");
configuration.put("zookeeper.port", "1");
configuration.put("zookeeper.timeout", "1000");
-
+
DiscoveryConfig config2 = convert(configuration);
assertEquals("myhost", config2.zookeeper_host());
zkd.activate(config2, context);
-
+
sem.tryAcquire(10, TimeUnit.SECONDS);
assertEquals("myhost", config.zookeeper_host());
assertEquals("1", config.zookeeper_port());
diff --git a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepositoryPathTest.java b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepositoryPathTest.java
index 3662efc..900c2e2 100644
--- a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepositoryPathTest.java
+++ b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/client/ZookeeperEndpointRepositoryPathTest.java
@@ -24,7 +24,7 @@ import org.apache.aries.rsa.discovery.zookeeper.client.ZookeeperEndpointReposito
import org.junit.Test;
public class ZookeeperEndpointRepositoryPathTest {
-
+
@Test
public void testGetZooKeeperPath() {
assertEquals(ZookeeperEndpointRepository.PATH_PREFIX + '/' + "http:##org.example.Test",
@@ -32,5 +32,5 @@ public class ZookeeperEndpointRepositoryPathTest {
assertEquals(ZookeeperEndpointRepository.PATH_PREFIX, ZookeeperEndpointRepository.getZooKeeperPath(""));
}
-
+
}
diff --git a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarterTest.java b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarterTest.java
index 62e18c8..2833f7f 100644
--- a/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarterTest.java
+++ b/discovery/zookeeper/src/test/java/org/apache/aries/rsa/discovery/zookeeper/server/ZookeeperStarterTest.java
@@ -69,7 +69,7 @@ public class ZookeeperStarterTest {
public void testUpdateConfig() throws Exception {
final File tempDir = new File("target");
when(bc.getDataFile("")).thenReturn(tempDir);
-
+
Map<String, String> props = new HashMap<>();
props.put("clientPort", "1234");
starter.activate(bc, props);
@@ -78,7 +78,7 @@ public class ZookeeperStarterTest {
verifyConfig(tempDir);
starter.deactivate();
-
+
verify(server).shutdown();
}
diff --git a/discovery/zookeeper/src/test/resources/logback.xml b/discovery/zookeeper/src/test/resources/logback.xml
index 7f2cb48..83cfa77 100644
--- a/discovery/zookeeper/src/test/resources/logback.xml
+++ b/discovery/zookeeper/src/test/resources/logback.xml
@@ -24,9 +24,9 @@
</encoder>
</appender>
- <logger name="org.apache.zookeeper" level="WARN" />
+ <logger name="org.apache.zookeeper" level="WARN" />
<root level="info">
<appender-ref ref="console"/>
</root>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/eapub/bnd.bnd b/eapub/bnd.bnd
index 2040468..c892557 100644
--- a/eapub/bnd.bnd
+++ b/eapub/bnd.bnd
@@ -6,9 +6,9 @@
# to you 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
diff --git a/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java b/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java
index 7b462e8..284c753 100644
--- a/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java
+++ b/eapub/src/main/java/org/apache/aries/rsa/eapub/EventAdminHelper.java
@@ -86,9 +86,7 @@ public class EventAdminHelper implements RemoteServiceAdminListener {
notifyEventAdmins(topic, event);
}
- @SuppressWarnings({
- "rawtypes", "unchecked"
- })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
private void notifyEventAdmins(String topic, Event event) {
ServiceReference[] refs = null;
try {
diff --git a/eapub/src/test/java/org/apache/aries/rsa/eapub/EventAdminHelperTest.java b/eapub/src/test/java/org/apache/aries/rsa/eapub/EventAdminHelperTest.java
index facb7d8..2590dd1 100644
--- a/eapub/src/test/java/org/apache/aries/rsa/eapub/EventAdminHelperTest.java
+++ b/eapub/src/test/java/org/apache/aries/rsa/eapub/EventAdminHelperTest.java
@@ -40,7 +40,7 @@ import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
@SuppressWarnings({"rawtypes", "unchecked"})
public class EventAdminHelperTest {
-
+
@Test
public void testPublishNotification() throws Exception {
final EndpointDescription epd = EasyMock.createNiceMock(EndpointDescription.class);
@@ -184,7 +184,6 @@ public class EventAdminHelperTest {
EasyMock.expect(bc.getService(eaSref)).andReturn(ea).anyTimes();
EasyMock.replay(bc);
-
RemoteServiceAdminEvent event = new RemoteServiceAdminEvent(
RemoteServiceAdminEvent.EXPORT_ERROR,
bundle,
diff --git a/examples/echofastbin/Readme.md b/examples/echofastbin/Readme.md
index 75de983..47c17a8 100644
--- a/examples/echofastbin/Readme.md
+++ b/examples/echofastbin/Readme.md
@@ -1,7 +1,7 @@
# Example echo fastbin
Implements a simple echo service and exposes it using the Aries RSA fastbin provider.
-The echo services shows
+The echo services shows
* simple invocations
* InputStreams as parameters and return values
@@ -47,7 +47,7 @@ bundle:install -s mvn:org.apache.aries.rsa.examples.echofastbin/org.apache.aries
```
The consumer should start and show:
-karaf@root()> Sending to echo service: echo
+karaf@root()> Sending to echo service: echo
Good morning
Sending to echo service: async
Sending to echo service: stream
diff --git a/examples/echofastbin/fbapi/bnd.bnd b/examples/echofastbin/fbapi/bnd.bnd
index ebbcf46..6d1a010 100644
--- a/examples/echofastbin/fbapi/bnd.bnd
+++ b/examples/echofastbin/fbapi/bnd.bnd
@@ -6,13 +6,13 @@
# to you 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.
-Export-Package: org.apache.aries.rsa.examples.fastbin.api
\ No newline at end of file
+Export-Package: org.apache.aries.rsa.examples.fastbin.api
diff --git a/examples/echofastbin/fbapi/src/main/java/org/apache/aries/rsa/examples/fastbin/api/EchoService.java b/examples/echofastbin/fbapi/src/main/java/org/apache/aries/rsa/examples/fastbin/api/EchoService.java
index de69925..5f0779d 100644
--- a/examples/echofastbin/fbapi/src/main/java/org/apache/aries/rsa/examples/fastbin/api/EchoService.java
+++ b/examples/echofastbin/fbapi/src/main/java/org/apache/aries/rsa/examples/fastbin/api/EchoService.java
@@ -24,10 +24,10 @@ import java.util.concurrent.CompletableFuture;
public interface EchoService {
public String echo(String msg);
-
+
public CompletableFuture<String> echoAsync(String msg);
-
+
public InputStream echoStream(String msg);
-
+
public String echoStream2(InputStream msg) throws IOException;
}
diff --git a/examples/echofastbin/fbconsumer/bnd.bnd b/examples/echofastbin/fbconsumer/bnd.bnd
index a2264e0..91dbcd1 100644
--- a/examples/echofastbin/fbconsumer/bnd.bnd
+++ b/examples/echofastbin/fbconsumer/bnd.bnd
@@ -6,13 +6,13 @@
# to you 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.
--dsannotations: *
\ No newline at end of file
+-dsannotations: *
diff --git a/examples/echofastbin/fbconsumer/src/main/java/org/apache/aries/rsa/examples/fastbin/consumer/EchoConsumer.java b/examples/echofastbin/fbconsumer/src/main/java/org/apache/aries/rsa/examples/fastbin/consumer/EchoConsumer.java
index c9dea96..b82b827 100644
--- a/examples/echofastbin/fbconsumer/src/main/java/org/apache/aries/rsa/examples/fastbin/consumer/EchoConsumer.java
+++ b/examples/echofastbin/fbconsumer/src/main/java/org/apache/aries/rsa/examples/fastbin/consumer/EchoConsumer.java
@@ -32,33 +32,30 @@ import org.osgi.service.component.annotations.Reference;
@Component(immediate=true)
public class EchoConsumer {
-
+
EchoService echoService;
@Activate
public void activate() throws IOException {
System.out.println("Sending to echo service: echo");
System.out.println(echoService.echo("Good morning"));
-
System.out.println("Sending to echo service: async");
echoService.echoAsync("Async Good morning").thenRun(() -> System.out.println("Good morning Async"));
-
+
System.out.println("Sending to echo service: stream");
InputStream inputStream = echoService.echoStream("Good morning received as a stream");
try (BufferedReader r = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
- System.out.println(r.readLine());
+ System.out.println(r.readLine());
}
-
+
System.out.println("Sending to echo service: stream2");
- System.out.println(echoService.echoStream2(new ByteArrayInputStream("Good morning send as a stream".getBytes(StandardCharsets.UTF_8))));
-
+ System.out.println(echoService.echoStream2(new ByteArrayInputStream("Good morning send as a stream".getBytes(StandardCharsets.UTF_8))));
}
-
@Reference
public void setEchoService(EchoService echoService) throws IOException {
this.echoService = echoService;
}
-
+
}
diff --git a/examples/echofastbin/fbservice/bnd.bnd b/examples/echofastbin/fbservice/bnd.bnd
index 7a85a3a..91dbcd1 100644
--- a/examples/echofastbin/fbservice/bnd.bnd
+++ b/examples/echofastbin/fbservice/bnd.bnd
@@ -6,9 +6,9 @@
# to you 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
diff --git a/examples/echofastbin/fbservice/src/main/java/org/apache/aries/rsa/examples/fastbin/service/EchoServiceImpl.java b/examples/echofastbin/fbservice/src/main/java/org/apache/aries/rsa/examples/fastbin/service/EchoServiceImpl.java
index 4b83bb4..59dbdc2 100644
--- a/examples/echofastbin/fbservice/src/main/java/org/apache/aries/rsa/examples/fastbin/service/EchoServiceImpl.java
+++ b/examples/echofastbin/fbservice/src/main/java/org/apache/aries/rsa/examples/fastbin/service/EchoServiceImpl.java
@@ -40,32 +40,32 @@ public class EchoServiceImpl implements EchoService {
return msg;
}
- @Override
- public CompletableFuture<String> echoAsync(final String msg) {
- return CompletableFuture.supplyAsync(() -> {
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- return msg;
- });
- }
+ @Override
+ public CompletableFuture<String> echoAsync(final String msg) {
+ return CompletableFuture.supplyAsync(() -> {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ return msg;
+ });
+ }
- @Override
- public InputStream echoStream(String msg) {
- return new ByteArrayInputStream(msg.getBytes(StandardCharsets.UTF_8));
- }
+ @Override
+ public InputStream echoStream(String msg) {
+ return new ByteArrayInputStream(msg.getBytes(StandardCharsets.UTF_8));
+ }
- @Override
- public String echoStream2(InputStream msg) throws IOException {
- ByteArrayOutputStream result = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int length;
- while ((length = msg.read(buffer)) != -1) {
- result.write(buffer, 0, length);
- }
- return result.toString("UTF-8");
- }
+ @Override
+ public String echoStream2(InputStream msg) throws IOException {
+ ByteArrayOutputStream result = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = msg.read(buffer)) != -1) {
+ result.write(buffer, 0, length);
+ }
+ return result.toString("UTF-8");
+ }
}
diff --git a/examples/echofastbin/pom.xml b/examples/echofastbin/pom.xml
index 7fdeee8..36e4615 100644
--- a/examples/echofastbin/pom.xml
+++ b/examples/echofastbin/pom.xml
@@ -1,13 +1,13 @@
<?xml version='1.0' encoding='UTF-8' ?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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>
diff --git a/examples/echotcp/api/bnd.bnd b/examples/echotcp/api/bnd.bnd
index c8b40a5..8fe3541 100644
--- a/examples/echotcp/api/bnd.bnd
+++ b/examples/echotcp/api/bnd.bnd
@@ -6,13 +6,13 @@
# to you 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.
-Export-Package: org.apache.aries.rsa.examples.echotcp.api
\ No newline at end of file
+Export-Package: org.apache.aries.rsa.examples.echotcp.api
diff --git a/examples/echotcp/consumer/bnd.bnd b/examples/echotcp/consumer/bnd.bnd
index a2264e0..91dbcd1 100644
--- a/examples/echotcp/consumer/bnd.bnd
+++ b/examples/echotcp/consumer/bnd.bnd
@@ -6,13 +6,13 @@
# to you 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.
--dsannotations: *
\ No newline at end of file
+-dsannotations: *
diff --git a/examples/echotcp/consumer/src/main/java/org/apache/aries/rsa/examples/echotcp/consumer/EchoConsumer.java b/examples/echotcp/consumer/src/main/java/org/apache/aries/rsa/examples/echotcp/consumer/EchoConsumer.java
index 3ca5a47..8603060 100644
--- a/examples/echotcp/consumer/src/main/java/org/apache/aries/rsa/examples/echotcp/consumer/EchoConsumer.java
+++ b/examples/echotcp/consumer/src/main/java/org/apache/aries/rsa/examples/echotcp/consumer/EchoConsumer.java
@@ -25,7 +25,7 @@ import org.osgi.service.component.annotations.Reference;
@Component(immediate=true)
public class EchoConsumer {
-
+
EchoService echoService;
@Activate
diff --git a/examples/echotcp/service/bnd.bnd b/examples/echotcp/service/bnd.bnd
index 7a85a3a..91dbcd1 100644
--- a/examples/echotcp/service/bnd.bnd
+++ b/examples/echotcp/service/bnd.bnd
@@ -6,9 +6,9 @@
# to you 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
diff --git a/examples/pom.xml b/examples/pom.xml
index 4615203..83cd79c 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -27,10 +27,10 @@
<version>1.15.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
-
+
<artifactId>org.apache.aries.rsa.examples</artifactId>
<packaging>pom</packaging>
-
+
<name>Aries Remote Service Admin Examples</name>
<properties>
diff --git a/features/src/main/resources/features.xml b/features/src/main/resources/features.xml
index e4a0dda..abb5d84 100644
--- a/features/src/main/resources/features.xml
+++ b/features/src/main/resources/features.xml
@@ -28,7 +28,7 @@
<bundle>mvn:org.apache.aries.rsa.discovery/org.apache.aries.rsa.discovery.command/${project.version}</bundle>
<bundle>mvn:org.apache.aries.rsa/org.apache.aries.rsa.eapub/${project.version}</bundle>
</feature>
-
+
<feature name="aries-rsa-provider-tcp" version="${project.version}">
<feature>aries-rsa-core</feature>
<bundle>mvn:org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.tcp/${project.version}</bundle>
@@ -56,20 +56,19 @@
<bundle>mvn:org.apache.zookeeper/zookeeper/${zookeeper.version}</bundle>
<bundle>mvn:org.apache.aries.rsa.discovery/org.apache.aries.rsa.discovery.local/${project.version}</bundle>
<bundle>mvn:org.apache.aries.rsa.discovery/org.apache.aries.rsa.discovery.zookeeper/${project.version}</bundle>
-
+
<!-- Create config with defaults from metatype -->
<config name="org.apache.aries.rsa.discovery.zookeeper">
</config>
</feature>
-
+
<feature name="aries-rsa-discovery-zookeeper-server" version="${project.version}">
<feature>aries-rsa-discovery-zookeeper</feature>
<!-- Create config with defaults from metatype -->
<config name="org.apache.aries.rsa.discovery.zookeeper.server">
</config>
-
+
</feature>
-
</features>
diff --git a/itests/felix/pom.xml b/itests/felix/pom.xml
index 04b8dbc..6e97eb7 100644
--- a/itests/felix/pom.xml
+++ b/itests/felix/pom.xml
@@ -50,7 +50,7 @@
<artifactId>org.apache.felix.scr</artifactId>
<version>2.0.10</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.aries.rsa</groupId>
<artifactId>org.apache.aries.rsa.core</artifactId>
@@ -189,7 +189,7 @@
</plugin>
</plugins>
</build>
-
+
<profiles>
<profile>
<id>ci-build-profile</id>
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java
index 7605e0d..2a1493c 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java
@@ -65,7 +65,7 @@ public class RsaTestBase {
public void testInstalled() throws Exception {
for (Bundle bundle : bundleContext.getBundles()) {
System.out.println(bundle.getBundleId() + " " + bundle.getSymbolicName() + " " + bundle.getState()
- + " " + bundle.getVersion());
+ + " " + bundle.getVersion());
}
}
@@ -92,7 +92,7 @@ public class RsaTestBase {
protected static Option echoTcpAPI() {
return mvn("org.apache.aries.rsa.examples.echotcp", "org.apache.aries.rsa.examples.echotcp.api");
}
-
+
protected static Option echoTcpConsumer() {
return CoreOptions.composite(
echoTcpAPI(),
@@ -107,9 +107,9 @@ public class RsaTestBase {
mvn("org.apache.aries.rsa.examples.echotcp", "org.apache.aries.rsa.examples.echotcp.service")
);
}
-
+
/**
- * We create our own junit option to also provide hamcrest and Awaitility support
+ * We create our own junit option to also provide hamcrest and Awaitility support
*/
protected static Option junit() {
return composite(systemProperty("pax.exam.invoker").value("junit"),
@@ -119,9 +119,9 @@ public class RsaTestBase {
.artifactId("org.apache.servicemix.bundles.hamcrest").version("1.3_1"),
mavenBundle().groupId("org.awaitility").artifactId("awaitility").version("3.1.0"));
}
-
+
protected static Option rsaCore() {
- return composite(junit(),
+ return composite(junit(),
localRepo(),
logback(),
systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
@@ -138,29 +138,25 @@ public class RsaTestBase {
mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.local")
);
}
-
+
public static Option logback() {
return composite(systemProperty("logback.configurationFile").value("src/test/resources/logback.xml"),
mavenBundle().groupId("org.slf4j").artifactId("slf4j-api").version("1.7.6"),
mavenBundle().groupId("ch.qos.logback").artifactId("logback-core").version("1.0.13"),
mavenBundle().groupId("ch.qos.logback").artifactId("logback-classic").version("1.0.13"));
}
-
+
protected static Option debug() {
return CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
}
-
+
protected static Option rsaDiscoveryConfig() {
- return composite(
- mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.config")
- );
+ return composite(mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.config"));
}
-
+
protected static Option rsaDiscoveryZookeeper() {
- return composite(
- mvn("org.apache.zookeeper", "zookeeper"),
- mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.zookeeper")
- );
+ return composite(mvn("org.apache.zookeeper", "zookeeper"),
+ mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.zookeeper"));
}
protected static Option rsaProviderTcp() {
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/TwoContainerPaxExam.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/TwoContainerPaxExam.java
index 2cede85..a3e2277 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/TwoContainerPaxExam.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/TwoContainerPaxExam.java
@@ -31,7 +31,7 @@ import org.ops4j.pax.exam.spi.PaxExamRuntime;
/**
* Can be used instead of the PaxExam runner to start a second
* OSGi container that typically hosts the server side for the test.
- *
+ *
* Use the @ServerConfiguration annotation to mark the config of your server side
*/
public class TwoContainerPaxExam extends PaxExam {
@@ -47,7 +47,7 @@ public class TwoContainerPaxExam extends PaxExam {
public void run(RunNotifier notifier) {
TestContainer remoteContainer = null;
try {
-
+
ExamSystem testSystem = PaxExamRuntime.createTestSystem(remoteConfig());
remoteContainer = PaxExamRuntime.createContainer(testSystem);
remoteContainer.start();
@@ -64,7 +64,6 @@ public class TwoContainerPaxExam extends PaxExam {
}
}
}
-
}
private Option[] remoteConfig() throws Exception {
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
index c8246a0..9c16000 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
@@ -41,23 +41,21 @@ public class TestConfigDiscoveryRoundTrip extends RsaTestBase {
@ServerConfiguration
public static Option[] remoteConfig() throws IOException {
- return new Option[] //
- {
- rsaCore(), //
- rsaProviderTcp(), //
- echoTcpService()
+ return new Option[] {
+ rsaCore(), //
+ rsaProviderTcp(), //
+ echoTcpService()
};
}
@Configuration
public static Option[] configure() throws Exception {
- return new Option[] //
- {
- rsaCore(), //
- rsaDiscoveryConfig(), //
- rsaProviderTcp(), //
- echoTcpConsumer(), //
- configImportEchoService()
+ return new Option[] {
+ rsaCore(), //
+ rsaDiscoveryConfig(), //
+ rsaProviderTcp(), //
+ echoTcpConsumer(), //
+ configImportEchoService()
};
}
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java
index cd9a3dc..d7555a0 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java
@@ -37,34 +37,32 @@ import org.ops4j.pax.exam.Option;
@RunWith(TwoContainerPaxExam.class)
public class TestFastbinRoundTrip extends RsaTestBase {
-
+
@Inject
EchoService echoService;
@ServerConfiguration
public static Option[] remoteConfig() throws IOException {
- return new Option[] //
- {
- rsaCore(), //
- rsaDiscoveryZookeeper(), //
- rsaProviderFastBin(), //
- echoTcpService(), //
- configZKServer(), //
- configZKDiscovery(), //
- configFastBinFreePort()
+ return new Option[] {
+ rsaCore(), //
+ rsaDiscoveryZookeeper(), //
+ rsaProviderFastBin(), //
+ echoTcpService(), //
+ configZKServer(), //
+ configZKDiscovery(), //
+ configFastBinFreePort()
};
}
@Configuration
public static Option[] configure() throws Exception {
- return new Option[] //
- {
- rsaCore(), //
- rsaDiscoveryZookeeper(), //
- rsaProviderFastBin(), //
- echoTcpConsumer(), //
- configZKDiscovery(), //
- configFastBinFreePort()
+ return new Option[] {
+ rsaCore(), //
+ rsaDiscoveryZookeeper(), //
+ rsaProviderFastBin(), //
+ echoTcpConsumer(), //
+ configZKDiscovery(), //
+ configFastBinFreePort()
};
}
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/rsa/TestRSAListener.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/rsa/TestRSAListener.java
index 73b7538..9a44759 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/rsa/TestRSAListener.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/rsa/TestRSAListener.java
@@ -42,21 +42,20 @@ public class TestRSAListener extends RsaTestBase implements RemoteServiceAdminLi
private static final int EVENT_TIMEOUT = 2000;
private RemoteServiceAdminEvent lastEvent;
private Bundle serviceBundle;
-
+
@Inject
EchoService echoService;
-
+
@Inject
RemoteServiceAdmin rsa;
-
+
@Configuration
public static Option[] configure() throws Exception {
- return new Option[] //
- {
- rsaCore(), //
- rsaProviderTcp(), //
- echoTcpService(), //
- configFastBinFreePort()
+ return new Option[] {
+ rsaCore(), //
+ rsaProviderTcp(), //
+ echoTcpService(), //
+ configFastBinFreePort()
};
}
@@ -66,12 +65,12 @@ public class TestRSAListener extends RsaTestBase implements RemoteServiceAdminLi
serviceBundle.stop();
ServiceRegistration<RemoteServiceAdminListener> sreg = bundleContext.registerService(RemoteServiceAdminListener.class, this, null);
-
+
serviceBundle.start();
assertEvent(RemoteServiceAdminEvent.EXPORT_REGISTRATION);
-
+
Thread.sleep(1000);
-
+
serviceBundle.stop();
assertEvent(RemoteServiceAdminEvent.EXPORT_UNREGISTRATION);
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryExport.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryExport.java
index e978aed..b7bd4cc 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryExport.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryExport.java
@@ -44,10 +44,10 @@ import org.osgi.service.remoteserviceadmin.EndpointDescription;
public class TestDiscoveryExport extends RsaTestBase {
@Inject
DistributionProvider tcpProvider;
-
+
@Inject
EndpointDescriptionParser parser;
-
+
@Inject
ZooKeeper zookeeper;
@@ -68,7 +68,7 @@ public class TestDiscoveryExport extends RsaTestBase {
public void testDiscoveryExport() throws Exception {
EndpointDescription epd = getEndpoint();
EchoService service = (EchoService)tcpProvider
- .importEndpoint(EchoService.class.getClassLoader(),
+ .importEndpoint(EchoService.class.getClassLoader(),
bundleContext, new Class[]{EchoService.class}, epd);
Assert.assertEquals("test", service.echo("test"));
}
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryImport.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryImport.java
index 6b6184b..ea80ade 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryImport.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/tcp/TestDiscoveryImport.java
@@ -49,14 +49,14 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
public class TestDiscoveryImport extends RsaTestBase {
@Inject
ZookeeperEndpointRepository publisher;
-
+
@Inject
BundleContext context;
private Semaphore sem = new Semaphore(0);
private List<EndpointEvent> events = new ArrayList<>();
-
+
@Configuration
public static Option[] configure() throws Exception {
return new Option[] {
diff --git a/itests/felix/src/test/resources/logback.xml b/itests/felix/src/test/resources/logback.xml
index 3b7921f..29c498e 100644
--- a/itests/felix/src/test/resources/logback.xml
+++ b/itests/felix/src/test/resources/logback.xml
@@ -24,9 +24,9 @@
</encoder>
</appender>
- <logger name="org.apache.zookeeper" level="WARN" />
+ <logger name="org.apache.zookeeper" level="WARN" />
<root level="info">
<appender-ref ref="console"/>
</root>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/itests/tck/README.md b/itests/tck/README.md
index 02aa4fe..4581ca4 100644
--- a/itests/tck/README.md
+++ b/itests/tck/README.md
@@ -4,14 +4,13 @@
Call install-tests.sh with the path to the directory where the test jars reside.
- sh install/install-tests.sh ~/checkout/osgi_ct_enterprise/jar
-
+ sh install/install-tests.sh ~/checkout/osgi_ct_enterprise/jar
+
This installs the tests to your local maven repo and only needs to be done once.
## Build the index
- mvn package
-
+ mvn package
## Run the tests
diff --git a/itests/tck/pom.xml b/itests/tck/pom.xml
index b9ed054..97ae049 100644
--- a/itests/tck/pom.xml
+++ b/itests/tck/pom.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you 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
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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/maven-v4_0_0.xsd">
@@ -33,7 +33,7 @@
<dependencies>
- <!-- Test cases from the tck. These need to be deployed by hand as
+ <!-- Test cases from the tck. These need to be deployed by hand as
redistribution is not allowed -->
<dependency>
<groupId>org.osgi.test.cases</groupId>
@@ -114,6 +114,5 @@
</plugins>
</build>
-
</project>
diff --git a/itests/tck/tck.bndrun b/itests/tck/tck.bndrun
index e605582..3f9b8c3 100644
--- a/itests/tck/tck.bndrun
+++ b/itests/tck/tck.bndrun
@@ -6,9 +6,9 @@
# to you 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
diff --git a/parent/pom.xml b/parent/pom.xml
index cff320e..2c4fc66 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -193,12 +193,12 @@
<version>${zookeeper.version}</version>
<exclusions>
<exclusion>
- <groupId>com.sun.jdmk</groupId>
- <artifactId>jmxtools</artifactId>
+ <groupId>com.sun.jdmk</groupId>
+ <artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
- <groupId>com.sun.jmx</groupId>
- <artifactId>jmxri</artifactId>
+ <groupId>com.sun.jmx</groupId>
+ <artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
@@ -252,17 +252,17 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>3.0.1</version>
- <configuration>
- <attach>true</attach>
- <quiet>true</quiet>
- <encoding>UTF-8</encoding>
- <additionalparam>-Xdoclint:none</additionalparam>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>3.0.1</version>
+ <configuration>
+ <attach>true</attach>
+ <quiet>true</quiet>
+ <encoding>UTF-8</encoding>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
diff --git a/provider/fastbin/Readme.md b/provider/fastbin/Readme.md
index 9b5764f..a47e184 100644
--- a/provider/fastbin/Readme.md
+++ b/provider/fastbin/Readme.md
@@ -10,13 +10,11 @@ Sync remote calls have a default timeout of 5 minutes. For long running operatio
as the return value of the remote method. The client will receive a proxy of that type that will be resolved async as soon as the server finished computation.
-
## Streaming Data
When large amount of data (e.g. files) need to be transferred remotely it is not advisable to use large byte arrays as this will allocate a lot of memory. Instead the fastbin transport allows to
use `InputStream` and `OutputStream` as parameter or return value. When a remote method contains such a parameter, the stream is replaced with a proxy implementation that pipes data remotely from/to the original stream.
-
## Transport configuration
Config PID: org.apache.aries.rsa.provider.fastbin
@@ -27,7 +25,6 @@ Config PID: org.apache.aries.rsa.provider.fastbin
| exportAddress | looks up the hostname | The ip/hostname how remote clients can reach this server |
| timeout | 300000 | The timeout for sync calls (default 5 minutes) |
-
## Endpoint Configuration
Per service configuration using service properties.
diff --git a/provider/fastbin/bnd.bnd b/provider/fastbin/bnd.bnd
index a4f9d59..eb7d888 100644
--- a/provider/fastbin/bnd.bnd
+++ b/provider/fastbin/bnd.bnd
@@ -6,9 +6,9 @@
# to you 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
diff --git a/provider/fastbin/pom.xml b/provider/fastbin/pom.xml
index 13ae2e4..95715fc 100644
--- a/provider/fastbin/pom.xml
+++ b/provider/fastbin/pom.xml
@@ -117,39 +117,39 @@
</plugin>
</plugins>
<pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.fusesource.hawtbuf
- </groupId>
- <artifactId>
- hawtbuf-protoc
- </artifactId>
- <versionRange>
- [1.11,)
- </versionRange>
- <goals>
- <goal>compile</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.fusesource.hawtbuf
+ </groupId>
+ <artifactId>
+ hawtbuf-protoc
+ </artifactId>
+ <versionRange>
+ [1.11,)
+ </versionRange>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
</pluginManagement>
</build>
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/Activator.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/Activator.java
index 87e9669..17db549 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/Activator.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/Activator.java
@@ -42,12 +42,11 @@ import org.slf4j.LoggerFactory;
@Header(name = Constants.BUNDLE_ACTIVATOR, value = "${@class}")
public class Activator extends BaseActivator implements ManagedService {
- private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
+ private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
static Activator INSTANCE;
FastBinProvider provider;
ClientInvoker client;
ServerInvoker server;
-
@Override
protected void doOpen() throws Exception {
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/FastBinProvider.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/FastBinProvider.java
index e8dcd56..ed22d44 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/FastBinProvider.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/FastBinProvider.java
@@ -47,8 +47,8 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("rawtypes")
public class FastBinProvider implements DistributionProvider {
- private static final Logger LOG = LoggerFactory.getLogger(FastBinProvider.class);
-
+ private static final Logger LOG = LoggerFactory.getLogger(FastBinProvider.class);
+
public static final String FASTBIN_CONFIG_TYPE = "aries.fastbin";
public static final String FASTBIN_ADDRESS = FASTBIN_CONFIG_TYPE + ".address";
@@ -75,17 +75,17 @@ public class FastBinProvider implements DistributionProvider {
}
public void close() {
- client.stop();
- final Semaphore counter = new Semaphore(0);
- server.stop(() -> {
- counter.release(1);
- });
+ client.stop();
+ final Semaphore counter = new Semaphore(0);
+ server.stop(() -> {
+ counter.release(1);
+ });
try {
- if(!counter.tryAcquire(1, 30, TimeUnit.SECONDS)) {
- LOG.warn("Server/Client failed to shut down in time. Proceeding shutdown anyway...");
- }
+ if(!counter.tryAcquire(1, 30, TimeUnit.SECONDS)) {
+ LOG.warn("Server/Client failed to shut down in time. Proceeding shutdown anyway...");
+ }
} catch(InterruptedException e) {
- LOG.warn("Interrupted while waiting for Server/Client shutdown");
+ LOG.warn("Interrupted while waiting for Server/Client shutdown");
}
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ObjectSerializationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ObjectSerializationStrategy.java
index 7ae13ba..3167c43 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ObjectSerializationStrategy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ObjectSerializationStrategy.java
@@ -66,7 +66,6 @@ public class ObjectSerializationStrategy implements SerializationStrategy {
}
}
-
public void encodeResponse(ClassLoader loader, Class<?> type, Object value, Throwable error, DataByteArrayOutputStream target) throws IOException, ClassNotFoundException {
ObjectOutputStream oos = new ObjectOutputStream(target);
oos.writeObject(error);
@@ -74,5 +73,4 @@ public class ObjectSerializationStrategy implements SerializationStrategy {
oos.flush();
}
-
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ProtobufSerializationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ProtobufSerializationStrategy.java
index 2f18359..65d69a6 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ProtobufSerializationStrategy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/api/ProtobufSerializationStrategy.java
@@ -126,7 +126,4 @@ public class ProtobufSerializationStrategy implements SerializationStrategy {
}
-
-
-
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/ProtocolCodec.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/ProtocolCodec.java
index c765584..d8a01c1 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/ProtocolCodec.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/ProtocolCodec.java
@@ -22,8 +22,6 @@ import java.io.IOException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
-
-
/**
* Interface to encode and decode commands in and out of a a non blocking channel.
*
@@ -43,7 +41,7 @@ public interface ProtocolCodec {
/**
* Non-blocking channel based decoding.
- *
+ *
* @return
* @throws IOException
*/
@@ -54,14 +52,12 @@ public interface ProtocolCodec {
*/
public long getReadCounter();
-
///////////////////////////////////////////////////////////////////
//
// Methods related with writing to the channel
//
///////////////////////////////////////////////////////////////////
-
enum BufferState {
EMPTY,
WAS_EMPTY,
@@ -96,5 +92,4 @@ public interface ProtocolCodec {
*/
public long getWriteCounter();
-
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Service.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Service.java
index e155a4b..caa7e3b 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Service.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Service.java
@@ -18,7 +18,6 @@
*/
package org.apache.aries.rsa.provider.fastbin.io;
-
/**
* The core lifecycle interface for ActiveMQ components.
*
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Transport.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Transport.java
index c990ccc..2164b0d 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Transport.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/Transport.java
@@ -23,16 +23,15 @@ import org.fusesource.hawtdispatch.DispatchQueue;
/**
* Represents an abstract connection. It can be a client side or server side connection.
- *
+ *
*/
public interface Transport extends Service, Dispatched {
-
boolean full();
/**
* A one way asynchronous send of a command. Only sent if the the transport is not full.
- *
+ *
* @param command
* @return true if the command was accepted.
*/
@@ -78,12 +77,12 @@ public interface Transport extends Service, Dispatched {
* @return true if the transport is disposed
*/
boolean isDisposed();
-
+
/**
* @return true if the transport is connected
*/
boolean isConnected();
-
+
/**
* @return The protocol codec for the transport.
*/
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportAcceptListener.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportAcceptListener.java
index 25e3bb3..29fb6a7 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportAcceptListener.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportAcceptListener.java
@@ -25,9 +25,9 @@ import org.apache.aries.rsa.provider.fastbin.tcp.TcpTransport;
*
*/
public interface TransportAcceptListener {
-
+
void onAccept(TransportServer transportServer, TcpTransport transport);
-
+
void onAcceptError(TransportServer transportServer, Exception error);
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportListener.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportListener.java
index f86e004..690c917 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportListener.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportListener.java
@@ -20,13 +20,12 @@ package org.apache.aries.rsa.provider.fastbin.io;
import java.io.IOException;
-
/**
* An asynchronous listener of commands
*
*/
public interface TransportListener {
-
+
/**
* called to process a command
* @param command
@@ -34,7 +33,7 @@ public interface TransportListener {
void onTransportCommand(Transport transport, Object command);
/**
- * transport can now accept more commands for transmission.
+ * transport can now accept more commands for transmission.
*/
void onRefill(Transport transport);
@@ -43,7 +42,7 @@ public interface TransportListener {
* @param error
*/
void onTransportFailure(Transport transport, IOException error);
-
+
/**
* The transport has been connected.
*/
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportServer.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportServer.java
index 4318215..fa56987 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportServer.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/io/TransportServer.java
@@ -25,7 +25,7 @@ import org.fusesource.hawtdispatch.DispatchQueue;
/**
* A TransportServer asynchronously accepts @see Transport objects and then
* delivers those objects to a @see TransportAcceptListener.
- *
+ *
* @version $Revision: 1.4 $
*/
public interface TransportServer extends Service {
@@ -33,7 +33,7 @@ public interface TransportServer extends Service {
/**
* Registers an @see TransportAcceptListener which is notified of accepted
* channels.
- *
+ *
* @param acceptListener
*/
void setAcceptListener(TransportAcceptListener acceptListener);
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/Chunk.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/Chunk.java
index bedc531..6383a1f 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/Chunk.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/Chunk.java
@@ -45,7 +45,6 @@ public class Chunk implements Serializable {
this.last = last;
}
-
public byte[] getData() {
return data;
}
@@ -62,6 +61,3 @@ public class Chunk implements Serializable {
return last;
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxy.java
index f918908..9745be9 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxy.java
@@ -153,6 +153,3 @@ public class InputStreamProxy extends InputStream implements Serializable {
this.streamProvider = streamProvider;
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxy.java
index 006412a..be0ef3c 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxy.java
@@ -45,13 +45,11 @@ public class OutputStreamProxy extends OutputStream implements Serializable {
init();
}
-
private final void init() {
buffer = new byte[StreamProviderImpl.CHUNK_SIZE];
chunkCounter = new AtomicInteger(-1);
}
-
@Override
public void close() throws IOException {
flush();
@@ -78,7 +76,6 @@ public class OutputStreamProxy extends OutputStream implements Serializable {
this.streamProvider = streamProvider;
}
-
@Override
public void write(int b) throws IOException {
try{
@@ -147,6 +144,3 @@ public class OutputStreamProxy extends OutputStream implements Serializable {
position = 0;
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProvider.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProvider.java
index af34f26..f6941f3 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProvider.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProvider.java
@@ -70,6 +70,3 @@ public interface StreamProvider {
int registerStream(OutputStream out);
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProviderImpl.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProviderImpl.java
index 4f6b60b..f1010f5 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProviderImpl.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/streams/StreamProviderImpl.java
@@ -47,7 +47,6 @@ public class StreamProviderImpl implements StreamProvider {
return streamID;
}
-
@Override
public int registerStream(OutputStream out) {
int streamID = counter.incrementAndGet();
@@ -108,6 +107,3 @@ public class StreamProviderImpl implements StreamProvider {
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java
index 0681afd..bcc8362 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AbstractInvocationStrategy.java
@@ -34,8 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("rawtypes")
-public abstract class AbstractInvocationStrategy implements InvocationStrategy
-{
+public abstract class AbstractInvocationStrategy implements InvocationStrategy {
protected final static Logger LOGGER = LoggerFactory.getLogger(AbstractInvocationStrategy.class);
@@ -75,7 +74,6 @@ public abstract class AbstractInvocationStrategy implements InvocationStrategy
return clazz==InputStream.class || clazz==OutputStream.class;
}
-
/**
* encodes the request to the stream
* @param serializationStrategy
@@ -100,7 +98,6 @@ public abstract class AbstractInvocationStrategy implements InvocationStrategy
*/
protected abstract ResponseFuture createResponse(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args) throws Exception;
-
@Override
public final void service(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object target, DataByteArrayInputStream requestStream, DataByteArrayOutputStream responseStream, Runnable onComplete) {
if(method==null && target instanceof ServiceException) {
@@ -192,6 +189,3 @@ public abstract class AbstractInvocationStrategy implements InvocationStrategy
}
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncFutureInvocationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncFutureInvocationStrategy.java
index cf9e350..e520ed6 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncFutureInvocationStrategy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncFutureInvocationStrategy.java
@@ -72,7 +72,6 @@ public class AsyncFutureInvocationStrategy extends AbstractInvocationStrategy {
}
}
-
@Override
protected ResponseFuture createResponse(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args) throws Exception {
return new AsyncResponseFuture(loader, method, serializationStrategy, Dispatch.getCurrentQueue());
@@ -142,8 +141,7 @@ public class AsyncFutureInvocationStrategy extends AbstractInvocationStrategy {
}
@Override
- public Object get(long timeout, TimeUnit unit) throws Exception
- {
+ public Object get(long timeout, TimeUnit unit) throws Exception {
return future;
}
}
@@ -225,6 +223,3 @@ public class AsyncFutureInvocationStrategy extends AbstractInvocationStrategy {
}
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncInvocationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncInvocationStrategy.java
index e783bb7..6d31b87 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncInvocationStrategy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncInvocationStrategy.java
@@ -48,7 +48,7 @@ public class AsyncInvocationStrategy extends AbstractInvocationStrategy {
private final ClassLoader loader;
private final Method method;
-
+
private final AsyncCallback callback;
private final SerializationStrategy serializationStrategy;
private final DispatchQueue queue;
@@ -140,6 +140,4 @@ public class AsyncInvocationStrategy extends AbstractInvocationStrategy {
}
}
-
-
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncPromiseInvocationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncPromiseInvocationStrategy.java
index 31843e1..793bb0b 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncPromiseInvocationStrategy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/AsyncPromiseInvocationStrategy.java
@@ -58,7 +58,6 @@ public class AsyncPromiseInvocationStrategy extends AbstractInvocationStrategy {
}
}
-
@Override
protected ResponseFuture createResponse(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args) throws Exception {
return new AsyncResponseFuture(loader, method, serializationStrategy, Dispatch.getCurrentQueue());
@@ -128,12 +127,8 @@ public class AsyncPromiseInvocationStrategy extends AbstractInvocationStrategy {
}
@Override
- public Object get(long timeout, TimeUnit unit) throws Exception
- {
+ public Object get(long timeout, TimeUnit unit) throws Exception {
return deferred.getPromise();
}
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java
index f488568..7844b38 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/BlockingInvocationStrategy.java
@@ -82,7 +82,6 @@ public class BlockingInvocationStrategy extends AbstractInvocationStrategy {
}
}
-
@Override
protected ResponseFuture createResponse(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args) throws Exception {
return new BlockingResponseFuture(loader, method, serializationStrategy);
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ClientInvokerImpl.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ClientInvokerImpl.java
index 9d694c6..dfd1789 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ClientInvokerImpl.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ClientInvokerImpl.java
@@ -246,7 +246,6 @@ public class ClientInvokerImpl implements ClientInvoker, Dispatched {
// array copy.
final Buffer command = baos.toBuffer();
-
// Update the field size.
BufferEditor editor = command.buffer().bigEndianEditor();
editor.writeInt(command.length);
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/InvocationType.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/InvocationType.java
index c351ea5..1da9be5 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/InvocationType.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/InvocationType.java
@@ -24,8 +24,7 @@ import java.util.concurrent.Future;
import org.apache.aries.rsa.provider.fastbin.api.AsyncCallback;
import org.osgi.util.promise.Promise;
-public enum InvocationType
-{
+public enum InvocationType {
ASYNC_FUTURE(new AsyncFutureInvocationStrategy()){
@Override
@@ -77,7 +76,6 @@ public enum InvocationType
this.strategy = strategy;
}
-
public static InvocationStrategy forMethod(Method method) {
InvocationType[] values = values();
for (InvocationType invocationType : values) {
@@ -88,7 +86,6 @@ public enum InvocationType
return null;
}
-
protected abstract boolean applies(Method method);
static {
@@ -101,6 +98,3 @@ public enum InvocationType
}
}
}
-
-
-
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodec.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodec.java
index 6b1633a..89edf54 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodec.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodec.java
@@ -118,7 +118,6 @@ public class LengthPrefixedCodec implements ProtocolCodec {
ReadableByteChannel read_channel = null;
ByteBuffer read_buffer = ByteBuffer.allocate(4);
-
public void setReadableByteChannel(ReadableByteChannel channel) {
read_channel = channel;
if (channel instanceof SocketChannel) {
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ServerInvokerImpl.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ServerInvokerImpl.java
index 05af825..e2b6a96 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ServerInvokerImpl.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/ServerInvokerImpl.java
@@ -112,7 +112,6 @@ public class ServerInvokerImpl implements ServerInvoker, Dispatched {
}
Method method = clazz.getMethod(name, params);
-
Serialization annotation = method.getAnnotation(Serialization.class);
SerializationStrategy serializationStrategy;
if( annotation!=null ) {
@@ -124,7 +123,6 @@ public class ServerInvokerImpl implements ServerInvoker, Dispatched {
serializationStrategy = ObjectSerializationStrategy.INSTANCE;
}
-
final InvocationStrategy invocationStrategy = InvocationType.forMethod(method);
rc = new MethodData(invocationStrategy, serializationStrategy, method);
@@ -148,7 +146,6 @@ public class ServerInvokerImpl implements ServerInvoker, Dispatched {
}
-
public ServerInvokerImpl(String address, DispatchQueue queue, Map<String, SerializationStrategy> serializationStrategies) throws Exception {
this.queue = queue;
this.serializationStrategies = serializationStrategies;
@@ -161,7 +158,6 @@ public class ServerInvokerImpl implements ServerInvoker, Dispatched {
return this.server.getSocketAddress();
}
-
public DispatchQueue queue() {
return queue;
}
@@ -232,7 +228,6 @@ public class ServerInvokerImpl implements ServerInvoker, Dispatched {
});
}
-
protected void onCommand(final Transport transport, Object data) {
try {
final DataByteArrayInputStream bais = new DataByteArrayInputStream((Buffer) data);
@@ -329,7 +324,6 @@ public class ServerInvokerImpl implements ServerInvoker, Dispatched {
private MethodData methodData;
private Transport transport;
-
private SendTask(Object svc, DataByteArrayInputStream bais, ServiceFactoryHolder holder, long correlation, MethodData methodData, Transport transport) {
this.svc = svc;
this.bais = bais;
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java
index 3bbacb8..8920a78 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java
@@ -184,7 +184,6 @@ public class TcpTransport implements Transport {
this.socketState = new CONNECTING();
}
-
public DispatchQueue queue() {
return dispatchQueue;
}
@@ -227,7 +226,7 @@ public class TcpTransport implements Transport {
trace("was connected.");
onConnected();
} catch (IOException e) {
- onTransportFailure(e);
+ onTransportFailure(e);
}
}
});
@@ -320,7 +319,6 @@ public class TcpTransport implements Transport {
socketState.onCanceled();
}
-
public boolean full() {
return codec.full();
}
@@ -350,10 +348,8 @@ public class TcpTransport implements Transport {
onTransportFailure(e);
return false;
}
-
}
-
/**
*
*/
@@ -409,7 +405,6 @@ public class TcpTransport implements Transport {
}
}
-
public String getRemoteAddress() {
return remoteAddress;
}
@@ -420,7 +415,6 @@ public class TcpTransport implements Transport {
}
}
-
public void resumeRead() {
if( isConnected() && readSource!=null ) {
if( rateLimitingChannel!=null ) {
@@ -499,7 +493,6 @@ public class TcpTransport implements Transport {
this.useLocalHost = useLocalHost;
}
-
private void trace(String message) {
if( LOG.isTraceEnabled() ) {
final String label = dispatchQueue.getLabel();
@@ -720,7 +713,6 @@ public class TcpTransport implements Transport {
public static final class STOPPED extends State {
}
-
//
// Socket states
//
@@ -845,5 +837,4 @@ public class TcpTransport implements Transport {
}
}
-
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportFactory.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportFactory.java
index 8b26e10..4fbf410 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportFactory.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportFactory.java
@@ -30,7 +30,6 @@ import org.apache.aries.rsa.provider.fastbin.util.URISupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
/**
*/
@SuppressWarnings("rawtypes")
@@ -50,7 +49,6 @@ public class TcpTransportFactory {
return server;
}
-
public TcpTransport connect(String location) throws Exception {
URI uri = new URI(location);
TcpTransport transport = createTransport(uri);
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportServer.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportServer.java
index 1c16599..cb8853e 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportServer.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportServer.java
@@ -143,7 +143,6 @@ public class TcpTransportServer implements TransportServer {
}
}
-
protected String resolveHostName() {
String result;
if (bindAddress.getAddress().isAnyLocalAddress()) {
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/IntrospectionSupport.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/IntrospectionSupport.java
index 9d0d8a1..a4bbfaf 100755
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/IntrospectionSupport.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/IntrospectionSupport.java
@@ -31,10 +31,9 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-
@SuppressWarnings({"rawtypes", "unchecked"})
public final class IntrospectionSupport {
-
+
private IntrospectionSupport() {
}
@@ -162,7 +161,7 @@ public final class IntrospectionSupport {
}
return setter.getParameterTypes()[0];
}
-
+
public static boolean setProperty(Object target, String name, Object value) {
try {
Class<?> clazz = target.getClass();
@@ -232,20 +231,20 @@ public final class IntrospectionSupport {
if (PropertyEditorManager.findEditor(clazz) != null) {
return true;
}
-
+
return false;
}
public static String toString(Object target) {
return toString(target, Object.class, null, (String[])null);
}
-
+
public static String toString(Object target, String...fields) {
return toString(target, Object.class, null, fields);
}
-
+
public static String toString(Object target, Class<?> stopClass) {
- return toString(target, stopClass, null, (String[])null);
+ return toString(target, stopClass, null, (String[])null);
}
public static String toString(Object target, Map<String, Object> overrideFields, String...fields) {
@@ -257,16 +256,16 @@ public final class IntrospectionSupport {
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
addFields(target, target.getClass(), stopClass, map);
if (overrideFields != null) {
- for(String key : overrideFields.keySet()) {
- Object value = overrideFields.get(key);
- map.put(key, value);
- }
+ for(String key : overrideFields.keySet()) {
+ Object value = overrideFields.get(key);
+ map.put(key, value);
+ }
}
-
+
if( fields!=null ) {
map.keySet().retainAll(Arrays.asList(fields));
}
-
+
boolean useMultiLine=false;
LinkedHashMap<String, String> props = new LinkedHashMap<>();
for (Entry<String, Object> entry : map.entrySet()) {
@@ -280,7 +279,7 @@ public final class IntrospectionSupport {
}
props.put(key, value);
}
-
+
StringBuilder buffer = new StringBuilder();
if( useMultiLine) {
buffer.append("{\n");
@@ -320,7 +319,6 @@ public final class IntrospectionSupport {
}
}
-
public static String simpleName(Class<?> clazz) {
String name = clazz.getName();
int p = name.lastIndexOf(".");
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/StringSupport.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/StringSupport.java
index 254c659..2cb06a3 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/StringSupport.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/StringSupport.java
@@ -22,7 +22,7 @@ import java.util.Arrays;
/**
* Helper class to hold common text/string manipulation methods.
- *
+ *
*/
public class StringSupport {
@@ -39,5 +39,5 @@ public class StringSupport {
Arrays.fill(t, character);
return new String(t);
}
-
+
}
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/URISupport.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/URISupport.java
index c979497..085df4b 100755
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/URISupport.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/URISupport.java
@@ -144,7 +144,7 @@ public class URISupport {
*/
public static URI createURIWithQuery(URI uri, String query) throws URISyntaxException {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
- query, uri.getFragment());
+ query, uri.getFragment());
}
public static CompositeData parseComposite(URI uri) throws URISyntaxException {
@@ -289,7 +289,7 @@ public class URISupport {
/**
* Creates a URI from the original URI and the remaining parameters
- *
+ *
* @throws URISyntaxException
*/
public static URI createRemainingURI(URI originalURI, Map params) throws URISyntaxException {
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/UuidGenerator.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/UuidGenerator.java
index f66a132..5ec3a97 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/UuidGenerator.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/util/UuidGenerator.java
@@ -26,7 +26,6 @@ import java.util.concurrent.atomic.AtomicLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
/**
* A unique ID generator which is a fast implementation based on
* how Apache ActiveMQ generates its UUID.
@@ -40,7 +39,7 @@ public class UuidGenerator {
private String seed;
private AtomicLong sequence = new AtomicLong(1);
private int length;
-
+
private static UuidGenerator instance = null;
static {
String stub = "";
@@ -76,10 +75,10 @@ public class UuidGenerator {
*/
private UuidGenerator(String prefix) {
synchronized (UNIQUE_STUB) {
- int hashValue = prefix.hashCode();
- if (hashValue < 0) {
- hashValue = - hashValue;
- }
+ int hashValue = prefix.hashCode();
+ if (hashValue < 0) {
+ hashValue = - hashValue;
+ }
this.seed = hashValue + UNIQUE_STUB + (instanceCount++) + ":";
this.seed = generateSanitizedId(this.seed);
this.length = this.seed.length() + ("" + Long.MAX_VALUE).length();
@@ -101,7 +100,6 @@ public class UuidGenerator {
return hostName;
}
-
/**
* Generate a unique id
*
@@ -129,18 +127,17 @@ public class UuidGenerator {
return id;
}
-
public static String getUUID() {
- return getInstance().generateId();
+ return getInstance().generateId();
}
-
+
public static UuidGenerator getInstance() {
- if (instance == null) {
- instance = new UuidGenerator();
- }
- return instance;
+ if (instance == null) {
+ instance = new UuidGenerator();
+ }
+ return instance;
}
-
+
/**
* When using the {@link java.net.InetAddress#getHostName()} method in an
* environment where neither a proper DNS lookup nor an <tt>/etc/hosts</tt>
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/FutureInvocationTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/FutureInvocationTest.java
index 14b3c22..d32cf60 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/FutureInvocationTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/FutureInvocationTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.aries.rsa.provider.fastbin;
-
import static org.junit.Assert.*;
import java.io.IOException;
@@ -48,17 +47,14 @@ import org.junit.Before;
import org.junit.Test;
@SuppressWarnings({"rawtypes", "unchecked"})
-public class FutureInvocationTest
-{
+public class FutureInvocationTest {
private ServerInvokerImpl server;
private ClientInvokerImpl client;
private TestService testService;
-
@Before
- public void setup() throws Exception
- {
+ public void setup() throws Exception {
DispatchQueue queue = Dispatch.createQueue();
HashMap<String, SerializationStrategy> map = new HashMap<>();
server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
@@ -67,32 +63,25 @@ public class FutureInvocationTest
client = new ClientInvokerImpl(queue, map);
client.start();
// server.stop();
- server.registerService("service-id", new ServerInvoker.ServiceFactory()
- {
- public Object get()
- {
+ server.registerService("service-id", new ServerInvoker.ServiceFactory() {
+ public Object get() {
return new TestServiceImpl();
}
-
- public void unget()
- {}
+ public void unget() {
+ }
}, TestServiceImpl.class.getClassLoader());
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", TestServiceImpl.class.getClassLoader());
testService = (TestService)Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[]{TestService.class}, handler);
}
-
@After
- public void tearDown()
- {
+ public void tearDown() {
server.stop();
client.stop();
}
-
-
@Test
public void testInvokeCompletableFuture() throws Exception {
assertEquals("Hello", testService.helloAsync().get(5, TimeUnit.SECONDS));
@@ -110,14 +99,11 @@ public class FutureInvocationTest
results.add(executor.submit(single));
}
assertEquals(threadCount, results.size());
- for (Future<String> future : results)
- {
+ for (Future<String> future : results) {
assertEquals("Hello", future.get());
}
}
-
-
@Test
public void testInvokeFuture() throws Exception {
assertEquals("Hello", testService.helloAsyncStandardFuture().get(500, TimeUnit.SECONDS));
@@ -131,13 +117,11 @@ public class FutureInvocationTest
List<Callable<String>> tasks = new ArrayList<>();
tasks.addAll(Collections.nCopies(threadCount, task));
List<Future<String>> results = new ArrayList<>();
- for (Callable<String> single : tasks)
- {
+ for (Callable<String> single : tasks) {
results.add(executor.submit(single));
}
assertEquals(threadCount, results.size());
- for (Future<String> future : results)
- {
+ for (Future<String> future : results) {
assertEquals("Hello", future.get());
}
}
@@ -154,9 +138,7 @@ public class FutureInvocationTest
}
}
-
- public interface TestService
- {
+ public interface TestService {
CompletableFuture<String> helloAsync();
Future<String> helloAsyncStandardFuture();
@@ -173,12 +155,12 @@ public class FutureInvocationTest
@Override
public CompletableFuture<String> exceptionAsync() throws IOException {
- CompletableFuture f = CompletableFuture.supplyAsync(() -> {
- sleep(500);
- return "Hello";
- });
- f.completeExceptionally(new IOException("test"));
- return f;
+ CompletableFuture f = CompletableFuture.supplyAsync(() -> {
+ sleep(500);
+ return "Hello";
+ });
+ f.completeExceptionally(new IOException("test"));
+ return f;
}
private void sleep(long time) {
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/InvocationTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/InvocationTest.java
index 9574f79..cc92a44 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/InvocationTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/InvocationTest.java
@@ -57,7 +57,6 @@ public class InvocationTest {
final int BENCHMARK_CLIENTS = 100;
final int BENCHMARK_INVOCATIONS_PER_CLIENT = 1000;
-
@Test(timeout=30*1000)
public void testInvoke() throws Exception {
@@ -80,7 +79,6 @@ public class InvocationTest {
}
}, HelloImpl.class.getClassLoader());
-
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
@@ -139,7 +137,6 @@ public class InvocationTest {
}
}, Hello2Impl.class.getClassLoader());
-
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id-broken", HelloImpl.class.getClassLoader());
Hello2 hello = (Hello2) Proxy.newProxyInstance(Hello2Impl.class.getClassLoader(), new Class[] { Hello2.class }, handler);
@@ -163,8 +160,6 @@ public class InvocationTest {
}
}
-
-
@Test
public void testObjectMethods() throws Exception {
@@ -204,85 +199,83 @@ public class InvocationTest {
@Test(timeout=30*1000)
public void testOverflowAsync() throws Exception {
- DispatchQueue queue = Dispatch.createQueue();
- HashMap<String, SerializationStrategy> map = new HashMap<>();
- map.put("protobuf", new ProtobufSerializationStrategy());
-
- ServerInvokerImpl server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
- server.start();
-
- ClientInvokerImpl client = new ClientInvokerImpl(queue, map);
- client.start();
-
- try {
- server.registerService("service-id", new ServerInvoker.ServiceFactory() {
- public Object get() {
- return new HelloImpl();
- }
- public void unget() {
- }
- }, HelloImpl.class.getClassLoader());
-
-
- InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
- Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
-
- char[] chars = new char[65*1024];
- String payload = new String(chars);
-
- final List<AsyncCallbackFuture<String>> futures = new ArrayList<>();
- for(int i = 0; i < 100; i++) {
- AsyncCallbackFuture<String> future = new AsyncCallbackFuture<>();
- hello.hello(payload, future);
- futures.add(future);
- }
-
- for(Future<String> f : futures) {
- f.get(3, TimeUnit.SECONDS);
- }
-// future2.get(2, TimeUnit.SECONDS);
- //assertEquals("Hello Hiram!", future1.get(2, TimeUnit.SECONDS));
-
- //assertEquals("Hello Hiram!", hello.protobuf(stringValue(payload)).getValue());
- }
- finally {
- server.stop();
- client.stop();
- }
+ DispatchQueue queue = Dispatch.createQueue();
+ HashMap<String, SerializationStrategy> map = new HashMap<>();
+ map.put("protobuf", new ProtobufSerializationStrategy());
+
+ ServerInvokerImpl server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
+ server.start();
+
+ ClientInvokerImpl client = new ClientInvokerImpl(queue, map);
+ client.start();
+
+ try {
+ server.registerService("service-id", new ServerInvoker.ServiceFactory() {
+ public Object get() {
+ return new HelloImpl();
+ }
+ public void unget() {
+ }
+ }, HelloImpl.class.getClassLoader());
+
+ InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
+ Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
+
+ char[] chars = new char[65*1024];
+ String payload = new String(chars);
+
+ final List<AsyncCallbackFuture<String>> futures = new ArrayList<>();
+ for(int i = 0; i < 100; i++) {
+ AsyncCallbackFuture<String> future = new AsyncCallbackFuture<>();
+ hello.hello(payload, future);
+ futures.add(future);
+ }
+
+ for(Future<String> f : futures) {
+ f.get(3, TimeUnit.SECONDS);
+ }
+ //future2.get(2, TimeUnit.SECONDS);
+ //assertEquals("Hello Hiram!", future1.get(2, TimeUnit.SECONDS));
+
+ //assertEquals("Hello Hiram!", hello.protobuf(stringValue(payload)).getValue());
+ }
+ finally {
+ server.stop();
+ client.stop();
+ }
}
@Test(timeout=30*1000)
public void testOverflow() throws Exception {
- DispatchQueue queue = Dispatch.createQueue();
- HashMap<String, SerializationStrategy> map = new HashMap<>();
- map.put("protobuf", new ProtobufSerializationStrategy());
-
- ServerInvokerImpl server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
- server.start();
+ DispatchQueue queue = Dispatch.createQueue();
+ HashMap<String, SerializationStrategy> map = new HashMap<>();
+ map.put("protobuf", new ProtobufSerializationStrategy());
- ClientInvokerImpl client = new ClientInvokerImpl(queue, map);
- client.start();
+ ServerInvokerImpl server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
+ server.start();
- try {
- server.registerService("service-id", new ServerInvoker.ServiceFactory() {
- public Object get() {
- return new HelloImpl();
- }
- public void unget() {
- }
- }, HelloImpl.class.getClassLoader());
+ ClientInvokerImpl client = new ClientInvokerImpl(queue, map);
+ client.start();
+ try {
+ server.registerService("service-id", new ServerInvoker.ServiceFactory() {
+ public Object get() {
+ return new HelloImpl();
+ }
+ public void unget() {
+ }
+ }, HelloImpl.class.getClassLoader());
- InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
- final Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
+ InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
+ final Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
final AtomicInteger requests = new AtomicInteger(0);
final AtomicInteger responses = new AtomicInteger(0);
final AtomicInteger failures = new AtomicInteger(0);
- char[] chars = new char[65*1024];
- final String payload = new String(chars);
+ char[] chars = new char[65*1024];
+ final String payload = new String(chars);
Thread[] threads = new Thread[BENCHMARK_CLIENTS];
for (int t = 0; t < BENCHMARK_CLIENTS; t++) {
@@ -313,50 +306,49 @@ public class InvocationTest {
assertEquals(BENCHMARK_CLIENTS, responses.get());
assertEquals(0, failures.get());
- }
- finally {
- server.stop();
- client.stop();
- }
+ }
+ finally {
+ server.stop();
+ client.stop();
+ }
}
@Test(timeout=30*1000)
public void testNoOverflow() throws Exception {
- DispatchQueue queue = Dispatch.createQueue();
- HashMap<String, SerializationStrategy> map = new HashMap<>();
- map.put("protobuf", new ProtobufSerializationStrategy());
-
- ServerInvokerImpl server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
- server.start();
+ DispatchQueue queue = Dispatch.createQueue();
+ HashMap<String, SerializationStrategy> map = new HashMap<>();
+ map.put("protobuf", new ProtobufSerializationStrategy());
- ClientInvokerImpl client = new ClientInvokerImpl(queue, map);
- client.start();
+ ServerInvokerImpl server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
+ server.start();
- try {
- server.registerService("service-id", new ServerInvoker.ServiceFactory() {
- public Object get() {
- return new HelloImpl();
- }
- public void unget() {
- }
- }, HelloImpl.class.getClassLoader());
+ ClientInvokerImpl client = new ClientInvokerImpl(queue, map);
+ client.start();
+ try {
+ server.registerService("service-id", new ServerInvoker.ServiceFactory() {
+ public Object get() {
+ return new HelloImpl();
+ }
+ public void unget() {
+ }
+ }, HelloImpl.class.getClassLoader());
- InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
- Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
+ InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
+ Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
- char[] chars = new char[65*1024];
- String payload = new String(chars);
+ char[] chars = new char[65*1024];
+ String payload = new String(chars);
- for(int i = 0; i < 100; i++) {
- hello.hello(payload);
- }
- }
- finally {
- server.stop();
- client.stop();
- }
+ for(int i = 0; i < 100; i++) {
+ hello.hello(payload);
+ }
+ }
+ finally {
+ server.stop();
+ client.stop();
+ }
}
@Test(timeout=30*1000)
@@ -379,7 +371,6 @@ public class InvocationTest {
}
}, HelloImpl.class.getClassLoader());
-
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
final Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
@@ -445,7 +436,6 @@ public class InvocationTest {
}
}
-
class AsyncClient implements AsyncCallback<StringValue.Getter> {
final int thread_idx;
@@ -462,7 +452,6 @@ public class InvocationTest {
int i;
long start;
-
AsyncClient(int thread_idx, int nbInvocationsPerThread, Hello hello, AtomicInteger failures, AtomicInteger requests, long[] latencies) {
this.failures = failures;
this.requests = requests;
@@ -534,7 +523,6 @@ public class InvocationTest {
}
}, HelloImpl.class.getClassLoader());
-
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
final Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[] { Hello.class }, handler);
@@ -671,8 +659,7 @@ public class InvocationTest {
}
@Override
- public int hashCode()
- {
+ public int hashCode() {
return -7;
}
}
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/ManagerTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/ManagerTest.java
index 84f6a3c..3bf5d48 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/ManagerTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/ManagerTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.aries.rsa.provider.fastbin;
-
public class ManagerTest {
/*
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/PromiseInvocationTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/PromiseInvocationTest.java
index 06bf8f4..1dc214d 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/PromiseInvocationTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/PromiseInvocationTest.java
@@ -46,18 +46,14 @@ import org.junit.Test;
import org.osgi.util.promise.Deferred;
import org.osgi.util.promise.Promise;
-
-public class PromiseInvocationTest
-{
+public class PromiseInvocationTest {
private ServerInvokerImpl server;
private ClientInvokerImpl client;
private TestService testService;
-
@Before
- public void setup() throws Exception
- {
+ public void setup() throws Exception {
DispatchQueue queue = Dispatch.createQueue();
HashMap<String, SerializationStrategy> map = new HashMap<>();
server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
@@ -66,32 +62,25 @@ public class PromiseInvocationTest
client = new ClientInvokerImpl(queue, map);
client.start();
// server.stop();
- server.registerService("service-id", new ServerInvoker.ServiceFactory()
- {
- public Object get()
- {
+ server.registerService("service-id", new ServerInvoker.ServiceFactory() {
+ public Object get() {
return new TestServiceImpl();
}
-
- public void unget()
- {}
+ public void unget() {
+ }
}, TestServiceImpl.class.getClassLoader());
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", TestServiceImpl.class.getClassLoader());
testService = (TestService)Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[]{TestService.class}, handler);
}
-
@After
- public void tearDown()
- {
+ public void tearDown() {
server.stop();
client.stop();
}
-
-
@Test
public void testInvoke() throws Exception {
assertEquals("Hello", testService.helloPromise().getValue());
@@ -109,8 +98,7 @@ public class PromiseInvocationTest
results.add(executor.submit(single));
}
assertEquals(threadCount, results.size());
- for (Future<String> future : results)
- {
+ for (Future<String> future : results) {
assertEquals("Hello", future.get());
}
}
@@ -129,9 +117,7 @@ public class PromiseInvocationTest
}
}
-
- public interface TestService
- {
+ public interface TestService {
Promise<String> helloPromise();
Promise<String> exceptionPromise() throws IOException;
@@ -153,7 +139,7 @@ public class PromiseInvocationTest
sleep(500);
deferred.fail(new IOException("test"));
}).start();
- return deferred.getPromise();
+ return deferred.getPromise();
}
private void sleep(long time) {
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/StreamInvocationTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/StreamInvocationTest.java
index 104268b..e50f247 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/StreamInvocationTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/StreamInvocationTest.java
@@ -47,17 +47,14 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
public class StreamInvocationTest {
private ServerInvokerImpl server;
private ClientInvokerImpl client;
private TestService testService;
-
@Before
- public void setup() throws Exception
- {
+ public void setup() throws Exception {
DispatchQueue queue = Dispatch.createQueue();
HashMap<String, SerializationStrategy> map = new HashMap<>();
server = new ServerInvokerImpl("tcp://localhost:0", queue, map);
@@ -66,16 +63,13 @@ public class StreamInvocationTest {
client = new ClientInvokerImpl(queue, map);
client.start();
// server.stop();
- server.registerService("service-id", new ServerInvoker.ServiceFactory()
- {
- public Object get()
- {
+ server.registerService("service-id", new ServerInvoker.ServiceFactory() {
+ public Object get() {
return new TestServiceImpl();
}
-
- public void unget()
- {}
+ public void unget() {
+ }
}, TestServiceImpl.class.getClassLoader());
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", TestServiceImpl.class.getClassLoader());
@@ -85,15 +79,12 @@ public class StreamInvocationTest {
Activator.INSTANCE.server = server;
}
-
@After
- public void tearDown()
- {
+ public void tearDown() {
server.stop();
client.stop();
}
-
@Test
public void testToString() throws IOException {
assertEquals("Test", testService.toString(new ByteArrayInputStream("Test".getBytes())));
@@ -113,7 +104,6 @@ public class StreamInvocationTest {
}
-
@Test
public void testToStream() throws IOException {
assertEquals("Test", new BufferedReader(new InputStreamReader(testService.toStream("Test"))).readLine());
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/TransportFailureTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/TransportFailureTest.java
index 588e712..ec73c0d 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/TransportFailureTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/TransportFailureTest.java
@@ -68,7 +68,6 @@ public class TransportFailureTest {
}
}, HelloImpl.class.getClassLoader());
-
InvocationHandler handler = client.getProxy(server.getConnectAddress(), "service-id", HelloImpl.class.getClassLoader());
Hello hello = (Hello) Proxy.newProxyInstance(HelloImpl.class.getClassLoader(), new Class[]{Hello.class}, handler);
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxyTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxyTest.java
index 3fa143b..0ec0897 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxyTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/InputStreamProxyTest.java
@@ -38,14 +38,11 @@ public class InputStreamProxyTest {
streamProvider = new StreamProviderImpl();
}
-
-
@Test
public void testUnsignedBytes() throws IOException {
int length = 1024;
ByteArrayOutputStream out = new ByteArrayOutputStream(length);
- for(int i=0;i<length;i++)
- {
+ for(int i=0;i<length;i++) {
out.write((byte)i);
}
byte[] data = out.toByteArray();
@@ -163,6 +160,3 @@ public class InputStreamProxyTest {
}
}
}
-
-
-
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxyTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxyTest.java
index 76599f0..1e35afd 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxyTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/streams/OutputStreamProxyTest.java
@@ -76,6 +76,3 @@ public class OutputStreamProxyTest {
}
}
-
-
-
diff --git a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodecTest.java b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodecTest.java
index 3e6d202..58e4e9d 100644
--- a/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodecTest.java
+++ b/provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodecTest.java
@@ -40,105 +40,105 @@ import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertEquals;
public class LengthPrefixedCodecTest {
- private ReadableByteChannel readableByteChannel = createMock(ReadableByteChannel.class);
-
- private WritableByteChannel writableByteChannel = createMock(WritableByteChannel.class);
- private LengthPrefixedCodec codec;
-
- @Before
- public void createLengthPrefixedCodec() throws Exception {
- codec = new LengthPrefixedCodec();
- codec.setReadableByteChannel(readableByteChannel);
- codec.setWritableByteChannel(writableByteChannel);
- }
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testFull() throws Exception {
- assertEquals(false, codec.full());
- }
-
- @Test
- public void testEmpty() throws Exception {
- assertEquals(true, codec.empty());
- }
-
- @Test
- public void testGetWriteCounter() throws Exception {
- assertEquals(0L, codec.getWriteCounter());
- }
-
- @Test
- public void testGetReadCounter() throws Exception {
- assertEquals(0L, codec.getReadCounter());
- }
-
- @Test
- public void testWrite() throws Exception {
- final Buffer value = Buffer.ascii("TESTDATA");
-
- final BufferState state = codec.write(value);
-
- assertEquals(BufferState.WAS_EMPTY, state);
- assertEquals(false, codec.full());
- assertEquals(false, codec.empty());
- assertEquals(0L, codec.getWriteCounter());
- }
-
- @Test
- public void testWrite$Twice() throws Exception {
- final Buffer value1 = Buffer.ascii("TESTDATA");
- final Buffer value2 = Buffer.ascii("TESTDATA");
- codec.write(value1);
-
- final BufferState state = codec.write(value2);
-
- assertEquals(BufferState.NOT_EMPTY, state);
- assertEquals(false, codec.full());
- assertEquals(false, codec.empty());
- assertEquals(0L, codec.getWriteCounter());
- }
-
- @Test
- public void testFlush() throws Exception {
- final Buffer value = Buffer.ascii("TESTDATA");
- codec.write(value);
- final int bytesThatWillBeWritten = value.length();
- expect(writableByteChannel.write(anyObject())).andAnswer(createWriteAnswer(bytesThatWillBeWritten));
- replay(writableByteChannel);
-
- final BufferState state = codec.flush();
-
- assertEquals(BufferState.EMPTY, state);
- assertEquals(false, codec.full());
- assertEquals(true, codec.empty());
- assertEquals(bytesThatWillBeWritten, codec.getWriteCounter());
-
- assertEquals(BufferState.WAS_EMPTY, codec.flush());
- }
-
- @Test
- public void testFlush$Partially() throws Exception {
- final Buffer value = Buffer.ascii("TESTDATA");
- codec.write(value);
- final int bytesThatWillBeWritten = value.length() / 2;
- expect(writableByteChannel.write(anyObject())).andAnswer(createWriteAnswer(bytesThatWillBeWritten));
- replay(writableByteChannel);
-
- final BufferState state = codec.flush();
-
- assertEquals(BufferState.NOT_EMPTY, state);
- assertEquals(false, codec.full());
- assertEquals(false, codec.empty());
- assertEquals(bytesThatWillBeWritten, codec.getWriteCounter());
- }
+ private ReadableByteChannel readableByteChannel = createMock(ReadableByteChannel.class);
+
+ private WritableByteChannel writableByteChannel = createMock(WritableByteChannel.class);
+ private LengthPrefixedCodec codec;
+
+ @Before
+ public void createLengthPrefixedCodec() throws Exception {
+ codec = new LengthPrefixedCodec();
+ codec.setReadableByteChannel(readableByteChannel);
+ codec.setWritableByteChannel(writableByteChannel);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testFull() throws Exception {
+ assertEquals(false, codec.full());
+ }
+
+ @Test
+ public void testEmpty() throws Exception {
+ assertEquals(true, codec.empty());
+ }
+
+ @Test
+ public void testGetWriteCounter() throws Exception {
+ assertEquals(0L, codec.getWriteCounter());
+ }
+
+ @Test
+ public void testGetReadCounter() throws Exception {
+ assertEquals(0L, codec.getReadCounter());
+ }
+
+ @Test
+ public void testWrite() throws Exception {
+ final Buffer value = Buffer.ascii("TESTDATA");
+
+ final BufferState state = codec.write(value);
+
+ assertEquals(BufferState.WAS_EMPTY, state);
+ assertEquals(false, codec.full());
+ assertEquals(false, codec.empty());
+ assertEquals(0L, codec.getWriteCounter());
+ }
+
+ @Test
+ public void testWrite$Twice() throws Exception {
+ final Buffer value1 = Buffer.ascii("TESTDATA");
+ final Buffer value2 = Buffer.ascii("TESTDATA");
+ codec.write(value1);
+
+ final BufferState state = codec.write(value2);
+
+ assertEquals(BufferState.NOT_EMPTY, state);
+ assertEquals(false, codec.full());
+ assertEquals(false, codec.empty());
+ assertEquals(0L, codec.getWriteCounter());
+ }
+
+ @Test
+ public void testFlush() throws Exception {
+ final Buffer value = Buffer.ascii("TESTDATA");
+ codec.write(value);
+ final int bytesThatWillBeWritten = value.length();
+ expect(writableByteChannel.write(anyObject())).andAnswer(createWriteAnswer(bytesThatWillBeWritten));
+ replay(writableByteChannel);
+
+ final BufferState state = codec.flush();
+
+ assertEquals(BufferState.EMPTY, state);
+ assertEquals(false, codec.full());
+ assertEquals(true, codec.empty());
+ assertEquals(bytesThatWillBeWritten, codec.getWriteCounter());
+
+ assertEquals(BufferState.WAS_EMPTY, codec.flush());
+ }
+
+ @Test
+ public void testFlush$Partially() throws Exception {
+ final Buffer value = Buffer.ascii("TESTDATA");
+ codec.write(value);
+ final int bytesThatWillBeWritten = value.length() / 2;
+ expect(writableByteChannel.write(anyObject())).andAnswer(createWriteAnswer(bytesThatWillBeWritten));
+ replay(writableByteChannel);
+
+ final BufferState state = codec.flush();
+
+ assertEquals(BufferState.NOT_EMPTY, state);
+ assertEquals(false, codec.full());
+ assertEquals(false, codec.empty());
+ assertEquals(bytesThatWillBeWritten, codec.getWriteCounter());
+ }
@Test(expected=ProtocolException.class)
public void testReadEvilPackage() throws Exception {
@@ -157,16 +157,16 @@ public class LengthPrefixedCodecTest {
codec.read();
}
- private IAnswer<Integer> createWriteAnswer(final int length) {
- return new IAnswer<Integer>() {
- @Override
- public Integer answer() throws Throwable {
- final ByteBuffer buffer = (ByteBuffer) getCurrentArguments()[0];
- if(buffer.remaining() < length)
- throw new BufferUnderflowException();
- buffer.position(buffer.position() + length);
- return length;
- }
- };
- }
+ private IAnswer<Integer> createWriteAnswer(final int length) {
+ return new IAnswer<Integer>() {
+ @Override
+ public Integer answer() throws Throwable {
+ final ByteBuffer buffer = (ByteBuffer) getCurrentArguments()[0];
+ if(buffer.remaining() < length)
+ throw new BufferUnderflowException();
+ buffer.position(buffer.position() + length);
+ return length;
+ }
+ };
+ }
}
diff --git a/provider/pom.xml b/provider/pom.xml
index 888ac83..b19935c 100644
--- a/provider/pom.xml
+++ b/provider/pom.xml
@@ -27,10 +27,10 @@
<version>1.15.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
-
+
<artifactId>org.apache.aries.rsa.provider</artifactId>
<packaging>pom</packaging>
-
+
<name>Aries Remote Service Admin Provider</name>
<properties>
diff --git a/provider/tcp/bnd.bnd b/provider/tcp/bnd.bnd
index bdee0d7..d07bc35 100644
--- a/provider/tcp/bnd.bnd
+++ b/provider/tcp/bnd.bnd
@@ -6,9 +6,9 @@
# to you 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
@@ -17,4 +17,4 @@
# under the License.
Private-Package: \
org.apache.aries.rsa.util,\
- org.osgi.util.converter
\ No newline at end of file
+ org.osgi.util.converter
diff --git a/provider/tcp/pom.xml b/provider/tcp/pom.xml
index e251418..016eb01 100644
--- a/provider/tcp/pom.xml
+++ b/provider/tcp/pom.xml
@@ -18,39 +18,39 @@
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>org.apache.aries.rsa</groupId>
- <artifactId>org.apache.aries.rsa.parent</artifactId>
- <version>1.15.0-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.rsa</groupId>
+ <artifactId>org.apache.aries.rsa.parent</artifactId>
+ <version>1.15.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
- <groupId>org.apache.aries.rsa.provider</groupId>
- <artifactId>org.apache.aries.rsa.provider.tcp</artifactId>
- <packaging>jar</packaging>
- <name>Aries Remote Service Admin provider TCP</name>
- <description>Provider for Java Serialization over TCP</description>
+ <groupId>org.apache.aries.rsa.provider</groupId>
+ <artifactId>org.apache.aries.rsa.provider.tcp</artifactId>
+ <packaging>jar</packaging>
+ <name>Aries Remote Service Admin provider TCP</name>
+ <description>Provider for Java Serialization over TCP</description>
- <properties>
- <topDirectoryLocation>../..</topDirectoryLocation>
- </properties>
+ <properties>
+ <topDirectoryLocation>../..</topDirectoryLocation>
+ </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.aries.rsa</groupId>
- <artifactId>org.apache.aries.rsa.spi</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.util.promise</artifactId>
- <version>1.0.0</version>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.aries.rsa</groupId>
+ <artifactId>org.apache.aries.rsa.spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.util.promise</artifactId>
+ <version>1.0.0</version>
+ </dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.converter</artifactId>
</dependency>
- </dependencies>
+ </dependencies>
</project>
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/EndpointPropertiesParser.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/EndpointPropertiesParser.java
index 7d82543..ae6efa1 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/EndpointPropertiesParser.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/EndpointPropertiesParser.java
@@ -32,21 +32,21 @@ public class EndpointPropertiesParser {
private Map<String, Object> ep;
public EndpointPropertiesParser(EndpointDescription ep) {
- this.ep = ep.getProperties();
+ this.ep = ep.getProperties();
}
-
+
public EndpointPropertiesParser(Map<String, Object> ep) {
- this.ep = ep;
+ this.ep = ep;
}
public int getTimeoutMillis() {
- return getInt(TIMEOUT_KEY, DEFAULT_TIMEOUT_MILLIS);
+ return getInt(TIMEOUT_KEY, DEFAULT_TIMEOUT_MILLIS);
}
-
+
int getInt(String key, String defaultValue) {
return Integer.parseInt(getString(key, defaultValue));
}
-
+
String getString(String key, String defaultValue) {
Object value = ep.get(key);
return value != null ? value.toString() : defaultValue;
@@ -55,7 +55,7 @@ public class EndpointPropertiesParser {
public int getPort() {
return getInt(PORT_KEY, DYNAMIC_PORT);
}
-
+
public String getHostname() {
String hostName = getString(HOSTNAME_KEY, System.getProperty(HOSTNAME_KEY));
if (hostName == null) {
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/MethodInvoker.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/MethodInvoker.java
index ca74230..2a16153 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/MethodInvoker.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/MethodInvoker.java
@@ -41,7 +41,7 @@ public class MethodInvoker {
this.primTypes.put(Boolean.TYPE, Boolean.class);
this.primTypes.put(Character.TYPE, Character.class);
}
-
+
public Object invoke(String methodName, Object[] args) {
Class<?>[] parameterTypesAr = getTypes(args);
try {
@@ -51,7 +51,7 @@ public class MethodInvoker {
return e;
}
}
-
+
private Method getMethod(String methodName, Class<?>[] parameterTypesAr) {
try {
return service.getClass().getMethod(methodName, parameterTypesAr);
@@ -65,7 +65,7 @@ public class MethodInvoker {
return method;
}
}
- throw new IllegalArgumentException(String.format("No method found that matches name %s, types %s",
+ throw new IllegalArgumentException(String.format("No method found that matches name %s, types %s",
methodName, Arrays.toString(parameterTypesAr)));
}
}
@@ -87,7 +87,7 @@ public class MethodInvoker {
}
return type.isAssignableFrom(paramType);
}
-
+
private Class<?>[] getTypes(Object[] args) {
List<Class<?>> parameterTypes = new ArrayList<>();
if (args != null) {
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java
index d112cd8..e83385d 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPProvider.java
@@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
public class TCPProvider implements DistributionProvider {
static final String TCP_CONFIG_TYPE = "aries.tcp";
private static final String[] SUPPORTED_INTENTS = { "osgi.basic", "osgi.async"};
-
+
private Logger logger = LoggerFactory.getLogger(TCPProvider.class);
@Override
@@ -57,7 +57,7 @@ public class TCPProvider implements DistributionProvider {
}
@Override
- public Endpoint exportService(Object serviceO,
+ public Endpoint exportService(Object serviceO,
BundleContext serviceContext,
Map<String, Object> effectiveProperties,
Class[] exportedInterfaces) {
@@ -86,8 +86,8 @@ public class TCPProvider implements DistributionProvider {
}
@Override
- public Object importEndpoint(ClassLoader cl,
- BundleContext consumerContext,
+ public Object importEndpoint(ClassLoader cl,
+ BundleContext consumerContext,
Class[] interfaces,
EndpointDescription endpoint)
throws IntentUnsatisfiedException {
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java
index 3ffb385..7a012ab 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TCPServer.java
@@ -61,7 +61,7 @@ public class TCPServer implements Closeable, Runnable {
this.executor.execute(this);
}
}
-
+
int getPort() {
return this.serverSocket.getLocalPort();
}
@@ -111,7 +111,7 @@ public class TCPServer implements Closeable, Runnable {
result = e.getCause();
}
} else if (result instanceof Promise) {
- Promise<Object> fu = (Promise<Object>) result;
+ Promise<Object> fu = (Promise<Object>) result;
try {
result = fu.getValue();
} catch (InvocationTargetException e) {
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
index dc03f17..34ba198 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpEndpoint.java
@@ -29,7 +29,7 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
public class TcpEndpoint implements Endpoint {
private EndpointDescription epd;
private TCPServer tcpServer;
-
+
public TcpEndpoint(Object service, Map<String, Object> effectiveProperties) {
if (service == null) {
throw new NullPointerException("Service must not be null");
@@ -46,7 +46,7 @@ public class TcpEndpoint implements Endpoint {
effectiveProperties.put(RemoteConstants.ENDPOINT_ID, endpointId);
effectiveProperties.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "");
effectiveProperties.put(RemoteConstants.SERVICE_INTENTS, Arrays.asList("osgi.basic", "osgi.async"));
-
+
// tck tests for one such property ... so we provide it
effectiveProperties.put(TCPProvider.TCP_CONFIG_TYPE + ".id", endpointId);
this.epd = new EndpointDescription(effectiveProperties);
@@ -57,7 +57,6 @@ public class TcpEndpoint implements Endpoint {
return this.epd;
}
-
@Override
public void close() throws IOException {
tcpServer.close();
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java
index f5eb744..6e6cefd 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpInvocationHandler.java
@@ -84,7 +84,7 @@ public class TcpInvocationHandler implements InvocationHandler {
private Object createPromiseResult(final Method method, final Object[] args) {
final Deferred<Object> deferred = new Deferred<>();
new Thread(new Runnable() {
-
+
@Override
public void run() {
try {
@@ -105,7 +105,7 @@ public class TcpInvocationHandler implements InvocationHandler {
) {
socket.setSoTimeout(timeoutMillis);
out.writeObject(method.getName());
-
+
out.writeObject(args);
out.flush();
result = parseResult(socket);
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
index 9d505bf..88a0d85 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
@@ -56,7 +56,7 @@ public class BasicObjectInputStream extends ObjectInputStream {
return super.resolveClass(desc);
}
}
-
+
@Override
protected Object resolveObject(Object obj) throws IOException {
if (obj instanceof VersionMarker) {
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/DTOMarker.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/DTOMarker.java
index aba7c47..4b61d51 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/DTOMarker.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/DTOMarker.java
@@ -29,14 +29,14 @@ public class DTOMarker implements Serializable {
private String className;
private Map<String, Object> content;
-
+
@SuppressWarnings("unchecked")
public DTOMarker(Object dto) {
Converter converter = Converters.standardConverter();
className = dto.getClass().getName();
content = converter.convert(dto).sourceAsDTO().to(Map.class);
}
-
+
public Object getDTO(ClassLoader classLoader) {
try {
Class<?> clazz = classLoader.loadClass(className);
@@ -44,9 +44,9 @@ public class DTOMarker implements Serializable {
return converter.convert(content).targetAsDTO().to(clazz);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Exception deserializing DTO " + className, e);
- }
+ }
}
-
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof DTOMarker)) {
diff --git a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/VersionMarker.java b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/VersionMarker.java
index 3553751..6b68847 100644
--- a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/VersionMarker.java
+++ b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/VersionMarker.java
@@ -26,21 +26,21 @@ public class VersionMarker implements Serializable {
private static final long serialVersionUID = 4725855052866235835L;
private String version;
-
+
public VersionMarker() {
}
-
+
public VersionMarker(Version version) {
this.version = version.toString();
}
-
+
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
-
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof VersionMarker)) {
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/ActivatorTest.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/ActivatorTest.java
index f643679..4c3e69e 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/ActivatorTest.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/ActivatorTest.java
@@ -31,16 +31,14 @@ import org.osgi.framework.ServiceRegistration;
public class ActivatorTest {
- @SuppressWarnings({
- "rawtypes", "unchecked"
- })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testStartStop() throws Exception {
IMocksControl c = EasyMock.createControl();
BundleContext context = c.createMock(BundleContext.class);
ServiceRegistration sreg = c.createMock(ServiceRegistration.class);
expect(context.registerService(EasyMock.eq(DistributionProvider.class), EasyMock.anyObject(DistributionProvider.class), EasyMock.anyObject(Dictionary.class))).andReturn(sreg );
-
+
c.replay();
Activator activator = new Activator();
activator.start(context);
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/EndpointParserTest.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/EndpointParserTest.java
index 87f8899..e763b6d 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/EndpointParserTest.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/EndpointParserTest.java
@@ -28,9 +28,8 @@ import org.junit.Test;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
public class EndpointParserTest {
-
+
private Map<String, Object> props;
@Before
@@ -53,32 +52,31 @@ public class EndpointParserTest {
props.put(EndpointPropertiesParser.TIMEOUT_KEY, "100");
Assert.assertEquals(100, getParser().getTimeoutMillis());
}
-
+
@Test
public void testTimeoutInt() {
props.put(EndpointPropertiesParser.TIMEOUT_KEY, 100);
Assert.assertEquals(100, getParser().getTimeoutMillis());
}
-
@Test
public void testPortString() {
props.put(EndpointPropertiesParser.PORT_KEY, "11111");
Assert.assertEquals(11111, getParser().getPort());
}
-
+
@Test
public void testPortInt() {
props.put(EndpointPropertiesParser.PORT_KEY, 11111);
Assert.assertEquals(11111, getParser().getPort());
}
-
+
@Test(expected=IllegalArgumentException.class)
public void testTimeoutInvalid() {
props.put(EndpointPropertiesParser.TIMEOUT_KEY, new Date());
getParser().getTimeoutMillis();
}
-
+
private EndpointPropertiesParser getParser() {
return new EndpointPropertiesParser(new EndpointDescription(props));
}
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
index 2720f83..12909d5 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpEndpointTest.java
@@ -34,10 +34,10 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
public class TcpEndpointTest {
private static final String HOSTNAME = "myhost";
private static final String PORT = "45346";
-
+
private Map<String, Object> props;
private Object service;
-
+
@Before
public void defaultProps() {
props = new HashMap<>();
@@ -55,7 +55,7 @@ public class TcpEndpointTest {
Assert.assertEquals("tcp://" + HOSTNAME + ":" + PORT, epd.getId());
tcpEndpoint.close();
}
-
+
@Test
public void testEndpointPropertiesDefault() throws IOException {
TcpEndpoint tcpEndpoint = new TcpEndpoint(service, props);
@@ -64,5 +64,4 @@ public class TcpEndpointTest {
tcpEndpoint.close();
}
-
}
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderIntentTest.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderIntentTest.java
index 0c77597..de486eb 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderIntentTest.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderIntentTest.java
@@ -41,7 +41,7 @@ public class TcpProviderIntentTest {
private BundleContext bc;
private TCPProvider provider;
private MyService myService;
-
+
@Before
public void before() {
exportedInterfaces = new Class[] {MyService.class};
@@ -49,7 +49,7 @@ public class TcpProviderIntentTest {
provider = new TCPProvider();
myService = new MyServiceImpl();
}
-
+
@Test
public void basicAndAsyncIntents() {
Map<String, Object> props = new HashMap<>();
@@ -59,7 +59,7 @@ public class TcpProviderIntentTest {
Endpoint ep = provider.exportService(myService, bc, props, exportedInterfaces);
Assert.assertThat("Service should be exported as the intents: " + Arrays.toString(standardIntents) + " must be supported", ep, notNullValue());
}
-
+
@Test
public void unknownIntent() {
Map<String, Object> props = new HashMap<>();
@@ -68,7 +68,7 @@ public class TcpProviderIntentTest {
Endpoint ep = provider.exportService(myService, bc, props, exportedInterfaces);
Assert.assertThat("Service should not be exported as intent is not supported", ep, nullValue());
}
-
+
@Test
public void unknownIntentExtra() {
Map<String, Object> props = new HashMap<>();
@@ -78,5 +78,4 @@ public class TcpProviderIntentTest {
Assert.assertThat("Service should not be exported as intent is not supported", ep, nullValue());
}
-
}
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderPrimitiveTest.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderPrimitiveTest.java
index f19981c..c81795d 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderPrimitiveTest.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderPrimitiveTest.java
@@ -52,7 +52,7 @@ public class TcpProviderPrimitiveTest {
private static PrimitiveService myServiceProxy;
private static Endpoint ep;
-
+
@BeforeClass
public static void createServerAndProxy() {
Class<?>[] exportedInterfaces = new Class[] {PrimitiveService.class};
@@ -66,9 +66,9 @@ public class TcpProviderPrimitiveTest {
ep = provider.exportService(myService, bc, props, exportedInterfaces);
Assert.assertThat(ep.description().getId(), startsWith("tcp://localhost:"));
System.out.println(ep.description());
- myServiceProxy = (PrimitiveService)provider.importEndpoint(PrimitiveService.class.getClassLoader(),
+ myServiceProxy = (PrimitiveService)provider.importEndpoint(PrimitiveService.class.getClassLoader(),
bc,
- exportedInterfaces,
+ exportedInterfaces,
ep.description());
}
@@ -76,17 +76,17 @@ public class TcpProviderPrimitiveTest {
public void testByte() {
Assert.assertEquals((byte)1, myServiceProxy.callByte((byte) 1));
}
-
+
@Test
public void testShort() {
Assert.assertEquals((short)1, myServiceProxy.callShort((short) 1));
}
-
+
@Test
public void testInteger() {
Assert.assertEquals(1, myServiceProxy.callInt(1));
}
-
+
@Test
public void testLong() {
Assert.assertEquals(1L, myServiceProxy.callLong(1L));
@@ -96,43 +96,43 @@ public class TcpProviderPrimitiveTest {
public void testFloat() {
Assert.assertEquals(1f, myServiceProxy.callFloat(1f), 0.001);
}
-
+
@Test
public void testDouble() {
Assert.assertEquals(1d, myServiceProxy.callDouble(1d), 0.001);
}
-
+
@Test
public void testBoolean() {
Assert.assertEquals(true, myServiceProxy.callBoolean(true));
}
-
+
@Test
public void testByteAr() {
Assert.assertArrayEquals(new byte[]{1}, myServiceProxy.callByteAr(new byte[]{1}));
}
-
+
@Test
public void testVersion() {
assertThat(myServiceProxy.callVersion(parseVersion("1.0.0")), equalTo(parseVersion("1.0.0")));
}
-
+
@Test
public void testVersionAr() {
assertThat(myServiceProxy.callVersionAr(new Version[] {parseVersion("1.0.0")}), equalTo(new Version[] {parseVersion("1.0.0")}));
}
-
+
@Test
public void testVersionList() {
assertThat(myServiceProxy.callVersionList(Arrays.asList(parseVersion("1.0.0"))), equalTo(Arrays.asList(parseVersion("1.0.0"))));
}
-
+
@Test
public void testVersionSet() {
Set<Version> set = new HashSet<>(asList(parseVersion("1.0.0")));
assertThat(myServiceProxy.callVersionSet(set), everyItem(isIn(set)));
}
-
+
@Test
public void testVersionMap() {
HashMap<Version, Version> map = new HashMap<>();
@@ -151,7 +151,7 @@ public class TcpProviderPrimitiveTest {
dto.value = "Test";
assertThat(myServiceProxy.callDTO(dto), samePropertyValuesAs(dto));
}
-
+
@Ignore
@Test
public void testDTOAr() {
@@ -161,7 +161,7 @@ public class TcpProviderPrimitiveTest {
DTOType[] result = myServiceProxy.callDTOAr(dtoAr);
assertThat(result[0], samePropertyValuesAs(dtoAr[0]));
}
-
+
@AfterClass
public static void close() throws IOException {
ep.close();
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java
index 5278c18..73af505 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/TcpProviderTest.java
@@ -63,7 +63,7 @@ public class TcpProviderTest {
private static final int NUM_CALLS = 100;
private static MyService myServiceProxy;
private static Endpoint ep;
-
+
@BeforeClass
public static void createServerAndProxy() {
Class<?>[] exportedInterfaces = new Class[] {MyService.class};
@@ -78,12 +78,12 @@ public class TcpProviderTest {
ep = provider.exportService(myService, bc, props, exportedInterfaces);
Assert.assertThat(ep.description().getId(), startsWith("tcp://localhost:"));
System.out.println(ep.description());
- myServiceProxy = (MyService)provider.importEndpoint(MyService.class.getClassLoader(),
+ myServiceProxy = (MyService)provider.importEndpoint(MyService.class.getClassLoader(),
bc,
- exportedInterfaces,
+ exportedInterfaces,
ep.description());
}
-
+
@Test
public void testCallTimeout() {
try {
@@ -102,22 +102,22 @@ public class TcpProviderTest {
String result = myServiceProxy.echo(msg);
Assert.assertEquals(msg, result);
}
-
+
@Test(expected=ExpectedTestException.class)
public void testCallException() {
myServiceProxy.callException();
}
-
+
@Test
public void testCall() {
myServiceProxy.echo("test");
}
-
+
@Test
public void testCallOneway() {
myServiceProxy.callOneWay("test");
}
-
+
/**
* Test for ARIES-1515
*/
@@ -133,7 +133,7 @@ public class TcpProviderTest {
String answer = result.get(1, TimeUnit.SECONDS);
assertEquals("Finished", answer);
}
-
+
@Test(expected = ExpectedTestException.class)
public void testAsyncFutureException() throws Throwable {
Future<String> result = myServiceProxy.callAsyncFuture(-1);
@@ -143,7 +143,7 @@ public class TcpProviderTest {
throw e.getCause();
}
}
-
+
@Test
public void testAsyncCompletionStage() throws Exception {
CompletionStage<String> result = myServiceProxy.callAsyncCompletionStage(100);
@@ -151,7 +151,7 @@ public class TcpProviderTest {
String answer = fresult.get(1, TimeUnit.SECONDS);
assertEquals("Finished", answer);
}
-
+
@Test(expected = ExpectedTestException.class)
public void testAsyncCompletionStageException() throws Throwable {
CompletionStage<String> result = myServiceProxy.callAsyncCompletionStage(-1);
@@ -162,7 +162,7 @@ public class TcpProviderTest {
throw e.getCause();
}
}
-
+
@Test
public void testAsyncPromise() throws Exception {
final Semaphore s = new Semaphore(0);
@@ -183,7 +183,7 @@ public class TcpProviderTest {
assertFalse(s.tryAcquire());
assertTrue(s.tryAcquire(1, TimeUnit.SECONDS));
}
-
+
@Test(expected = ExpectedTestException.class)
public void testAsyncPromiseException() throws Throwable {
Promise<String> result = myServiceProxy.callAsyncPromise(-1);
@@ -207,7 +207,7 @@ public class TcpProviderTest {
final String msg2 = msg.toString();
ExecutorService executor = Executors.newFixedThreadPool(10);
Runnable task = new Runnable() {
-
+
@Override
public void run() {
String result = myServiceProxy2.echo(msg2);
@@ -223,5 +223,5 @@ public class TcpProviderTest {
long tps = NUM_CALLS * 1000 / (System.currentTimeMillis() - start);
System.out.println(tps + " tps");
}
-
+
}
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java
index 165927a..5d9320b 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyService.java
@@ -30,19 +30,19 @@ public interface MyService {
String echo(String msg);
void callSlow(int delay);
-
+
void callException();
-
+
// Oneway not yet supported
@Oneway
void callOneWay(String msg);
-
+
void callWithList(List<String> msg);
-
+
Future<String> callAsyncFuture(int delay);
Promise<String> callAsyncPromise(int delay);
- CompletionStage<String> callAsyncCompletionStage(int delay);
+ CompletionStage<String> callAsyncCompletionStage(int delay);
}
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java
index 2b69b95..c91814f 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/MyServiceImpl.java
@@ -37,7 +37,7 @@ public class MyServiceImpl implements MyService {
@Override
public void callSlow(int delay) {
- sleep(delay);
+ sleep(delay);
}
@Override
@@ -51,7 +51,7 @@ public class MyServiceImpl implements MyService {
@Override
public void callWithList(List<String> msg) {
-
+
}
@Override
@@ -64,10 +64,10 @@ public class MyServiceImpl implements MyService {
sleep(delay);
return "Finished";
}
-
+
});
}
-
+
@Override
public CompletionStage<String> callAsyncCompletionStage(final int delay) {
return supplyAsync(new Supplier<String>() {
@@ -78,15 +78,15 @@ public class MyServiceImpl implements MyService {
sleep(delay);
return "Finished";
}
-
+
});
}
-
+
@Override
public Promise<String> callAsyncPromise(final int delay) {
final Deferred<String> deferred = new Deferred<>();
new Thread(new Runnable() {
-
+
@Override
public void run() {
if (delay == -1) {
@@ -97,7 +97,7 @@ public class MyServiceImpl implements MyService {
deferred.resolve("Finished");
}
}).start();
-
+
return deferred.getPromise();
}
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveService.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveService.java
index c68661d..26b009b 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveService.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveService.java
@@ -25,21 +25,21 @@ import java.util.Set;
import org.osgi.framework.Version;
public interface PrimitiveService {
-
+
byte callByte(byte num);
-
+
short callShort(short num);
int callInt(int num);
long callLong(long num);
-
+
float callFloat(float num);
-
+
double callDouble(double num);
boolean callBoolean(boolean bool);
-
+
byte[] callByteAr(byte[] byteAr);
Version callVersion(Version version);
diff --git a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveServiceImpl.java b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveServiceImpl.java
index d43465c..5b382f2 100644
--- a/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveServiceImpl.java
+++ b/provider/tcp/src/test/java/org/apache/aries/rsa/provider/tcp/myservice/PrimitiveServiceImpl.java
@@ -36,7 +36,6 @@ public class PrimitiveServiceImpl implements PrimitiveService {
return num;
}
-
@Override
public int callInt(int num) {
return num;
@@ -56,7 +55,7 @@ public class PrimitiveServiceImpl implements PrimitiveService {
public double callDouble(double num) {
return num;
}
-
+
@Override
public boolean callBoolean(boolean bool) {
return bool;
@@ -71,7 +70,7 @@ public class PrimitiveServiceImpl implements PrimitiveService {
public Version callVersion(Version version) {
return version;
}
-
+
@Override
public Version[] callVersionAr(Version[] version) {
return version;
@@ -86,13 +85,12 @@ public class PrimitiveServiceImpl implements PrimitiveService {
public Map<Version, Version> callVersionMap(Map<Version, Version> map) {
return map;
}
-
+
@Override
public Set<Version> callVersionSet(Set<Version> set) {
return set;
}
-
-
+
@Override
public DTOType callDTO(DTOType dto) {
return dto;
diff --git a/repository/pom.xml b/repository/pom.xml
index 986bc55..3c6aaa9 100644
--- a/repository/pom.xml
+++ b/repository/pom.xml
@@ -74,9 +74,9 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-service</artifactId>
- <version>1.8.5</version>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <version>1.8.5</version>
</dependency>
</dependencies>
</project>
diff --git a/rsa/Readme.md b/rsa/Readme.md
index 7378589..473780d 100644
--- a/rsa/Readme.md
+++ b/rsa/Readme.md
@@ -3,6 +3,6 @@
Is called by the Topology Manager to expose local services as remote endpoints and create local proxy services as
clients for remote endpoints.
-Aries RSA has a custom [SPI DistributionProvider](https://github.com/apache/aries-rsa/blob/master/spi/src/main/java/org/apache/aries/rsa/spi/DistributionProvider.java) that allows to easily create new transports and serializations.
-The RemoteServiceAdmin bundle tracks such provider services and relays the actual creation of endpoints and proxies to
+Aries RSA has a custom [SPI DistributionProvider](https://github.com/apache/aries-rsa/blob/master/spi/src/main/java/org/apache/aries/rsa/spi/DistributionProvider.java) that allows to easily create new transports and serializations.
+The RemoteServiceAdmin bundle tracks such provider services and relays the actual creation of endpoints and proxies to
suitable providers.
diff --git a/rsa/bnd.bnd b/rsa/bnd.bnd
index 38dc894..2905522 100644
--- a/rsa/bnd.bnd
+++ b/rsa/bnd.bnd
@@ -6,9 +6,9 @@
# to you 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
diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java b/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java
index 9151053..a10f143 100644
--- a/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java
+++ b/rsa/src/main/java/org/apache/aries/rsa/core/DistributionProviderTracker.java
@@ -56,8 +56,8 @@ public class DistributionProviderTracker extends ServiceTracker<DistributionProv
BundleContext apiContext = getAPIContext();
PackageUtil packageUtil = new PackageUtil(context);
EventProducer eventProducer = new EventProducer(context);
- RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(context,
- apiContext,
+ RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(context,
+ apiContext,
eventProducer,
provider,
packageUtil);
@@ -84,7 +84,7 @@ public class DistributionProviderTracker extends ServiceTracker<DistributionProv
BundleContext apiContext = apiBundle.getBundleContext();
return apiContext;
}
-
+
@Override
public void removedService(ServiceReference<DistributionProvider> reference,
ServiceRegistration reg) {
diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java b/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java
index 3b40d35..8b66c7c 100644
--- a/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java
+++ b/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java
@@ -51,11 +51,11 @@ public class ExportRegistrationImpl implements ExportRegistration {
private EventProducer sender;
- private ExportRegistrationImpl(ExportRegistrationImpl parent,
+ private ExportRegistrationImpl(ExportRegistrationImpl parent,
CloseHandler rsaCore,
EventProducer sender,
- ExportReferenceImpl exportReference,
- Closeable server,
+ ExportReferenceImpl exportReference,
+ Closeable server,
Throwable exception) {
this.sender = sender;
this.parent = parent != null ? parent.parent : this; // a parent points to itself
@@ -186,7 +186,7 @@ public class ExportRegistrationImpl implements ExportRegistration {
return null;
}
ServiceReference<?> sref = getExportReference().getExportedService();
-
+
HashMap<String, Object> props = new HashMap<>(properties);
EndpointDescription oldEpd = getExportReference().getExportedEndpoint();
copyIfNull(props, oldEpd, RemoteConstants.ENDPOINT_ID);
diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java b/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java
index d442ee7..d4de961 100644
--- a/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java
+++ b/rsa/src/main/java/org/apache/aries/rsa/core/PackageUtil.java
@@ -35,7 +35,7 @@ public class PackageUtil {
public PackageUtil(BundleContext bc) {
this.bc = bc;
}
-
+
/**
* Tries to retrieve the version of iClass via the PackageAdmin.
*
@@ -80,7 +80,7 @@ public class PackageUtil {
}
LOG.info("Unable to find interface version for interface " + iClass.getName()
- + ". Falling back to 0.0.0");
+ + ". Falling back to 0.0.0");
return "0.0.0";
}
}
diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java b/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java
index 7496e80..cc6349c 100644
--- a/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java
+++ b/rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java
@@ -74,8 +74,8 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
private PackageUtil packageUtil;
private CloseHandler closeHandler;
- public RemoteServiceAdminCore(BundleContext context,
- BundleContext apiContext,
+ public RemoteServiceAdminCore(BundleContext context,
+ BundleContext apiContext,
EventProducer eventProducer,
DistributionProvider provider,
PackageUtil packageUtil) {
@@ -95,7 +95,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
};
createServiceListener();
}
-
+
// listen for exported services being unregistered so we can close the export
protected void createServiceListener() {
this.exportedServiceListener = new ServiceListener() {
@@ -142,8 +142,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
}
}
- private boolean isExportConfigSupported(Map<String, Object> serviceProperties)
- {
+ private boolean isExportConfigSupported(Map<String, Object> serviceProperties) {
if (provider == null) {
return false;
}
@@ -213,7 +212,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
private ExportRegistration exportService(
final List<String> interfaceNames,
- final ServiceReference<?> serviceReference,
+ final ServiceReference<?> serviceReference,
final Map<String, Object> serviceProperties) {
LOG.info("interfaces selected for export: " + interfaceNames);
@@ -230,7 +229,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
}
final Class<?>[] interfaces = getInterfaces(serviceO, interfaceNames);
final Map<String, Object> eprops = createEndpointProps(serviceProperties, interfaces);
-
+
// TODO unget service when export is destroyed
Endpoint endpoint = AccessController.doPrivileged(new PrivilegedAction<Endpoint>() {
public Endpoint run() {
@@ -423,17 +422,17 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
LOG.info("No matching handler can be found for remote endpoint {}.", endpoint.getId());
return null;
}
-
+
// TODO: somehow select the interfaces that should be imported ---> job of the TopologyManager?
List<String> matchingInterfaces = endpoint.getInterfaces();
-
+
if (matchingInterfaces.size() == 0) {
LOG.info("No matching interfaces found for remote endpoint {}.", endpoint.getId());
return null;
}
-
- LOG.info("Importing service {} with interfaces {} using handler {}.",
- endpoint.getId(), endpoint.getInterfaces(), provider.getClass());
+
+ LOG.info("Importing service {} with interfaces {} using handler {}.",
+ endpoint.getId(), endpoint.getInterfaces(), provider.getClass());
ImportRegistrationImpl imReg = exposeServiceFactory(matchingInterfaces.toArray(new String[matchingInterfaces.size()]), endpoint, provider);
if (imRegs == null) {
@@ -445,7 +444,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
return imReg;
}
}
-
+
private List<String> determineConfigTypesForImport(EndpointDescription endpoint) {
List<String> remoteConfigurationTypes = endpoint.getConfigurationTypes();
@@ -458,7 +457,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
if (usableConfigurationTypes.size() == 0) {
LOG.info("Ignoring endpoint {} as it has no compatible configuration types: {}.",
- endpoint.getId(), remoteConfigurationTypes);
+ endpoint.getId(), remoteConfigurationTypes);
}
return usableConfigurationTypes;
}
@@ -475,7 +474,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
ClientServiceFactory csf = new ClientServiceFactory(endpoint, handler, imReg);
imReg.setClientServiceFactory(csf);
-
+
/**
* Export the factory using the api context as it has very few imports.
* If the bundle publishing the factory does not import the service interface
@@ -615,12 +614,12 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
}
static void overlayProperties(Map<String, Object> serviceProperties,
- Map<String, Object> additionalProperties) {
+ Map<String, Object> additionalProperties) {
Map<String, String> keysLowerCase = new HashMap<>();
for (String key : serviceProperties.keySet()) {
keysLowerCase.put(key.toLowerCase(), key);
}
-
+
for (Map.Entry<String, Object> e : additionalProperties.entrySet()) {
String key = e.getKey();
String lowerKey = key.toLowerCase();
@@ -628,7 +627,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
|| org.osgi.framework.Constants.OBJECTCLASS.toLowerCase().equals(lowerKey)) {
// objectClass and service.id must not be overwritten
LOG.info("exportService called with additional properties map that contained illegal key: "
- + key + ", the key is ignored");
+ + key + ", the key is ignored");
} else {
String origKey = keysLowerCase.get(lowerKey);
if (origKey != null) {
@@ -657,8 +656,8 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
}
return props;
}
-
- protected Map<String, Object> createEndpointProps(Map<String, Object> effectiveProps,
+
+ protected Map<String, Object> createEndpointProps(Map<String, Object> effectiveProps,
Class<?>[] ifaces) {
Map<String, Object> props = new HashMap<>();
copyEndpointProperties(effectiveProps, props);
@@ -683,7 +682,7 @@ public class RemoteServiceAdminCore implements RemoteServiceAdmin {
}
}
}
-
+
private void checkPermission(EndpointPermission permission) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/event/EventAdminSender.java b/rsa/src/main/java/org/apache/aries/rsa/core/event/EventAdminSender.java
index 181aaff..e8618e9 100644
--- a/rsa/src/main/java/org/apache/aries/rsa/core/event/EventAdminSender.java
+++ b/rsa/src/main/java/org/apache/aries/rsa/core/event/EventAdminSender.java
@@ -35,7 +35,7 @@ import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
public class EventAdminSender {
private HashMap<Integer, String> typeToTopic;
private BundleContext context;
-
+
public EventAdminSender(BundleContext context) {
this.context = context;
typeToTopic = new HashMap<>();
@@ -52,18 +52,18 @@ public class EventAdminSender {
}
public void send(RemoteServiceAdminEvent rsaEvent) {
- final Event event = toEvent(rsaEvent);
- ServiceReference<EventAdmin> sref = this.context.getServiceReference(EventAdmin.class);
- if (sref != null) {
- final EventAdmin eventAdmin = this.context.getService(sref);
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- eventAdmin.postEvent(event);
- return null;
- }
- });
- this.context.ungetService(sref);
- }
+ final Event event = toEvent(rsaEvent);
+ ServiceReference<EventAdmin> sref = this.context.getServiceReference(EventAdmin.class);
+ if (sref != null) {
+ final EventAdmin eventAdmin = this.context.getService(sref);
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
+ eventAdmin.postEvent(event);
+ return null;
+ }
+ });
+ this.context.ungetService(sref);
+ }
}
private Event toEvent(RemoteServiceAdminEvent rsaEvent) {
diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/event/EventProducer.java b/rsa/src/main/java/org/apache/aries/rsa/core/event/EventProducer.java
index 8db8c5d..24a0682 100644
--- a/rsa/src/main/java/org/apache/aries/rsa/core/event/EventProducer.java
+++ b/rsa/src/main/java/org/apache/aries/rsa/core/event/EventProducer.java
@@ -91,9 +91,7 @@ public class EventProducer {
}
}
- @SuppressWarnings({
- "rawtypes", "unchecked"
- })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
protected void notifyListeners(RemoteServiceAdminEvent rsae) {
try {
ServiceReference[] listenerRefs = bctx.getServiceReferences(
@@ -127,6 +125,5 @@ public class EventProducer {
public void notifyUpdate(ImportRegistration importReg) {
notify(RemoteServiceAdminEvent.IMPORT_UPDATE, importReg.getImportReference(), importReg.getException());
-
}
}
diff --git a/rsa/src/test/java/org/apache/aries/rsa/core/ClientServiceFactoryTest.java b/rsa/src/test/java/org/apache/aries/rsa/core/ClientServiceFactoryTest.java
index 19098d3..281d43c 100644
--- a/rsa/src/test/java/org/apache/aries/rsa/core/ClientServiceFactoryTest.java
+++ b/rsa/src/test/java/org/apache/aries/rsa/core/ClientServiceFactoryTest.java
@@ -37,12 +37,9 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
import junit.framework.TestCase;
-
public class ClientServiceFactoryTest extends TestCase {
- @SuppressWarnings({
- "rawtypes"
- })
+ @SuppressWarnings("rawtypes")
public void testGetService() throws ClassNotFoundException {
final Object myTestProxyObject = new Object();
@@ -58,7 +55,6 @@ public class ClientServiceFactoryTest extends TestCase {
EasyMock.expect(consumerBundle.getBundleContext()).andReturn(consumerContext);
ServiceRegistration sreg = control.createMock(ServiceRegistration.class);
-
DistributionProvider handler = mockDistributionProvider(myTestProxyObject);
control.replay();
@@ -73,9 +69,9 @@ public class ClientServiceFactoryTest extends TestCase {
*/
private DistributionProvider mockDistributionProvider(final Object proxy) {
DistributionProvider handler = EasyMock.createMock(DistributionProvider.class);
- EasyMock.expect(handler.importEndpoint(anyObject(ClassLoader.class),
- anyObject(BundleContext.class),
- isA(Class[].class),
+ EasyMock.expect(handler.importEndpoint(anyObject(ClassLoader.class),
+ anyObject(BundleContext.class),
+ isA(Class[].class),
anyObject(EndpointDescription.class))).andReturn(proxy);
EasyMock.replay(handler);
return handler;
diff --git a/rsa/src/test/java/org/apache/aries/rsa/core/DistributionProviderTrackerTest.java b/rsa/src/test/java/org/apache/aries/rsa/core/DistributionProviderTrackerTest.java
index 757b484..6e1fa8a 100644
--- a/rsa/src/test/java/org/apache/aries/rsa/core/DistributionProviderTrackerTest.java
+++ b/rsa/src/test/java/org/apache/aries/rsa/core/DistributionProviderTrackerTest.java
@@ -38,17 +38,14 @@ import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
-@SuppressWarnings({
- "unchecked", "rawtypes"
- })
+@SuppressWarnings({ "unchecked", "rawtypes" })
public class DistributionProviderTrackerTest {
-
@Test
public void testAddingRemoved() throws InvalidSyntaxException {
IMocksControl c = EasyMock.createControl();
DistributionProvider provider = c.createMock(DistributionProvider.class);
-
+
ServiceReference<DistributionProvider> providerRef = c.createMock(ServiceReference.class);
expect(providerRef.getProperty(RemoteConstants.REMOTE_INTENTS_SUPPORTED)).andReturn("");
expect(providerRef.getProperty(RemoteConstants.REMOTE_CONFIGS_SUPPORTED)).andReturn("");
@@ -59,12 +56,12 @@ public class DistributionProviderTrackerTest {
expect(context.createFilter(filterSt)).andReturn(filter);
expect(context.getService(providerRef)).andReturn(provider);
ServiceRegistration rsaReg = c.createMock(ServiceRegistration.class);
- expect(context.registerService(EasyMock.isA(String.class), EasyMock.isA(ServiceFactory.class),
+ expect(context.registerService(EasyMock.isA(String.class), EasyMock.isA(ServiceFactory.class),
EasyMock.isA(Dictionary.class)))
.andReturn(rsaReg).atLeastOnce();
context.addServiceListener(anyObject(ServiceListener.class));
expectLastCall().anyTimes();
-
+
final BundleContext apiContext = c.createMock(BundleContext.class);
c.replay();
DistributionProviderTracker tracker = new DistributionProviderTracker(context) {
@@ -74,7 +71,7 @@ public class DistributionProviderTrackerTest {
};
tracker.addingService(providerRef);
c.verify();
-
+
c.reset();
rsaReg.unregister();
EasyMock.expectLastCall();
@@ -104,7 +101,7 @@ public class DistributionProviderTrackerTest {
.andReturn(rsaReg).atLeastOnce();
context.addServiceListener(anyObject(ServiceListener.class));
expectLastCall().anyTimes();
-
+
final BundleContext apiContext = c.createMock(BundleContext.class);
c.replay();
DistributionProviderTracker tracker = new DistributionProviderTracker(context) {
diff --git a/rsa/src/test/java/org/apache/aries/rsa/core/OverlayPropertiesTest.java b/rsa/src/test/java/org/apache/aries/rsa/core/OverlayPropertiesTest.java
index 66a6a25..d48bd0a 100644
--- a/rsa/src/test/java/org/apache/aries/rsa/core/OverlayPropertiesTest.java
+++ b/rsa/src/test/java/org/apache/aries/rsa/core/OverlayPropertiesTest.java
@@ -30,7 +30,7 @@ import org.junit.Test;
import org.osgi.framework.Constants;
public class OverlayPropertiesTest {
-
+
@Test
public void testOverlayProperties() {
Map<String, Object> sProps = new HashMap<>();
@@ -62,7 +62,7 @@ public class OverlayPropertiesTest {
assertEquals("Should not be possible to override the service.id property",
17L, sProps.get(Constants.SERVICE_ID));
}
-
+
@Test
public void testOverlayProperties2() {
Map<String, Object> original = new HashMap<>();
diff --git a/rsa/src/test/java/org/apache/aries/rsa/core/RemoteServiceAdminCoreTest.java b/rsa/src/test/java/org/apache/aries/rsa/core/RemoteServiceAdminCoreTest.java
index 79c485e..408ff7d 100644
--- a/rsa/src/test/java/org/apache/aries/rsa/core/RemoteServiceAdminCoreTest.java
+++ b/rsa/src/test/java/org/apache/aries/rsa/core/RemoteServiceAdminCoreTest.java
@@ -61,9 +61,7 @@ import org.osgi.service.remoteserviceadmin.ExportRegistration;
import org.osgi.service.remoteserviceadmin.ImportRegistration;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
-@SuppressWarnings({
- "rawtypes", "unchecked"
- })
+@SuppressWarnings({ "rawtypes", "unchecked" })
public class RemoteServiceAdminCoreTest {
private static final String MYCONFIG = "myconfig";
@@ -72,10 +70,10 @@ public class RemoteServiceAdminCoreTest {
private RemoteServiceAdminCore rsaCore;
private BundleContext apiContext;
private DummyProvider provider;
-
+
@Before
public void setup() throws InvalidSyntaxException {
- c = EasyMock.createControl();
+ c = EasyMock.createControl();
rsaContext = c.createMock(BundleContext.class);
Bundle b = createDummyRsaBundle(rsaContext);
expect(rsaContext.getProperty(Constants.FRAMEWORK_VERSION)).andReturn("1111").anyTimes();
@@ -122,12 +120,12 @@ public class RemoteServiceAdminCoreTest {
@Test
public void testDoNotImportUnsupportedConfig() {
EndpointDescription endpoint = createEndpointDesc("unsupportedConfiguration");
-
+
c.replay();
assertNull(rsaCore.importService(endpoint));
assertEquals(0, rsaCore.getImportedEndpoints().size());
-
+
c.verify();
}
@@ -242,7 +240,7 @@ public class RemoteServiceAdminCoreTest {
ereg.close();
assertNumExports(1);
-
+
ereg2.close();
assertNumExports(0);
}
@@ -319,7 +317,7 @@ public class RemoteServiceAdminCoreTest {
assertEquals(42, props.get(RemoteConstants.ENDPOINT_SERVICE_ID));
assertEquals("some_uuid1", props.get(RemoteConstants.ENDPOINT_FRAMEWORK_UUID));
assertEquals(Arrays.asList("java.lang.String"),
- Arrays.asList((Object[]) props.get(org.osgi.framework.Constants.OBJECTCLASS)));
+ Arrays.asList((Object[]) props.get(org.osgi.framework.Constants.OBJECTCLASS)));
assertEquals("1.0.0", props.get("endpoint.package.version.java.lang"));
c.verify();
}
@@ -351,7 +349,7 @@ public class RemoteServiceAdminCoreTest {
Bundle sb = c.createMock(Bundle.class);
expect(sb.getBundleContext()).andReturn(bc).anyTimes();
expect(bc.getBundle()).andReturn(sb).anyTimes();
-
+
String[] propKeys = sProps.keySet().toArray(new String[] {});
ServiceReference sref = c.createMock(ServiceReference.class);
expect(sref.getBundle()).andReturn(sb).anyTimes();
@@ -366,7 +364,7 @@ public class RemoteServiceAdminCoreTest {
expect(bc.getService(sref)).andReturn(svcObject).anyTimes();
return sref;
}
-
+
private EndpointDescription createEndpointDesc(String configType) {
Map<String, Object> p = new HashMap<>();
p.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
@@ -382,7 +380,7 @@ public class RemoteServiceAdminCoreTest {
}
class DummyProvider implements DistributionProvider {
-
+
Endpoint endpoint;
RuntimeException ex;
diff --git a/rsa/src/test/java/org/apache/aries/rsa/core/event/EventProducerTest.java b/rsa/src/test/java/org/apache/aries/rsa/core/event/EventProducerTest.java
index ac09c78..84e70ee 100644
--- a/rsa/src/test/java/org/apache/aries/rsa/core/event/EventProducerTest.java
+++ b/rsa/src/test/java/org/apache/aries/rsa/core/event/EventProducerTest.java
@@ -51,7 +51,7 @@ import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener;
@SuppressWarnings({"rawtypes", "unchecked"})
public class EventProducerTest {
-
+
private IMocksControl c;
private Capture<RemoteServiceAdminEvent> capturedEvent;
private Bundle bundle;
@@ -66,7 +66,7 @@ public class EventProducerTest {
bc = bundleContextWithRsal(bundle);
closeHandler = c.createMock(CloseHandler.class);
}
-
+
@Test
public void testPublishNotification() throws Exception {
final EndpointDescription epd = dummyEndpoint();
@@ -123,11 +123,11 @@ public class EventProducerTest {
private BundleContext bundleContextWithRsal(Bundle bundle)
throws InvalidSyntaxException {
-
+
RemoteServiceAdminListener rsal = c.createMock(RemoteServiceAdminListener.class);
rsal.remoteAdminEvent(EasyMock.capture(capturedEvent));
expectLastCall().atLeastOnce();
-
+
ServiceReference rsalSref = c.createMock(ServiceReference.class);
expect(rsalSref.getBundle()).andReturn(bundle).anyTimes();
diff --git a/spi/src/main/java/org/apache/aries/rsa/spi/DistributionProvider.java b/spi/src/main/java/org/apache/aries/rsa/spi/DistributionProvider.java
index 36f0205..4efd15a 100644
--- a/spi/src/main/java/org/apache/aries/rsa/spi/DistributionProvider.java
+++ b/spi/src/main/java/org/apache/aries/rsa/spi/DistributionProvider.java
@@ -30,17 +30,17 @@ public interface DistributionProvider {
/**
* Called by RemoteServiceAdmin to export a service.
- *
+ *
* The Distribution provider will be called if no config type was set or
* if it supports the config type.
- *
+ *
* @param serviceO service instance to be exported
* @param serviceContext bundle context of the bundle exporting the service
* @param effectiveProperties combined properties of the service and additional properties from rsa
* @param exportedInterfaces name of the interface to be exported
* @return Endpoint that represents the service that is exposed to the outside world
*/
- Endpoint exportService(Object serviceO,
+ Endpoint exportService(Object serviceO,
BundleContext serviceContext,
Map<String, Object> effectiveProperties,
Class[] exportedInterfaces);
@@ -53,7 +53,7 @@ public interface DistributionProvider {
* @return service proxy to be given to the requesting bundle
*/
Object importEndpoint(ClassLoader cl,
- BundleContext consumerContext,
- Class[] interfaces,
+ BundleContext consumerContext,
+ Class[] interfaces,
EndpointDescription endpoint);
}
diff --git a/spi/src/main/java/org/apache/aries/rsa/spi/EndpointDescriptionParser.java b/spi/src/main/java/org/apache/aries/rsa/spi/EndpointDescriptionParser.java
index 36c8c47..b786f14 100644
--- a/spi/src/main/java/org/apache/aries/rsa/spi/EndpointDescriptionParser.java
+++ b/spi/src/main/java/org/apache/aries/rsa/spi/EndpointDescriptionParser.java
@@ -25,10 +25,10 @@ import java.util.List;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
public interface EndpointDescriptionParser {
-
+
List<EndpointDescription> readEndpoints(InputStream is);
-
+
EndpointDescription readEndpoint(InputStream is);
-
+
void writeEndpoint(EndpointDescription epd, OutputStream os);
}
diff --git a/spi/src/main/java/org/apache/aries/rsa/spi/ExportPolicy.java b/spi/src/main/java/org/apache/aries/rsa/spi/ExportPolicy.java
index 289da6b..2d070bd 100644
--- a/spi/src/main/java/org/apache/aries/rsa/spi/ExportPolicy.java
+++ b/spi/src/main/java/org/apache/aries/rsa/spi/ExportPolicy.java
@@ -22,11 +22,10 @@ import java.util.Map;
import org.osgi.framework.ServiceReference;
-
/**
* SPI for TopologyManagerExport. Allows to export services that are
* not marked for export as well customize the way services are exported.
- *
+ *
* Use cases:
* - Mandate SSL and basic authorization by adding the respective intents and configs
* - Add logging interceptor as intent
@@ -37,8 +36,8 @@ public interface ExportPolicy {
* Allows to supply additional properties for a service that are then
* given to RemoteServiceAdmin. The service will be exported
* if the original service or the additional properties contain the
- * non empty property service.exported.interfaces.
- *
+ * non empty property service.exported.interfaces.
+ *
* @param sref service to export
* @return additional properties for exported Service (must not be null)
*/
diff --git a/spi/src/main/java/org/apache/aries/rsa/util/EndpointHelper.java b/spi/src/main/java/org/apache/aries/rsa/util/EndpointHelper.java
index 9d77504..ff47bf8 100644
--- a/spi/src/main/java/org/apache/aries/rsa/util/EndpointHelper.java
+++ b/spi/src/main/java/org/apache/aries/rsa/util/EndpointHelper.java
@@ -30,7 +30,7 @@ public final class EndpointHelper {
public static void addObjectClass(Map<String, Object> props, Class<?>[] interfaces) {
props.put(org.osgi.framework.Constants.OBJECTCLASS, getClassNames(interfaces));
}
-
+
public static String[] getClassNames(Class<?>[] ifaces) {
List<String> ifaceNames = new ArrayList<>();
for (Class<?> iface : ifaces) {
diff --git a/spi/src/main/java/org/apache/aries/rsa/util/StringPlus.java b/spi/src/main/java/org/apache/aries/rsa/util/StringPlus.java
index abe4dd8..6aae706 100644
--- a/spi/src/main/java/org/apache/aries/rsa/util/StringPlus.java
+++ b/spi/src/main/java/org/apache/aries/rsa/util/StringPlus.java
@@ -52,7 +52,7 @@ public final class StringPlus {
if (object instanceof String[]) {
return Arrays.asList((String[])object);
}
-
+
if (object instanceof Collection) {
Collection col = (Collection)object;
List<String> ar = new ArrayList<>(col.size());
diff --git a/topology-manager/Readme.md b/topology-manager/Readme.md
index 1552a65..b4fb2c4 100644
--- a/topology-manager/Readme.md
+++ b/topology-manager/Readme.md
@@ -5,8 +5,8 @@ For the services to be exported it calls RemoteServiceAdmin.exportService to do
EndpointListeners about the new Endpoint.
Listens for service requests from consumers and creates EndpointListeners for these interests.
-The TopologyManager by default exposes all suitably marked local services for export and imports all service interests
-with matching remote Endpoints.
+The TopologyManager by default exposes all suitably marked local services for export and imports all service interests
+with matching remote Endpoints.
## ExportPolicy
@@ -18,5 +18,5 @@ Some examples what could be done:
* Enhancing all exposed remote endpoints with SSL, basic auth, logging
* Exporting OSGi services with annotations for JAX-WS or JAX-RS even when not specially marked for export
-According to its role the TopologyManager does not directly implement the enhancements above. It simply enhances the
+According to its role the TopologyManager does not directly implement the enhancements above. It simply enhances the
service properties and creates the necessary calls to a suitable RemoteServiceAdmin.
diff --git a/topology-manager/pom.xml b/topology-manager/pom.xml
index 1454324..b3dbbb6 100644
--- a/topology-manager/pom.xml
+++ b/topology-manager/pom.xml
@@ -27,7 +27,7 @@
<version>1.15.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
-
+
<artifactId>org.apache.aries.rsa.topology-manager</artifactId>
<packaging>jar</packaging>
<name>Aries Remote Service Admin Topology Manager</name>
@@ -42,11 +42,11 @@
<artifactId>org.apache.aries.rsa.spi</artifactId>
<scope>provided</scope>
</dependency>
-
+
<dependency>
- <groupId>com.shazam</groupId>
- <artifactId>shazamcrest</artifactId>
- <scope>test</scope>
+ <groupId>com.shazam</groupId>
+ <artifactId>shazamcrest</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/Activator.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/Activator.java
index c353775..a07f7f3 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/Activator.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/Activator.java
@@ -75,7 +75,7 @@ public class Activator implements BundleActivator {
EndpointListenerNotifier notifier;
private ServiceTracker<RemoteServiceAdmin, RemoteServiceAdmin> rsaTracker;
private ThreadPoolExecutor exportExecutor;
-
+
private ServiceTracker<ExportPolicy, ExportPolicy> policyTracker;
private EndpointListenerManager endpointListenerManager;
private EndpointEventListenerTracker epeListenerTracker;
@@ -160,7 +160,7 @@ public class Activator implements BundleActivator {
LOG.error("Error in filter {}. This should not occur!", DOSGI_SERVICES);
}
}
-
+
private final class RSATracker extends ServiceTracker<RemoteServiceAdmin, RemoteServiceAdmin> {
private RSATracker(BundleContext context, Class<RemoteServiceAdmin> clazz,
ServiceTrackerCustomizer<RemoteServiceAdmin, RemoteServiceAdmin> customizer) {
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/EndpointEventListenerTracker.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/EndpointEventListenerTracker.java
index 2aab28b..1bd8d09 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/EndpointEventListenerTracker.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/EndpointEventListenerTracker.java
@@ -38,9 +38,9 @@ final class EndpointEventListenerTracker extends ServiceTracker {
super(context, getFilter(), null);
this.tmExport = tmExport;
}
-
+
private static Filter getFilter() {
- String filterSt = String.format("(|(objectClass=%s)(objectClass=%s))", EndpointEventListener.class.getName(),
+ String filterSt = String.format("(|(objectClass=%s)(objectClass=%s))", EndpointEventListener.class.getName(),
EndpointListener.class.getName());
try {
return FrameworkUtil.createFilter(filterSt);
@@ -58,7 +58,7 @@ final class EndpointEventListenerTracker extends ServiceTracker {
}
private EndpointEventListener getListener(Object listener) {
- return (listener instanceof EndpointEventListener)
+ return (listener instanceof EndpointEventListener)
? (EndpointEventListener) listener
: new EndpointListenerAdapter((EndpointListener) listener);
}
@@ -75,5 +75,5 @@ final class EndpointEventListenerTracker extends ServiceTracker {
this.tmExport.removeEPListener((EndpointEventListener) listener);
super.removedService(reference, listener);
}
-
+
}
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerAdapter.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerAdapter.java
index ae6bc82..888be76 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerAdapter.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerAdapter.java
@@ -54,7 +54,7 @@ public class EndpointListenerAdapter implements EndpointEventListener {
break;
}
}
-
+
/**
* Checks for equality of the adapted EndpointListener
*/
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifier.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifier.java
index 5195a0d..2972f1d 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifier.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifier.java
@@ -50,12 +50,12 @@ public class EndpointListenerNotifier {
public EndpointListenerNotifier() {
this.listeners = new ConcurrentHashMap<>();
}
-
+
public static Set<Filter> filtersFromEL(ServiceReference<EndpointListener> sref) {
List<String> scopes = StringPlus.normalize(sref.getProperty(EndpointListener.ENDPOINT_LISTENER_SCOPE));
return getFilterSet(scopes);
}
-
+
public static Set<Filter> filtersFromEEL(ServiceReference<EndpointEventListener> sref) {
List<String> scopes = StringPlus.normalize(sref.getProperty(EndpointEventListener.ENDPOINT_LISTENER_SCOPE));
return getFilterSet(scopes);
@@ -72,7 +72,7 @@ public class EndpointListenerNotifier {
}
return filters;
}
-
+
public void add(EndpointEventListener ep, Set<Filter> filters, Collection<EndpointDescription> endpoints) {
LOG.debug("EndpointListener added");
listeners.put(ep, filters);
@@ -81,12 +81,12 @@ public class EndpointListenerNotifier {
notifyListener(event, ep, filters);
}
}
-
+
public void remove(EndpointEventListener ep) {
LOG.debug("EndpointListener removed");
listeners.remove(ep);
}
-
+
public void sendEvent(EndpointEvent event) {
for (EndpointEventListener listener : listeners.keySet()) {
Set<Filter> filters = listeners.get(listener);
@@ -107,7 +107,7 @@ public class EndpointListenerNotifier {
listener.endpointChanged(event, filter.toString());
}
}
-
+
private static Set<Filter> getMatchingFilters(Set<Filter> filters, EndpointDescription endpoint) {
Set<Filter> matchingFilters = new HashSet<>();
if (endpoint == null) {
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/ServiceExportsRepository.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/ServiceExportsRepository.java
index 547e516..da22cdd 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/ServiceExportsRepository.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/ServiceExportsRepository.java
@@ -77,19 +77,19 @@ public class ServiceExportsRepository implements Closeable {
public void update(ServiceReference<?> sref) {
EndpointDescription updatedEndpoint = registration.update(getServiceProps(sref));
if (reference != null) {
- this.endpoint = updatedEndpoint;
+ this.endpoint = updatedEndpoint;
EndpointEvent event = new EndpointEvent(EndpointEvent.MODIFIED, endpoint);
notifier.sendEvent(event);
}
}
- private Map<String, ?> getServiceProps(ServiceReference<?> sref) {
- HashMap<String, Object> props = new HashMap<>();
- for (String key : sref.getPropertyKeys()) {
- props.put(key, sref.getProperty(key));
- }
- return props;
- }
+ private Map<String, ?> getServiceProps(ServiceReference<?> sref) {
+ HashMap<String, Object> props = new HashMap<>();
+ for (String key : sref.getPropertyKeys()) {
+ props.put(key, sref.getProperty(key));
+ }
+ return props;
+ }
}
public ServiceExportsRepository(RemoteServiceAdmin rsa, EndpointListenerNotifier notifier) {
@@ -108,10 +108,10 @@ public class ServiceExportsRepository implements Closeable {
List<ExportRegistrationHolder> holderList = new ArrayList<>(exports.size());
exportsMap.put(sref, holderList);
for (ExportRegistration reg : exports) {
- ExportReference exportReference = reg.getExportReference();
+ ExportReference exportReference = reg.getExportReference();
if (exportReference != null) {
EndpointDescription endpoint = exportReference.getExportedEndpoint();
- ExportRegistrationHolder holder = new ExportRegistrationHolder(reg, endpoint);
+ ExportRegistrationHolder holder = new ExportRegistrationHolder(reg, endpoint);
holderList.add(holder);
}
}
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java
index 019bd21..db91be4 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java
@@ -67,7 +67,7 @@ public class TopologyManagerExport implements ServiceListener {
public TopologyManagerExport(
EndpointListenerNotifier notifier,
- Executor executor,
+ Executor executor,
ExportPolicy policy) {
this.notifier = notifier;
this.execService = executor;
@@ -102,7 +102,7 @@ public class TopologyManagerExport implements ServiceListener {
case ServiceEvent.MODIFIED:
modified(sref);
break;
-
+
case ServiceEvent.MODIFIED_ENDMATCH:
remove(sref);
break;
@@ -127,7 +127,7 @@ public class TopologyManagerExport implements ServiceListener {
repo.removeService(sref);
}
}
-
+
public String getTypeName(ServiceEvent event) {
return typeNames.get(event.getType());
}
@@ -170,7 +170,7 @@ public class TopologyManagerExport implements ServiceListener {
repo.addService(sref, regs);
}
}
-
+
private Collection<ExportRegistration> exportService(
final RemoteServiceAdmin rsa,
final ServiceReference<?> sref) {
@@ -204,7 +204,7 @@ public class TopologyManagerExport implements ServiceListener {
reg.close();
}
}
-
+
return exportRegs;
}
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java
index d1aa24b..8071903 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/MultiMap.java
@@ -33,11 +33,11 @@ import java.util.concurrent.CopyOnWriteArraySet;
public class MultiMap<K, V> {
private Map<K, Set<V>> map;
-
+
public MultiMap() {
map = new ConcurrentHashMap<>();
}
-
+
public void put(K key, V value) {
map.compute(key, (k, v) -> {
if (v == null) {
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java
index 97273ff..2dd995b 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImport.java
@@ -63,13 +63,13 @@ public class TopologyManagerImport implements EndpointEventListener, RemoteServi
* List of already imported Endpoints by their matched filter
*/
private final MultiMap<String, ImportRegistration> importedServices = new MultiMap<>();
-
+
public TopologyManagerImport(BundleContext bc) {
this.rsaSet = new CopyOnWriteArraySet<>();
bctx = bc;
execService = new ThreadPoolExecutor(5, 10, 50, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory(getClass()));
}
-
+
public void start() {
stopped = false;
bctx.registerService(RemoteServiceAdminListener.class, this, null);
@@ -100,7 +100,7 @@ public class TopologyManagerImport implements EndpointEventListener, RemoteServi
triggerSynchronizeImports(filter);
}
}
-
+
public void remove(RemoteServiceAdmin rsa) {
rsaSet.remove(rsa);
}
@@ -122,7 +122,7 @@ public class TopologyManagerImport implements EndpointEventListener, RemoteServi
});
}
}
-
+
private void synchronizeImports(final String filter) {
try {
unImportForGoneEndpoints(filter);
@@ -236,17 +236,17 @@ public class TopologyManagerImport implements EndpointEventListener, RemoteServi
EndpointDescription endpoint = event.getEndpoint();
LOG.debug("Endpoint event received type {}, filter {}, endpoint {}", event.getType(), filter, endpoint);
switch (event.getType()) {
- case EndpointEvent.ADDED :
+ case EndpointEvent.ADDED:
importPossibilities.put(filter, endpoint);
break;
- case EndpointEvent.REMOVED :
+ case EndpointEvent.REMOVED:
importPossibilities.remove(filter, endpoint);
break;
- case EndpointEvent.MODIFIED :
+ case EndpointEvent.MODIFIED:
importPossibilities.remove(filter, endpoint);
importPossibilities.put(filter, endpoint);
break;
- case EndpointEvent.MODIFIED_ENDMATCH :
+ case EndpointEvent.MODIFIED_ENDMATCH:
importPossibilities.remove(filter, endpoint);
break;
}
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java
index 6f48f20..8aa28d9 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java
@@ -36,9 +36,9 @@ import org.slf4j.LoggerFactory;
/**
* Manages the endpoint listener for the import of external services.
- * The endpoint listener scope reflects the combined filters of all services
- * that are asked for (by listeners and service lookups) in the current system.
- *
+ * The endpoint listener scope reflects the combined filters of all services
+ * that are asked for (by listeners and service lookups) in the current system.
+ *
* Discovery will then send callbacks when external endpoints are added / removed that match
* the interest in the local system.
*/
@@ -68,12 +68,12 @@ public class EndpointListenerManager implements ServiceInterestListener{
private final BundleContext bctx;
private volatile ServiceRegistration<?> serviceRegistration;
-
+
private final List<String> filters = new ArrayList<>();
private final EndpointEventListener endpointListener;
private final ListenerHookImpl listenerHook;
private RSFindHook findHook;
-
+
/**
* Count service interest by filter. This allows to modify the scope of the EndpointListener as seldom as possible
*/
@@ -89,8 +89,7 @@ public class EndpointListenerManager implements ServiceInterestListener{
public void start() {
EndpointListener endpointListenerAdapter = new EndpointListenerAdapter();
String[] ifAr = new String[] {EndpointListener.class.getName(), EndpointEventListener.class.getName()};
- serviceRegistration = bctx.registerService(ifAr, endpointListenerAdapter,
- getEELProperties());
+ serviceRegistration = bctx.registerService(ifAr, endpointListenerAdapter, getEELProperties());
bctx.registerService(ListenerHook.class, listenerHook, null);
bctx.registerService(FindHook.class, findHook, null);
@@ -129,7 +128,7 @@ public class EndpointListenerManager implements ServiceInterestListener{
p.put(EndpointEventListener.ENDPOINT_LISTENER_SCOPE, copyFilters());
return p;
}
-
+
public List<String> copyFilters() {
synchronized (filters) {
return new ArrayList<>(filters);
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelper.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelper.java
index 2871a04..15e1836 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelper.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelper.java
@@ -41,7 +41,7 @@ public final class FilterHelper {
}
return null;
}
-
+
private static final Set<String> SYSTEM_PACKAGES;
static {
SYSTEM_PACKAGES = new HashSet<>();
@@ -53,14 +53,14 @@ public final class FilterHelper {
SYSTEM_PACKAGES.add("org.springframework.osgi.context.event.OsgiBundleApplicationContextListener");
SYSTEM_PACKAGES.add("java.net.ContentHandler");
}
-
+
public static boolean isClassExcluded(String className) {
if (className == null) {
return true;
}
-
+
if (className.startsWith("org.osgi.service.clusterinfo")) {
- return false;
+ return false;
}
for (String p : SYSTEM_PACKAGES) {
@@ -70,12 +70,12 @@ public final class FilterHelper {
}
return false;
}
-
+
public static String getFullFilter(String objectClass, String filter) {
if (objectClass == null) {
return filter;
}
- String nameFilter = String.format("(objectClass=%s)", objectClass);
+ String nameFilter = String.format("(objectClass=%s)", objectClass);
return (filter == null) ? nameFilter : String.format("(&%s%s)", nameFilter, filter);
}
}
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/RSFindHook.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/RSFindHook.java
index 994cae1..05fb899 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/RSFindHook.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/RSFindHook.java
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
public class RSFindHook implements FindHook {
private static final Logger LOG = LoggerFactory.getLogger(RSFindHook.class);
-
+
private BundleContext bctx;
private String frameworkUUID;
private ServiceInterestListener serviceInterestListener;
@@ -43,14 +43,14 @@ public class RSFindHook implements FindHook {
@Override
public void find(BundleContext context, String name, String filter, boolean allServices,
- Collection<ServiceReference<?>> references) {
+ Collection<ServiceReference<?>> references) {
if (context.equals(bctx)) {
LOG.debug("ListenerHookImpl: skipping request from myself");
return;
}
-
+
String fullFilter = FilterHelper.getFullFilter(name, filter);
-
+
if (fullFilter == null) {
LOG.debug("skipping empty filter");
return;
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/ActivatorTest.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/ActivatorTest.java
index 3d479cf..e3fc0e5 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/ActivatorTest.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/ActivatorTest.java
@@ -51,7 +51,7 @@ public class ActivatorTest {
Activator activator = new Activator();
activator.doStart(context, new DefaultExportPolicy());
c.verify();
-
+
c.reset();
c.replay();
activator.doStop(context);
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifierTest.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifierTest.java
index 95bc7f3..2ca301a 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifierTest.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/EndpointListenerNotifierTest.java
@@ -56,11 +56,9 @@ import org.osgi.service.remoteserviceadmin.RemoteConstants;
import com.shazam.shazamcrest.MatcherAssert;
import com.shazam.shazamcrest.matcher.Matchers;
-@SuppressWarnings({
- "rawtypes", "unchecked",
- })
+@SuppressWarnings({ "rawtypes", "unchecked" })
public class EndpointListenerNotifierTest {
-
+
@Before
public void before() {
}
@@ -73,12 +71,12 @@ public class EndpointListenerNotifierTest {
Capture<String> capturedFilters = newCapture(CaptureType.ALL);
epl.endpointChanged(capture(capturedEvents), capture(capturedFilters));
expectLastCall().anyTimes();
-
+
EndpointDescription endpoint1 = createEndpoint("myClass");
EndpointDescription endpoint2 = createEndpoint("notMyClass");
c.replay();
-
+
EndpointListenerNotifier notifier = new EndpointListenerNotifier();
Filter filter = FrameworkUtil.createFilter("(objectClass=myClass)");
notifier.add(epl, new HashSet(asList(filter)), Collections.emptyList());
@@ -88,12 +86,12 @@ public class EndpointListenerNotifierTest {
notifier.sendEvent(new EndpointEvent(EndpointEvent.REMOVED, endpoint2));
c.verify();
- // Expect listener to be called for endpoint1 but not for endpoint2
+ // Expect listener to be called for endpoint1 but not for endpoint2
List<EndpointEvent> expected = Arrays.asList(
new EndpointEvent(EndpointEvent.ADDED, endpoint1),
new EndpointEvent(EndpointEvent.REMOVED, endpoint1)
);
-
+
MatcherAssert.assertThat(capturedEvents.getValues(), Matchers.sameBeanAs(expected));
}
@@ -117,7 +115,7 @@ public class EndpointListenerNotifierTest {
@Test
public void testNormalizeScopeForStringArray() {
String[] filters = {"(myProp=A)", "(otherProp=B)"};
- ServiceReference sr = createListenerServiceWithFilter(filters);
+ ServiceReference sr = createListenerServiceWithFilter(filters);
Set<Filter> res = EndpointListenerNotifier.filtersFromEL(sr);
assertEquals(filters.length, res.size());
Iterator<Filter> it = res.iterator();
@@ -140,7 +138,7 @@ public class EndpointListenerNotifierTest {
props.put("myProp", "A");
Assert.assertThat(filter1.match(props) || filter2.match(props), is(true));
}
-
+
private void filterMatches(Filter filter) {
Dictionary<String, String> props = new Hashtable();
props.put("myProp", "A");
@@ -153,5 +151,5 @@ public class EndpointListenerNotifierTest {
EasyMock.replay(sr);
return sr;
}
-
+
}
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/RecordingEndpointEventListener.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/RecordingEndpointEventListener.java
index e7b29a0..c26ff09 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/RecordingEndpointEventListener.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/RecordingEndpointEventListener.java
@@ -36,7 +36,7 @@ class RecordingEndpointEventListener implements EndpointEventListener {
public void endpointChanged(EndpointEvent event, String filter) {
events.add(event);
}
-
+
public void matches(EndpointEvent ... endpointEvents) {
assertThat("Incorrect number of events received", events.size(), equalTo(endpointEvents.length));
Iterator<EndpointEvent> it = events.iterator();
@@ -44,5 +44,5 @@ class RecordingEndpointEventListener implements EndpointEventListener {
assertThat(it.next(), samePropertyValuesAs(event));
}
}
-
+
}
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExportTest.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExportTest.java
index 6d2639a..f8a47c7 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExportTest.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExportTest.java
@@ -51,7 +51,7 @@ import com.shazam.shazamcrest.MatcherAssert;
@SuppressWarnings({"rawtypes", "unchecked"})
public class TopologyManagerExportTest {
-
+
private IMocksControl c;
private RemoteServiceAdmin rsa;
private EndpointListenerNotifier notifier;
@@ -67,7 +67,7 @@ public class TopologyManagerExportTest {
events = EasyMock.newCapture(CaptureType.ALL);
notifier.sendEvent(EasyMock.capture(events));
EasyMock.expectLastCall().anyTimes();
-
+
Executor executor = syncExecutor();
ExportPolicy policy = new DefaultExportPolicy();
exportManager = new TopologyManagerExport(notifier, executor, policy);
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImportTest.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImportTest.java
index 404d67f..240298a 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImportTest.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/TopologyManagerImportTest.java
@@ -55,7 +55,7 @@ public class TopologyManagerImportTest {
return ir;
}
}).once();
-
+
ir.close();
EasyMock.expectLastCall();
c.replay();
@@ -66,7 +66,7 @@ public class TopologyManagerImportTest {
tm.endpointChanged(event, "myFilter");
tm.add(rsa);
assertTrue("rsa.ImportService should have been called",
- sema.tryAcquire(100, TimeUnit.SECONDS));
+ sema.tryAcquire(100, TimeUnit.SECONDS));
tm.stop();
c.verify();
}
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerImplTest.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerImplTest.java
index e92b6aa..4846b16 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerImplTest.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerImplTest.java
@@ -38,9 +38,7 @@ public class EndpointListenerImplTest extends Assert {
int testCase;
- @SuppressWarnings({
- "rawtypes", "unchecked"
- })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testScopeChange() {
IMocksControl c = EasyMock.createNiceControl();
@@ -58,7 +56,7 @@ public class EndpointListenerImplTest extends Assert {
// expect property changes based on later calls
EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
-
+
public Object answer() throws Throwable {
Object[] args = EasyMock.getCurrentArguments();
Dictionary props = (Dictionary)args[0];
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelperTest.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelperTest.java
index 90be459..5c42fac 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelperTest.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/FilterHelperTest.java
@@ -27,18 +27,18 @@ import org.junit.Test;
import org.osgi.service.cm.ConfigurationAdmin;
public class FilterHelperTest {
-
- @Test
- public void testIgnore() {
- assertThat(isClassExcluded(ConfigurationAdmin.class.getName()), equalTo(true));
- assertThat(isClassExcluded("org.osgi.service.clusterinfo.NodeStatus"), equalTo(false));
- }
+
+ @Test
+ public void testIgnore() {
+ assertThat(isClassExcluded(ConfigurationAdmin.class.getName()), equalTo(true));
+ assertThat(isClassExcluded("org.osgi.service.clusterinfo.NodeStatus"), equalTo(false));
+ }
@Test
public void testClass() {
testWithClassName(FilterHelperTest.class.getName());
}
-
+
@Test
public void testInnerClass() {
testWithClassName(InnerClass.class.getName());
@@ -49,7 +49,7 @@ public class FilterHelperTest {
String objClass = FilterHelper.getObjectClass(filter);
Assert.assertEquals(className, objClass);
}
-
+
@Test
public void testGetFullFilter() {
String filter = "(a=b)";
@@ -58,7 +58,7 @@ public class FilterHelperTest {
Assert.assertEquals("(objectClass=my.Test)", FilterHelper.getFullFilter(objectClass, null));
Assert.assertEquals("(&(objectClass=my.Test)(a=b))", FilterHelper.getFullFilter(objectClass, filter));
}
-
+
class InnerClass {
}
diff --git a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/ListenerHookImplTest.java b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/ListenerHookImplTest.java
index 6f0a75f..742619b 100644
--- a/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/ListenerHookImplTest.java
+++ b/topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/importer/local/ListenerHookImplTest.java
@@ -54,7 +54,7 @@ public class ListenerHookImplTest {
m.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, "MyUUID");
assertFalse(filter + " filter must NOT match as uuid is the local one", f.match(m));
}
-
+
@Test
public void testAddedRemoved() throws InvalidSyntaxException {
IMocksControl c = EasyMock.createControl();
@@ -67,7 +67,7 @@ public class ListenerHookImplTest {
ListenerInfo listener = c.createMock(ListenerInfo.class);
EasyMock.expect(listener.getBundleContext()).andReturn(listenerBc);
EasyMock.expect(listener.getFilter()).andReturn(filter).atLeastOnce();
-
+
// Main assertions
serviceInterestListener.addServiceInterest(listenerHook.extendFilter(filter));
EasyMock.expectLastCall();
@@ -75,7 +75,7 @@ public class ListenerHookImplTest {
EasyMock.expectLastCall();
Collection<ListenerInfo> listeners = Collections.singletonList(listener);
-
+
c.replay();
listenerHook.added(listeners);
listenerHook.removed(listeners);