Clean up akka-remote for OSGi and re-enable OSGi bundles. See #2497

This commit is contained in:
Björn Antonsson 2012-09-17 12:54:08 +02:00
parent 1715c60190
commit 5f63469264
24 changed files with 84 additions and 62 deletions

View file

@ -15,7 +15,7 @@ import akka.cluster.routing.ClusterRouterConfig
import akka.event.EventStream
import akka.remote.RemoteActorRefProvider
import akka.remote.RemoteDeployer
import akka.routing.RemoteRouterConfig
import akka.remote.routing.RemoteRouterConfig
import akka.cluster.routing.ClusterRouterSettings
class ClusterActorRefProvider(

View file

@ -28,7 +28,7 @@ import akka.routing.Route
import akka.routing.RouteeProvider
import akka.routing.Router
import akka.routing.RouterConfig
import akka.routing.RemoteRouterConfig
import akka.remote.routing.RemoteRouterConfig
import akka.actor.RootActorPath
import akka.actor.ActorCell
import akka.actor.RelativeActorPath

View file

@ -5,7 +5,7 @@ package docs.jrouting;
import akka.routing.RoundRobinRouter;
import akka.routing.DefaultResizer;
import akka.routing.RemoteRouterConfig;
import akka.remote.routing.RemoteRouterConfig;
import akka.actor.ActorRef;
import akka.actor.Props;
import akka.actor.UntypedActor;

View file

@ -6,7 +6,8 @@
The 2.1 release contains several structural changes that require some
simple, mechanical source-level changes in client code. Several things have
been moved to Scala standard library, such as ``Future``.
been moved to Scala standard library, such as ``Future``, and some package
names have been changed in Remoting.
When migrating from 1.3.x to 2.1.x you should first follow the instructions for
migrating `1.3.x to 2.0.x <http://doc.akka.io/docs/akka/2.0.3/project/migration-guide-1.3.x-2.0.x.html>`_.
@ -358,4 +359,18 @@ v2.1::
else if (requestedCapacity < 0) routeeProvider.removeRoutees(
-requestedCapacity, stopDelay)
Package Name Changes in Remoting
================================
The package name of all classes in the ``akka-remote.jar`` artifact now starts with akka.remote.
This has been done to enable OSGi bundles that don't have conflicting package names.
Change the following import statements. Please note that the serializers are often referenced from configuration.
================================================ =======================================================
Search Replace with
================================================ =======================================================
``akka.routing.RemoteRouterConfig`` ``akka.remote.routing.RemoteRouterConfig``
``akka.serialization.ProtobufSerializer`` ``akka.remote.serialization.ProtobufSerializer``
``akka.serialization.DaemonMsgCreateSerializer`` ``akka.remote.serialization.DaemonMsgCreateSerializer``
================================================ =======================================================

View file

@ -6,7 +6,7 @@ package docs.routing
import akka.routing.RoundRobinRouter
import akka.actor.{ ActorRef, Props, Actor, ActorSystem }
import akka.routing.DefaultResizer
import akka.routing.RemoteRouterConfig
import akka.remote.routing.RemoteRouterConfig
case class Message1(nbr: Int)

View file

@ -104,7 +104,7 @@ package docs.serialization {
actor {
serializers {
java = "akka.serialization.JavaSerializer"
proto = "akka.serialization.ProtobufSerializer"
proto = "akka.remote.serialization.ProtobufSerializer"
myown = "docs.serialization.MyOwnSerializer"
}
}
@ -122,7 +122,7 @@ package docs.serialization {
actor {
serializers {
java = "akka.serialization.JavaSerializer"
proto = "akka.serialization.ProtobufSerializer"
proto = "akka.remote.serialization.ProtobufSerializer"
myown = "docs.serialization.MyOwnSerializer"
}

View file

@ -13,8 +13,8 @@ akka {
actor {
serializers {
proto = "akka.serialization.ProtobufSerializer"
daemon-create = "akka.serialization.DaemonMsgCreateSerializer"
proto = "akka.remote.serialization.ProtobufSerializer"
daemon-create = "akka.remote.serialization.DaemonMsgCreateSerializer"
}

View file

@ -5,6 +5,7 @@ package akka.remote
import akka.actor._
import akka.routing._
import akka.remote.routing._
import com.typesafe.config._
import akka.ConfigurationException

View file

@ -9,7 +9,7 @@ import javax.net.ssl.{ KeyManagerFactory, TrustManager, TrustManagerFactory, SSL
import akka.remote.RemoteTransportException
import akka.event.LoggingAdapter
import java.io.{ IOException, FileNotFoundException, FileInputStream }
import akka.security.provider.AkkaProvider
import akka.remote.security.provider.AkkaProvider
import java.security._
/**

View file

@ -1,8 +1,9 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.routing
package akka.remote.routing
import akka.routing.{ Route, Router, RouterConfig, RouteeProvider, Resizer }
import com.typesafe.config.ConfigFactory
import akka.actor.ActorContext
import akka.actor.ActorRef

View file

@ -1,7 +1,7 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.security.provider
package akka.remote.security.provider
import org.uncommons.maths.random.{ AESCounterRNG }
import SeedSize.Seed128

View file

@ -1,7 +1,7 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.security.provider
package akka.remote.security.provider
import org.uncommons.maths.random.{ AESCounterRNG, SecureRandomSeedGenerator }
import SeedSize.Seed128

View file

@ -1,7 +1,7 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.security.provider
package akka.remote.security.provider
import org.uncommons.maths.random.{ AESCounterRNG }
import SeedSize.Seed256

View file

@ -1,7 +1,7 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.security.provider
package akka.remote.security.provider
import org.uncommons.maths.random.{ AESCounterRNG, SecureRandomSeedGenerator }
import SeedSize.Seed256

View file

@ -1,7 +1,7 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.security.provider
package akka.remote.security.provider
import java.security.{ PrivilegedAction, AccessController, Provider, Security }

View file

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// ============================================================================
package akka.security.provider
package akka.remote.security.provider
import org.uncommons.maths.random.{ SeedGenerator, SeedException, SecureRandomSeedGenerator, RandomDotOrgSeedGenerator, DevRandomSeedGenerator }

View file

@ -2,7 +2,7 @@
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.security.provider
package akka.remote.security.provider
/**
* Internal API

View file

@ -2,8 +2,9 @@
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.serialization
package akka.remote.serialization
import akka.serialization.{ Serializer, SerializationExtension }
import java.io.Serializable
import com.google.protobuf.ByteString
import com.typesafe.config.{ Config, ConfigFactory }

View file

@ -2,8 +2,9 @@
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.serialization
package akka.remote.serialization
import akka.serialization.{ Serializer, Serialization }
import com.google.protobuf.Message
import akka.actor.DynamicAccess
import akka.remote.RemoteProtocol.ActorRefProtocol

View file

@ -1,7 +1,9 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ProtobufProtocol.proto
package akka.actor;
package akka.remote;
import com.google.protobuf.AbstractMessage;
public final class ProtobufProtocol {
private ProtobufProtocol() {}
@ -43,12 +45,12 @@ public final class ProtobufProtocol {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return akka.actor.ProtobufProtocol.internal_static_akka_actor_MyMessage_descriptor;
return ProtobufProtocol.internal_static_akka_actor_MyMessage_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return akka.actor.ProtobufProtocol.internal_static_akka_actor_MyMessage_fieldAccessorTable;
return ProtobufProtocol.internal_static_akka_actor_MyMessage_fieldAccessorTable;
}
private int bitField0_;
@ -175,41 +177,41 @@ public final class ProtobufProtocol {
return super.writeReplace();
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(
public static ProtobufProtocol.MyMessage parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(
public static ProtobufProtocol.MyMessage parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(byte[] data)
public static ProtobufProtocol.MyMessage parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data).buildParsed();
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(
public static ProtobufProtocol.MyMessage parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return newBuilder().mergeFrom(data, extensionRegistry)
.buildParsed();
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(java.io.InputStream input)
public static ProtobufProtocol.MyMessage parseFrom(java.io.InputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(
public static ProtobufProtocol.MyMessage parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
public static akka.actor.ProtobufProtocol.MyMessage parseDelimitedFrom(java.io.InputStream input)
public static ProtobufProtocol.MyMessage parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
Builder builder = newBuilder();
if (builder.mergeDelimitedFrom(input)) {
@ -218,7 +220,7 @@ public final class ProtobufProtocol {
return null;
}
}
public static akka.actor.ProtobufProtocol.MyMessage parseDelimitedFrom(
public static ProtobufProtocol.MyMessage parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
@ -229,12 +231,12 @@ public final class ProtobufProtocol {
return null;
}
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(
public static ProtobufProtocol.MyMessage parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return newBuilder().mergeFrom(input).buildParsed();
}
public static akka.actor.ProtobufProtocol.MyMessage parseFrom(
public static ProtobufProtocol.MyMessage parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
@ -244,7 +246,7 @@ public final class ProtobufProtocol {
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(akka.actor.ProtobufProtocol.MyMessage prototype) {
public static Builder newBuilder(ProtobufProtocol.MyMessage prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@ -257,15 +259,15 @@ public final class ProtobufProtocol {
}
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements akka.actor.ProtobufProtocol.MyMessageOrBuilder {
implements ProtobufProtocol.MyMessageOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return akka.actor.ProtobufProtocol.internal_static_akka_actor_MyMessage_descriptor;
return ProtobufProtocol.internal_static_akka_actor_MyMessage_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return akka.actor.ProtobufProtocol.internal_static_akka_actor_MyMessage_fieldAccessorTable;
return ProtobufProtocol.internal_static_akka_actor_MyMessage_fieldAccessorTable;
}
// Construct using akka.actor.ProtobufProtocol.MyMessage.newBuilder()
@ -302,33 +304,33 @@ public final class ProtobufProtocol {
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return akka.actor.ProtobufProtocol.MyMessage.getDescriptor();
return ProtobufProtocol.MyMessage.getDescriptor();
}
public akka.actor.ProtobufProtocol.MyMessage getDefaultInstanceForType() {
return akka.actor.ProtobufProtocol.MyMessage.getDefaultInstance();
public ProtobufProtocol.MyMessage getDefaultInstanceForType() {
return ProtobufProtocol.MyMessage.getDefaultInstance();
}
public akka.actor.ProtobufProtocol.MyMessage build() {
akka.actor.ProtobufProtocol.MyMessage result = buildPartial();
public ProtobufProtocol.MyMessage build() {
ProtobufProtocol.MyMessage result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
throw AbstractMessage.Builder.newUninitializedMessageException(result);
}
return result;
}
private akka.actor.ProtobufProtocol.MyMessage buildParsed()
private ProtobufProtocol.MyMessage buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
akka.actor.ProtobufProtocol.MyMessage result = buildPartial();
ProtobufProtocol.MyMessage result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(
result).asInvalidProtocolBufferException();
throw AbstractMessage.Builder.newUninitializedMessageException(
result).asInvalidProtocolBufferException();
}
return result;
}
public akka.actor.ProtobufProtocol.MyMessage buildPartial() {
akka.actor.ProtobufProtocol.MyMessage result = new akka.actor.ProtobufProtocol.MyMessage(this);
public ProtobufProtocol.MyMessage buildPartial() {
ProtobufProtocol.MyMessage result = new ProtobufProtocol.MyMessage(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
@ -349,16 +351,16 @@ public final class ProtobufProtocol {
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof akka.actor.ProtobufProtocol.MyMessage) {
return mergeFrom((akka.actor.ProtobufProtocol.MyMessage)other);
if (other instanceof ProtobufProtocol.MyMessage) {
return mergeFrom((ProtobufProtocol.MyMessage)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(akka.actor.ProtobufProtocol.MyMessage other) {
if (other == akka.actor.ProtobufProtocol.MyMessage.getDefaultInstance()) return this;
public Builder mergeFrom(ProtobufProtocol.MyMessage other) {
if (other == ProtobufProtocol.MyMessage.getDefaultInstance()) return this;
if (other.hasId()) {
setId(other.getId());
}
@ -550,8 +552,8 @@ public final class ProtobufProtocol {
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_akka_actor_MyMessage_descriptor,
new java.lang.String[] { "Id", "Name", "Status", },
akka.actor.ProtobufProtocol.MyMessage.class,
akka.actor.ProtobufProtocol.MyMessage.Builder.class);
ProtobufProtocol.MyMessage.class,
ProtobufProtocol.MyMessage.Builder.class);
return null;
}
};

View file

@ -6,6 +6,7 @@ package akka.remote
import akka.testkit._
import akka.routing._
import akka.actor._
import akka.remote.routing._
import com.typesafe.config._
object RemoteRouterSpec {

View file

@ -2,10 +2,11 @@
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.serialization
package akka.remote.serialization
import language.postfixOps
import akka.serialization.SerializationExtension
import com.typesafe.config.ConfigFactory
import akka.testkit.AkkaSpec
import akka.actor.{ Actor, Address, Props, Deploy, OneForOneStrategy, SupervisorStrategy, FromClassCreator }

View file

@ -2,11 +2,12 @@
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.serialization
package akka.remote.serialization
import akka.serialization.SerializationExtension
import akka.testkit.AkkaSpec
import akka.remote.RemoteProtocol.MessageProtocol
import akka.actor.ProtobufProtocol.MyMessage
import akka.remote.ProtobufProtocol.MyMessage
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class ProtobufSerializerSpec extends AkkaSpec {

View file

@ -522,7 +522,7 @@ object AkkaBuild extends Build {
val osgiAries = exports() ++ Seq(OsgiKeys.privatePackage := Seq("akka.osgi.aries.*"))
val remote = exports(Seq("akka.remote.*", "akka.routing.*", "akka.serialization.*"))
val remote = exports(Seq("akka.remote.*"))
val slf4j = exports(Seq("akka.event.slf4j.*"))
@ -532,9 +532,7 @@ object AkkaBuild extends Build {
val zeroMQ = exports(Seq("akka.zeromq.*"))
def exports(packages: Seq[String] = Seq()) = Seq.empty
def exportsReal(packages: Seq[String] = Seq()) = osgiSettings ++ Seq(
def exports(packages: Seq[String] = Seq()) = osgiSettings ++ Seq(
OsgiKeys.importPackage := defaultImports,
OsgiKeys.exportPackage := packages
)