Author: bdekruijff at gmail.com
Date: Tue Jan 11 11:54:17 2011
New Revision: 586
Log:
[sandbox] refactored for naming consistency
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/FabricManagerService.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMember.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberAddedEvent.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberRemovedEvent.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ClusterChannelService.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/RoutableMessage.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ChannelMemberImpl.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ClusterUtilities.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/ClusterMemberServiceBase.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/tribes/TribesClusterMemberServiceImpl.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DiscoveryService.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DistributionService.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/ServiceEndPoint.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/DistributionUtilities.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDepublishMessage.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDiscoveryMessage.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointInvokeMessage.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointPublishMessage.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointResponseMessage.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/LocalServiceInvocationHandler.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DiscoveryServiceImpl.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DistributionServiceImpl.java
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java
sandbox/bdekruijff/fabric/src/test/java/org/amdatu/core/fabric/remote/service/ChannelMemberUtilitiesTest.java
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/FabricManagerService.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/FabricManagerService.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/FabricManagerService.java
Tue Jan 11 11:54:17 2011
@@ -6,16 +6,16 @@
String CONFIGURATION_PID = "org.amdatu.core.fabric";
- boolean createClusterChannel(String clusterGroupId, Dictionary<String,
Object> properties);
+ boolean createClusterChannel(String clusterChannelId, Dictionary<String,
Object> channelProperties);
- boolean removeClusterChannel(String clusterGroupId);
+ boolean removeClusterChannel(String clusterChannelId);
- boolean createDiscovery(String clusterGroupId, String serviceGroupId);
+ boolean createDiscovery(String clusterChannelId, String serviceGroupId);
- boolean removeDiscovery(String clusterGroupId, String serviceGroupId);
+ boolean removeDiscovery(String clusterChannelId, String serviceGroupId);
- boolean createDistribution(String clusterGroupId, String serviceGroupId);
+ boolean createDistribution(String clusterChannelId, String serviceGroupId);
- boolean removeDistribution(String clusterGroupId, String serviceGroupId);
+ boolean removeDistribution(String clusterChannelId, String serviceGroupId);
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMember.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMember.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMember.java
Tue Jan 11 11:54:17 2011
@@ -18,5 +18,5 @@
public interface ChannelMember {
- String getName();
+ String getId();
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberAddedEvent.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberAddedEvent.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberAddedEvent.java
Tue Jan 11 11:54:17 2011
@@ -2,20 +2,20 @@
public class ChannelMemberAddedEvent {
- private final String m_memberName;
+ private final String m_channelmemberId;
- public ChannelMemberAddedEvent(final String memberName) {
- m_memberName = memberName;
+ public ChannelMemberAddedEvent(String channelMemberId) {
+ m_channelmemberId = channelMemberId;
}
public String getMemberName() {
- return m_memberName;
+ return m_channelmemberId;
}
@Override
public String toString() {
StringBuilder sb = new
StringBuilder(ChannelMemberAddedEvent.class.getSimpleName() + "{");
- sb.append("\n\tmemberName: " + m_memberName);
+ sb.append("\n\tchannelMemberId: " + m_channelmemberId);
sb.append("\n}");
return sb.toString();
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberRemovedEvent.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberRemovedEvent.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ChannelMemberRemovedEvent.java
Tue Jan 11 11:54:17 2011
@@ -2,20 +2,20 @@
public class ChannelMemberRemovedEvent {
- private final String m_memberName;
+ private final String m_channelMemberId;
- public ChannelMemberRemovedEvent(final String memberName) {
- m_memberName = memberName;
+ public ChannelMemberRemovedEvent(String channelMemberId) {
+ m_channelMemberId = channelMemberId;
}
public String getMemberName() {
- return m_memberName;
+ return m_channelMemberId;
}
@Override
public String toString() {
StringBuilder sb = new
StringBuilder(ChannelMemberRemovedEvent.class.getSimpleName() + "{");
- sb.append("\n\tmemberName: " + m_memberName);
+ sb.append("\n\tchannelMemberId: " + m_channelMemberId);
sb.append("\n}");
return sb.toString();
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ClusterChannelService.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ClusterChannelService.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/ClusterChannelService.java
Tue Jan 11 11:54:17 2011
@@ -44,9 +44,9 @@
* Sample service registration:
* <pre>
* objectClass = org.amdatu.core.fabric.cluster.ClusterMemberService
- * org.amdatu.fabric.cluster.CLUSTERGROUP = cluster-1
- * org.amdatu.fabric.cluster.CLUSTERMEMBER = member-1
- * org.amdatu.fabric.cluster.tribes.args = -port, 8881, -mport, 8888
+ * org.amdatu.fabric.CLUSTERCHANNEL = cluster-1
+ * org.amdatu.fabric.CHANNELMEMBER = member-1
+ * org.amdatu.fabric.CHANNELCONFIG = = <unknown value type>
* service.id = 922
* </pre>
*
@@ -58,21 +58,21 @@
* clusterchannel <code>String</code> value for this service. This may be
* used for service selection.
*/
- String SERVICE_CLUSTERCHANNEL_PROPERTY =
"org.amdatu.fabric.cluster.CLUSTERGROUP";
+ String SERVICE_CLUSTERCHANNEL_PROPERTY =
"org.amdatu.fabric.CLUSTERCHANNEL";
/**
* OSGi service registration property name that is used to publish the
* clustermember <code>String</code> value for this service. This may be
* used for service selection.
*/
- String SERVICE_CLUSTERMEMBER_PROPERTY =
"org.amdatu.fabric.cluster.CLUSTERMEMBER";
+ String SERVICE_CHANNELMEMBER_PROPERTY = "org.amdatu.fabric.CHANNELMEMBER";
/**
* OSGi service registration property name that is used to publish the
* configuration properties <code>Dictionary<String, Object></code>
* value for this service. This may be used for service selection.
*/
- String SERVICE_CONFIGURATION_PROPERTY =
"org.amdatu.fabric.cluster.CONFIGURATION";
+ String SERVICE_CHANNELCONFIG_PROPERTY = "org.amdatu.fabric.CHANNELCONFIG";
/**
* <code>String</code> value to be replaced by the appropriate
clusterchannel
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/RoutableMessage.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/RoutableMessage.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/RoutableMessage.java
Tue Jan 11 11:54:17 2011
@@ -31,82 +31,82 @@
private static final long serialVersionUID = 1L;
- private String m_fromClusterChannel;
- private String m_fromChannelMember;
- private String m_fromServiceGroup;
+ private String m_fromClusterChannelId;
+ private String m_fromChannelMemberId;
+ private String m_fromServiceGroupId;
- private String m_toClusterChannel;
- private String m_toChannelMember;
- private String m_toServiceGroup;
+ private String m_toClusterChannelId;
+ private String m_toChannelMemberId;
+ private String m_toServiceGroupId;
- public RoutableMessage(final String serviceGroup) {
- m_fromServiceGroup = serviceGroup;
- m_toServiceGroup = serviceGroup;
+ public RoutableMessage(final String serviceGroupId) {
+ m_fromServiceGroupId = serviceGroupId;
+ m_toServiceGroupId = serviceGroupId;
}
- public RoutableMessage(String clusterChannel, String channelMember, String
serviceGroup) {
- m_toClusterChannel = clusterChannel;
- m_toServiceGroup = serviceGroup;
- m_toChannelMember = channelMember;
+ public RoutableMessage(String clusterChannelId, String channelMemberId,
String serviceGroupId) {
+ m_toClusterChannelId = clusterChannelId;
+ m_toServiceGroupId = serviceGroupId;
+ m_toChannelMemberId = channelMemberId;
}
- public final String getFromClusterChannel() {
- return m_fromClusterChannel;
+ public final String getFromClusterChannelId() {
+ return m_fromClusterChannelId;
}
- public final void setFromClusterChannel(String clusterChannel) {
- m_fromClusterChannel = clusterChannel;
+ public final void setFromClusterChannelId(String clusterChannelId) {
+ m_fromClusterChannelId = clusterChannelId;
}
- public final String getFromChannelMember() {
- return m_fromChannelMember;
+ public final String getFromChannelMemberId() {
+ return m_fromChannelMemberId;
}
- public final void setFromChannelMember(String channelMember) {
- m_fromChannelMember = channelMember;
+ public final void setFromChannelMemberId(String channelMemberId) {
+ m_fromChannelMemberId = channelMemberId;
}
- public final String getFromServiceGroup() {
- return m_fromServiceGroup;
+ public final String getFromServiceGroupId() {
+ return m_fromServiceGroupId;
}
- public final void setFromServiceGroup(String serviceGroup) {
- m_fromServiceGroup = serviceGroup;
+ public final void setFromServiceGroupId(String serviceGroupId) {
+ m_fromServiceGroupId = serviceGroupId;
}
- public final String getToClusterChannel() {
- return m_toClusterChannel;
+ public final String getToClusterChannelId() {
+ return m_toClusterChannelId;
}
- public final void setToClusterChannel(String clusterChannel) {
- m_toClusterChannel = clusterChannel;
+ public final void setToClusterChannelId(String clusterChannelId) {
+ m_toClusterChannelId = clusterChannelId;
}
- public final String getToChannelMember() {
- return m_toChannelMember;
+ public final String getToChannelMemberId() {
+ return m_toChannelMemberId;
}
- public final void setToChannelMember(String memberName) {
- m_toChannelMember = memberName;
+ public final void setToChannelMemberId(String channelMemberId) {
+ m_toChannelMemberId = channelMemberId;
}
- public final String getToServiceGroup() {
- return m_toServiceGroup;
+ public final String getToServiceGroupId() {
+ return m_toServiceGroupId;
}
- public final void setToServiceGroup(String serviceGroup) {
- m_toServiceGroup = serviceGroup;
+ public final void setToServiceGroupId(String serviceGroupId) {
+ m_toServiceGroupId = serviceGroupId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("RoutableMessage{");
- sb.append("\n\tfromClusterChannel=" + m_fromClusterChannel);
- sb.append("\n\tfromChannelMember=" + m_fromChannelMember);
- sb.append("\n\tfromServiceGroup=" + m_fromServiceGroup);
- sb.append("\n\ttoClusterChannel=" + m_toClusterChannel);
- sb.append("\n\ttoChannelMember=" + m_toChannelMember);
- sb.append("\n\ttoServiceGroup=" + m_toServiceGroup);
+ sb.append("\n\tfromClusterChannel=" + m_fromClusterChannelId);
+ sb.append("\n\tfromChannelMember=" + m_fromChannelMemberId);
+ sb.append("\n\tfromServiceGroup=" + m_fromServiceGroupId);
+ sb.append("\n\ttoClusterChannel=" + m_toClusterChannelId);
+ sb.append("\n\ttoChannelMember=" + m_toChannelMemberId);
+ sb.append("\n\ttoServiceGroup=" + m_toServiceGroupId);
sb.append("\n}");
return sb.toString();
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ChannelMemberImpl.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ChannelMemberImpl.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ChannelMemberImpl.java
Tue Jan 11 11:54:17 2011
@@ -20,22 +20,22 @@
public class ChannelMemberImpl implements ChannelMember {
- public final String m_name;
+ public final String m_Id;
/********************************************************
* Constructors
********************************************************/
- public ChannelMemberImpl(final String memberName) {
- m_name = memberName;
+ public ChannelMemberImpl(String channelMemberId) {
+ m_Id = channelMemberId;
}
/********************************************************
* ClusterMember
********************************************************/
- public String getName() {
- return m_name;
+ public String getId() {
+ return m_Id;
}
/********************************************************
@@ -44,11 +44,11 @@
@Override
public boolean equals(Object obj) {
- return m_name.equals(((ChannelMemberImpl) obj).getName());
+ return m_Id.equals(((ChannelMemberImpl) obj).getId());
}
@Override
public int hashCode() {
- return m_name.hashCode();
+ return m_Id.hashCode();
}
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ClusterUtilities.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ClusterUtilities.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/ClusterUtilities.java
Tue Jan 11 11:54:17 2011
@@ -25,25 +25,25 @@
private final static Pattern m_validNamePattern =
Pattern.compile("[a-zA-Z0-9-_]+");
- public static String getClusterChannelSendTopic(final String
clusterChannel) {
+ public static String getClusterChannelSendTopic(String clusterChannelId) {
return ClusterChannelService.EVENT_SEND_TOPIC_TEMPLATE.replace(
-
ClusterChannelService.EVENT_TOPIC_TEMPLATE_CLUSTERCHANNEL_PLACEHOLDER,
clusterChannel);
+
ClusterChannelService.EVENT_TOPIC_TEMPLATE_CLUSTERCHANNEL_PLACEHOLDER,
clusterChannelId);
}
- public static String getClusterChannelReceiveTopic(final String
clusterChannel) {
+ public static String getClusterChannelReceiveTopic(String
clusterChannelId) {
return ClusterChannelService.EVENT_RECIEVE_TOPIC_TEMPLATE.replace(
-
ClusterChannelService.EVENT_TOPIC_TEMPLATE_CLUSTERCHANNEL_PLACEHOLDER,
clusterChannel);
+
ClusterChannelService.EVENT_TOPIC_TEMPLATE_CLUSTERCHANNEL_PLACEHOLDER,
clusterChannelId);
}
- public static boolean isValidChannelName(final String channelName) {
- if (channelName == null || "".equals(channelName)) {
+ public static boolean isValidClusterChannelId(String clusterChannelId) {
+ if (clusterChannelId == null || "".equals(clusterChannelId)) {
return false;
}
- Matcher matcher = m_validNamePattern.matcher(channelName);
+ Matcher matcher = m_validNamePattern.matcher(clusterChannelId);
return matcher.matches();
}
- public static boolean isValidMemberName(final String memberName) {
- return isValidChannelName(memberName);
+ public static boolean isValidChannelMemberId(String channelMemberId) {
+ return isValidClusterChannelId(channelMemberId);
}
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/internal/tribes/ClusterChannelCreator.java
Tue Jan 11 11:54:17 2011
@@ -118,16 +118,16 @@
private static final String DOMAIN_ENCODING = "ISO-8859-1";
- public static Channel createChannel(String channelName, Dictionary<String,
Object> options) throws Exception {
+ public static Channel createChannel(String channelName, Dictionary<String,
Object> channelOptions) throws Exception {
byte[] domain = channelName.getBytes(DOMAIN_ENCODING);
NioReceiver rx = new NioReceiver();
- rx.setAddress(checkStringProperty(options.get(PROP_TCPBIND),
PROP_TCPBIND_DEFAULT));
- rx.setPort(checkIntegerProperty(options.get(PROP_TCPPORT),
PROP_TCPPORT_DEFAULT));
- rx.setSelectorTimeout(checkIntegerProperty(options.get(PROP_TCPSELTO),
PROP_TCPSELTO_DEFAULT));
- rx.setMaxThreads(checkIntegerProperty(options.get(PROP_TCPTHREADS),
PROP_TCPTHREADS_DEFAULT));
- rx.setMinThreads(checkIntegerProperty(options.get(PROP_TCPTHREADS),
PROP_TCPTHREADS_DEFAULT));
+ rx.setAddress(checkStringProperty(channelOptions.get(PROP_TCPBIND),
PROP_TCPBIND_DEFAULT));
+ rx.setPort(checkIntegerProperty(channelOptions.get(PROP_TCPPORT),
PROP_TCPPORT_DEFAULT));
+
rx.setSelectorTimeout(checkIntegerProperty(channelOptions.get(PROP_TCPSELTO),
PROP_TCPSELTO_DEFAULT));
+
rx.setMaxThreads(checkIntegerProperty(channelOptions.get(PROP_TCPTHREADS),
PROP_TCPTHREADS_DEFAULT));
+
rx.setMinThreads(checkIntegerProperty(channelOptions.get(PROP_TCPTHREADS),
PROP_TCPTHREADS_DEFAULT));
rx.getBind();
rx.setRxBufSize(43800);
rx.setTxBufSize(25188);
@@ -135,13 +135,13 @@
ReplicationTransmitter tx = new ReplicationTransmitter();
PooledMultiSender sender = new PooledMultiSender();
- sender.setTimeout(checkIntegerProperty(options.get(PROP_TCKACKTO),
PROP_TCPACKTO_DEFAULT));
+
sender.setTimeout(checkIntegerProperty(channelOptions.get(PROP_TCKACKTO),
PROP_TCPACKTO_DEFAULT));
sender.setMaxRetryAttempts(2);
sender.setRxBufSize(43800);
sender.setTxBufSize(25188);
tx.setTransport(sender);
- String membership = checkStringProperty(options.get(PROP_MEMBERSHIP),
PROP_MEMBERSHIP_DEFAULT);
+ String membership =
checkStringProperty(channelOptions.get(PROP_MEMBERSHIP),
PROP_MEMBERSHIP_DEFAULT);
MembershipService ms;
if (membership.equals("static")) {
ms = new NoMcastMembershipServiceImpl();
@@ -149,12 +149,12 @@
}
else {
McastService mc = new McastService();
- mc.setAddress(checkStringProperty(options.get(PROP_MCASTADDR),
PROP_MCASTADDR_DEFAULT));
- if (checkStringProperty(options.get(PROP_MCASTBIND),
PROP_MCASTBIND_DEFAULT).equals(""))
-
mc.setMcastBindAddress(checkStringProperty(options.get(PROP_MCASTBIND),
PROP_MCASTBIND_DEFAULT));
- mc.setFrequency(checkIntegerProperty(options.get(PROP_MCASTFREQ),
PROP_MCASTFREQ_DEFAULT));
-
mc.setMcastDropTime(checkIntegerProperty(options.get(PROP_MCASTDROP),
PROP_MCASTDROP_DEFAULT));
- mc.setPort(checkIntegerProperty(options.get(PROP_MCASTPORT),
PROP_MCASTPORT_DEFAULT));
+
mc.setAddress(checkStringProperty(channelOptions.get(PROP_MCASTADDR),
PROP_MCASTADDR_DEFAULT));
+ if (checkStringProperty(channelOptions.get(PROP_MCASTBIND),
PROP_MCASTBIND_DEFAULT).equals(""))
+
mc.setMcastBindAddress(checkStringProperty(channelOptions.get(PROP_MCASTBIND),
PROP_MCASTBIND_DEFAULT));
+
mc.setFrequency(checkIntegerProperty(channelOptions.get(PROP_MCASTFREQ),
PROP_MCASTFREQ_DEFAULT));
+
mc.setMcastDropTime(checkIntegerProperty(channelOptions.get(PROP_MCASTDROP),
PROP_MCASTDROP_DEFAULT));
+
mc.setPort(checkIntegerProperty(channelOptions.get(PROP_MCASTPORT),
PROP_MCASTPORT_DEFAULT));
mc.setDomain(domain);
ms = mc;
}
@@ -165,7 +165,7 @@
channel.setMembershipService(ms);
Member[] staticMembers =
-
memberArrayFromString(checkStringProperty(options.get(PROP_STATICMEMBERS),
PROP_STATICMEMBERS_DEFAULT),
+
memberArrayFromString(checkStringProperty(channelOptions.get(PROP_STATICMEMBERS),
PROP_STATICMEMBERS_DEFAULT),
domain);
if (staticMembers != null && staticMembers.length > 0) {
StaticMemberMonitorInterceptor smi = new
StaticMemberMonitorInterceptor();
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/ClusterMemberServiceBase.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/ClusterMemberServiceBase.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/ClusterMemberServiceBase.java
Tue Jan 11 11:54:17 2011
@@ -50,8 +50,9 @@
private final Map<String, ChannelMember> m_clusterMembers = new
HashMap<String, ChannelMember>();
private final ReentrantReadWriteLock m_clusterMembersLock = new
ReentrantReadWriteLock();
- private final String m_clusterId;
- private final Dictionary<String, Object> m_properties;
+ private final String m_clusterChannelId;
+ private final Dictionary<String, Object> m_channelProperties;
+ private volatile String m_channelMemberId;
private final String m_recieveEventTopic;
private final String m_sendEventTopic;
@@ -62,25 +63,24 @@
private volatile LogService m_logService;
private volatile Component m_broadcastEventHandlerComponent;
- private volatile String m_memberId;
/********************************************************
* Constructors
********************************************************/
- public ClusterMemberServiceBase(String clusterGroupId, Dictionary<String,
Object> properties) {
- m_clusterId = clusterGroupId;
- m_memberId = UUID.randomUUID().toString();
- m_properties = new Hashtable<String, Object>();
- if (properties != null) {
- Enumeration<String> enumeration = properties.keys();
+ public ClusterMemberServiceBase(String clusterChannelId,
Dictionary<String, Object> channelProperties) {
+ m_clusterChannelId = clusterChannelId;
+ m_channelMemberId = UUID.randomUUID().toString();
+ m_channelProperties = new Hashtable<String, Object>();
+ if (channelProperties != null) {
+ Enumeration<String> enumeration = channelProperties.keys();
while (enumeration.hasMoreElements()) {
String key = (String) enumeration.nextElement();
- m_properties.put(key, properties.get(key));
+ m_channelProperties.put(key, channelProperties.get(key));
}
}
- m_recieveEventTopic =
ClusterUtilities.getClusterChannelReceiveTopic(m_clusterId);
- m_sendEventTopic =
ClusterUtilities.getClusterChannelSendTopic(m_clusterId);
+ m_recieveEventTopic =
ClusterUtilities.getClusterChannelReceiveTopic(m_clusterChannelId);
+ m_sendEventTopic =
ClusterUtilities.getClusterChannelSendTopic(m_clusterChannelId);
}
/********************************************************
@@ -102,13 +102,15 @@
public final synchronized void start() {
m_dependencyManager.add(m_broadcastEventHandlerComponent);
onStart();
- m_logService.log(LogService.LOG_WARNING, "Started ClusterChannel: " +
m_clusterId + "/" + m_memberId);
+ m_logService.log(LogService.LOG_WARNING, "Started ClusterChannel: " +
m_clusterChannelId + "/"
+ + m_channelMemberId);
}
public final synchronized void stop() {
m_dependencyManager.remove(m_broadcastEventHandlerComponent);
onStop();
- m_logService.log(LogService.LOG_WARNING, "Stopped ClusterChannel: " +
m_clusterId + "/" + m_memberId);
+ m_logService.log(LogService.LOG_WARNING, "Stopped ClusterChannel: " +
m_clusterChannelId + "/"
+ + m_channelMemberId);
}
/********************************************************
@@ -119,25 +121,24 @@
return m_logService;
}
- protected final String getClusterId() {
- return m_clusterId;
+ protected final String getClusterChannelId() {
+ return m_clusterChannelId;
}
- protected final String getMemberId() {
- return m_memberId;
+ protected final String getChannelMemberId() {
+ return m_channelMemberId;
}
- protected final void setMemberId(String memberId) {
- m_memberId = memberId;
+ protected final void setChannelMemberId(String channelMemberId) {
+ m_channelMemberId = channelMemberId;
updateServiceProperties();
}
- protected final Dictionary<String, Object> getProperties() {
- return m_properties;
-
+ protected final Dictionary<String, Object> getChannelProperties() {
+ return m_channelProperties;
}
- protected final ChannelMember[] getClusterMembers() {
+ protected final ChannelMember[] getChannelMembers() {
m_clusterMembersLock.readLock().lock();
try {
return m_clusterMembers.values().toArray(new
ChannelMember[m_clusterMembers.size()]);
@@ -147,40 +148,40 @@
}
}
- protected final ChannelMember getClusterMember(final String memberId) {
+ protected final ChannelMember getChannelMember(String channelMemberId) {
m_clusterMembersLock.readLock().lock();
try {
- return m_clusterMembers.get(memberId);
+ return m_clusterMembers.get(channelMemberId);
}
finally {
m_clusterMembersLock.readLock().unlock();
}
}
- protected final void addClusterMember(ChannelMember clusterMember) {
+ protected final void addChannelMember(ChannelMember channelMember) {
m_clusterMembersLock.writeLock().lock();
try {
- m_clusterMembers.put(clusterMember.getName(), clusterMember);
+ m_clusterMembers.put(channelMember.getId(), channelMember);
}
finally {
m_clusterMembersLock.writeLock().unlock();
}
Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(EVENT_MESSAGE_PROPERTY, new
ChannelMemberAddedEvent(clusterMember.getName()));
+ props.put(EVENT_MESSAGE_PROPERTY, new
ChannelMemberAddedEvent(channelMember.getId()));
Event broadCastEvent = new Event(m_recieveEventTopic, props);
m_eventAdmin.postEvent(broadCastEvent);
}
- protected final void removeClusterMember(String memberId) {
+ protected final void removeChannelMember(String channelMember) {
m_clusterMembersLock.writeLock().lock();
try {
- m_clusterMembers.remove(memberId);
+ m_clusterMembers.remove(channelMember);
}
finally {
m_clusterMembersLock.writeLock().unlock();
}
Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(EVENT_MESSAGE_PROPERTY, new
ChannelMemberRemovedEvent(memberId));
+ props.put(EVENT_MESSAGE_PROPERTY, new
ChannelMemberRemovedEvent(channelMember));
Event broadCastEvent = new Event(m_recieveEventTopic, props);
m_eventAdmin.postEvent(broadCastEvent);
}
@@ -212,7 +213,7 @@
protected abstract void doBroadcast(Object message);
- protected abstract void doSend(ChannelMember[] clusterMember, Object
message);
+ protected abstract void doSend(ChannelMember[] channelMember, Object
message);
/********************************************************
* Private methods
@@ -223,9 +224,9 @@
Dictionary<String, Object> serviceProps =
m_component.getServiceProperties();
if (serviceProps == null)
serviceProps = new Hashtable<String, Object>();
-
serviceProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterId);
- serviceProps.put(ClusterChannelService.SERVICE_CLUSTERMEMBER_PROPERTY,
m_memberId);
- serviceProps.put(ClusterChannelService.SERVICE_CONFIGURATION_PROPERTY,
m_properties);
+
serviceProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterChannelId);
+ serviceProps.put(ClusterChannelService.SERVICE_CHANNELMEMBER_PROPERTY,
m_channelMemberId);
+ serviceProps.put(ClusterChannelService.SERVICE_CHANNELCONFIG_PROPERTY,
m_channelProperties);
m_component.setServiceProperties(serviceProps);
}
@@ -266,11 +267,11 @@
return;
}
RoutableMessage routableMessage = (RoutableMessage) message;
- routableMessage.setFromClusterChannel(m_clusterId);
- routableMessage.setFromChannelMember(m_memberId);
- routableMessage.setToClusterChannel(m_clusterId);
- if (routableMessage.getToChannelMember() != null) {
- ChannelMember clusterMember =
getClusterMember(routableMessage.getToChannelMember());
+ routableMessage.setFromClusterChannelId(m_clusterChannelId);
+ routableMessage.setFromChannelMemberId(m_channelMemberId);
+ routableMessage.setToClusterChannelId(m_clusterChannelId);
+ if (routableMessage.getToChannelMemberId() != null) {
+ ChannelMember clusterMember =
getChannelMember(routableMessage.getToChannelMemberId());
if (clusterMember == null) {
m_logService.log(LogService.LOG_ERROR, "RoutedMessage
specifies unknown target member: "
+ routableMessage.toString());
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/tribes/TribesClusterMemberServiceImpl.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/tribes/TribesClusterMemberServiceImpl.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/cluster/service/tribes/TribesClusterMemberServiceImpl.java
Tue Jan 11 11:54:17 2011
@@ -54,9 +54,9 @@
* Constructors
********************************************************/
- public TribesClusterMemberServiceImpl(String clusterGroupId,
- Dictionary<String, Object> properties) {
- super(clusterGroupId, properties);
+ public TribesClusterMemberServiceImpl(String clusterChannelId,
+ Dictionary<String, Object> channelProperties) {
+ super(clusterChannelId, channelProperties);
}
/********************************************************
@@ -74,11 +74,11 @@
try {
m_managedChannel =
(ManagedChannel) ClusterChannelCreator
- .createChannel(getClusterId(), getProperties());
+ .createChannel(getClusterChannelId(),
getChannelProperties());
Properties props = new Properties();
- props.setProperty(SERVICE_CLUSTERCHANNEL_PROPERTY, getClusterId());
- props.setProperty(SERVICE_CLUSTERMEMBER_PROPERTY, getMemberId());
+ props.setProperty(SERVICE_CLUSTERCHANNEL_PROPERTY,
getClusterChannelId());
+ props.setProperty(SERVICE_CHANNELMEMBER_PROPERTY,
getChannelMemberId());
m_managedChannel.getMembershipService().setPayload(getPayload(props));
m_managedChannel.addMembershipListener(new
TribesMembershipListener());
@@ -86,7 +86,7 @@
m_managedChannel.start(Channel.DEFAULT);
Member localMember =
m_managedChannel.getMembershipService().getLocalMember(false);
- setMemberId(Arrays.toString(localMember.getUniqueId()));
+ setChannelMemberId(Arrays.toString(localMember.getUniqueId()));
}
catch (Exception e) {
getLogService().log(LogService.LOG_ERROR, "Exception while
starting managed channel", e);
@@ -126,7 +126,7 @@
}
@Override
- public void doSend(ChannelMember[] clusterMembers, Object message) {
+ public void doSend(ChannelMember[] channelMembers, Object message) {
if (!(message instanceof Serializable)) {
getLogService().log(LogService.LOG_ERROR,
"Dropping message during broadcast because is is not
Serializable: "
@@ -136,8 +136,8 @@
List<Member> memberList = new LinkedList<Member>();
m_membersLock.readLock().lock();
try {
- for (ChannelMember clusterMember : clusterMembers) {
- Member member = m_members.get(clusterMember.getName());
+ for (ChannelMember channelMember : channelMembers) {
+ Member member = m_members.get(channelMember.getId());
if (member != null) {
memberList.add(member);
}
@@ -177,7 +177,7 @@
finally {
m_membersLock.writeLock().unlock();
}
- super.addClusterMember(new ChannelMemberImpl(memberId));
+ super.addChannelMember(new ChannelMemberImpl(memberId));
}
private void memberDisappeared(Member member) {
@@ -190,7 +190,7 @@
finally {
m_membersLock.writeLock().unlock();
}
- super.removeClusterMember(memberId);
+ super.removeChannelMember(memberId);
}
private void sendToMembers(Object message, Member[] members) {
@@ -231,7 +231,7 @@
public void messageReceived(Serializable message, Member member) {
String memberId = getMemberId(member);
- ChannelMember clusterMember = getClusterMember(memberId);
+ ChannelMember clusterMember = getChannelMember(memberId);
if (clusterMember == null) {
getLogService().log(LogService.LOG_ERROR,
"Dropping message for active member: " +
message.toString());
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DiscoveryService.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DiscoveryService.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DiscoveryService.java
Tue Jan 11 11:54:17 2011
@@ -18,6 +18,6 @@
public interface DiscoveryService {
- String REMOTE_SERVICEGROUPID_PROP =
"org.amdatu.fabric.remote.SERVICEGROUP";
+ String REMOTE_SERVICEGROUP_PROP = "org.amdatu.fabric.SERVICEGROUP";
String EVENT_TOPIC_DISCOVERY = "org/amdatu/fabric/remote/DISCOVERY";
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DistributionService.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DistributionService.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/DistributionService.java
Tue Jan 11 11:54:17 2011
@@ -23,7 +23,6 @@
String EVENT_TOPIC_INVOKE = "org/amdatu/fabric/remote/INVOKE";
String EVENT_TOPIC_RESPONSE = "org/amdatu/fabric/remote/RESPONSE";
- // see OSGi R42 spec 13.5.1
// FIXME we are not actually doing anything to support these intents
String DISTRIBUTION_INTENT_AUTHENTICATION = "authentication";
String DISTRIBUTION_INTENT_CONFIDENTIALITY = "confidentiality";
@@ -47,5 +46,4 @@
String SERVICE_IMPORTED_PROP = "service.imported";
String SERVICE_IMPORTED_CONFIGS_PROP = "service.imported.configs";
-
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/ServiceEndPoint.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/ServiceEndPoint.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/ServiceEndPoint.java
Tue Jan 11 11:54:17 2011
@@ -24,9 +24,9 @@
private static final long serialVersionUID = 1L;
- private String m_clusterId;
- private String m_memberId;
- private String m_serviceGroup;
+ private String m_clusterChannelId;
+ private String m_channelMemberId;
+ private String m_serviceGroupId;
private String[] m_objectClass;
private long m_originalServiceId;
private Hashtable<String, Object> m_properties;
@@ -34,28 +34,28 @@
public ServiceEndPoint() {
}
- public String getClusterId() {
- return m_clusterId;
+ public String getClusterChannelId() {
+ return m_clusterChannelId;
}
- public void setClusterId(String clusterId) {
- m_clusterId = clusterId;
+ public void setClusterChannelId(String clusterChannelId) {
+ m_clusterChannelId = clusterChannelId;
}
- public String getMemberId() {
- return m_memberId;
+ public String getChannelMemberId() {
+ return m_channelMemberId;
}
- public void setMemberId(String memberId) {
- m_memberId = memberId;
+ public void setChannelMemberId(String channelMemberId) {
+ m_channelMemberId = channelMemberId;
}
- public String getServiceGroup() {
- return m_serviceGroup;
+ public String getServiceGroupId() {
+ return m_serviceGroupId;
}
- public void setServiceGroup(String serviceGroup) {
- m_serviceGroup = serviceGroup;
+ public void setServiceGroupId(String serviceGroupId) {
+ m_serviceGroupId = serviceGroupId;
}
public String[] getObjectClass() {
@@ -85,21 +85,23 @@
@Override
public boolean equals(Object obj) {
ServiceEndPoint other = (ServiceEndPoint) obj;
- if ((getServiceGroup() == null && other.getServiceGroup() != null)
- || (getServiceGroup() != null &&
other.getServiceGroup() == null))
+ if ((getServiceGroupId() == null && other.getServiceGroupId() != null)
+ || (getServiceGroupId() != null &&
other.getServiceGroupId() == null))
return false;
- if ((getClusterId() == null && other.getClusterId() != null)
- || (getClusterId() != null && other.getClusterId() ==
null))
+ if ((getClusterChannelId() == null && other.getClusterChannelId() !=
null)
+ || (getClusterChannelId() != null &&
other.getClusterChannelId() == null))
return false;
- if ((getMemberId() == null && other.getMemberId() != null)
- || (getMemberId() != null && other.getMemberId() ==
null))
+ if ((getChannelMemberId() == null && other.getChannelMemberId() !=
null)
+ || (getChannelMemberId() != null &&
other.getChannelMemberId() == null))
return false;
- if (!(getServiceGroup() == null && other.getServiceGroup() == null) &&
!getServiceGroup().equals(
- other.getServiceGroup()))
+ if (!(getServiceGroupId() == null && other.getServiceGroupId() ==
null) && !getServiceGroupId().equals(
+ other.getServiceGroupId()))
return false;
- if (!(getClusterId() == null && other.getClusterId() == null) &&
!getClusterId().equals(other.getClusterId()))
+ if (!(getClusterChannelId() == null && other.getClusterChannelId() ==
null)
+ && !getClusterChannelId().equals(other.getClusterChannelId()))
return false;
- if (!(getMemberId() == null && other.getMemberId() == null) &&
!getMemberId().equals(other.getMemberId()))
+ if (!(getChannelMemberId() == null && other.getChannelMemberId() ==
null)
+ && !getChannelMemberId().equals(other.getChannelMemberId()))
return false;
if (getOriginalServiceId() != other.getOriginalServiceId())
return false;
@@ -109,12 +111,12 @@
@Override
public int hashCode() {
String key = "";
- if (getServiceGroup() != null)
- key += getServiceGroup();
- if (getClusterId() != null)
- key += getClusterId();
- if (getMemberId() != null)
- key += getMemberId();
+ if (getServiceGroupId() != null)
+ key += getServiceGroupId();
+ if (getClusterChannelId() != null)
+ key += getClusterChannelId();
+ if (getChannelMemberId() != null)
+ key += getChannelMemberId();
key += getOriginalServiceId();
return key.hashCode();
}
@@ -122,8 +124,8 @@
@Override
public String toString() {
StringBuilder sb = new
StringBuilder(ServiceEndPoint.class.getSimpleName() + "{");
- sb.append("\n\tclusterid=" + getClusterId());
- sb.append("\n\tmemberid=" + getMemberId());
+ sb.append("\n\tclusterchannelid=" + getClusterChannelId());
+ sb.append("\n\tchannelmemberid=" + getChannelMemberId());
sb.append("\n\tobjectClass=[");
for (int i = 0; i < getObjectClass().length; i++) {
if (i > 0)
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/DistributionUtilities.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/DistributionUtilities.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/DistributionUtilities.java
Tue Jan 11 11:54:17 2011
@@ -26,12 +26,12 @@
public final class DistributionUtilities {
- public static String getLocalInvokeTopic(final String clusterGroup, final
String serviceGroup) {
- return DistributionService.EVENT_TOPIC_INVOKE + "/" + clusterGroup +
"/" + serviceGroup;
+ public static String getLocalInvokeTopic(final String clusterGroupId,
final String serviceGroupId) {
+ return DistributionService.EVENT_TOPIC_INVOKE + "/" + clusterGroupId +
"/" + serviceGroupId;
}
- public static String getLocalResponseTopic(final String clusterGroup,
final String serviceGroup) {
- return DistributionService.EVENT_TOPIC_RESPONSE + "/" + clusterGroup +
"/" + serviceGroup;
+ public static String getLocalResponseTopic(final String clusterGroupId,
final String serviceGroupId) {
+ return DistributionService.EVENT_TOPIC_RESPONSE + "/" + clusterGroupId
+ "/" + serviceGroupId;
}
public static boolean isConfigurationTypeSupported(Dictionary<String,
Object> serviceRegistrationProperties) {
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDepublishMessage.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDepublishMessage.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDepublishMessage.java
Tue Jan 11 11:54:17 2011
@@ -31,19 +31,19 @@
private final ServiceEndPoint m_serviceEndPoint;
public EndpointDepublishMessage(ServiceEndPoint serviceEndPoint) {
- super(serviceEndPoint.getServiceGroup());
+ super(serviceEndPoint.getServiceGroupId());
m_serviceEndPoint = serviceEndPoint;
}
public ServiceEndPoint getServiceEndPoint() {
- m_serviceEndPoint.setClusterId(getFromClusterChannel());
- m_serviceEndPoint.setMemberId(getFromChannelMember());
+ m_serviceEndPoint.setClusterChannelId(getFromClusterChannelId());
+ m_serviceEndPoint.setChannelMemberId(getFromChannelMemberId());
return m_serviceEndPoint;
}
public String getLocalTopic() {
- return
DiscoveryUtilities.getLocalDiscoveryTopic(m_serviceEndPoint.getClusterId(),
- m_serviceEndPoint.getServiceGroup());
+ return
DiscoveryUtilities.getLocalDiscoveryTopic(m_serviceEndPoint.getClusterChannelId(),
+ m_serviceEndPoint.getServiceGroupId());
}
@Override
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDiscoveryMessage.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDiscoveryMessage.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointDiscoveryMessage.java
Tue Jan 11 11:54:17 2011
@@ -27,18 +27,18 @@
private static final long serialVersionUID = 1L;
private static final transient Pattern p = Pattern.compile("\n");
- private final String m_clusterId;
- private final String m_serviceGroup;
+ private final String m_clusterChannelId;
+ private final String m_serviceGroupId;
public EndpointDiscoveryMessage(String clusterId, String serviceGroup) {
super(clusterId, null, serviceGroup);
- m_clusterId = clusterId;
- m_serviceGroup = serviceGroup;
+ m_clusterChannelId = clusterId;
+ m_serviceGroupId = serviceGroup;
}
public String getLocalTopic() {
- return DiscoveryUtilities.getLocalDiscoveryTopic(m_clusterId,
- m_serviceGroup);
+ return DiscoveryUtilities.getLocalDiscoveryTopic(m_clusterChannelId,
+ m_serviceGroupId);
}
@Override
@@ -46,9 +46,9 @@
StringBuilder sb = new
StringBuilder(EndpointDiscoveryMessage.class.getSimpleName() + "{");
Matcher m1 = p.matcher(super.toString());
sb.append("\n\tsuper=" + m1.replaceAll("\n\t"));
- sb.append("\n\tclusterId=" + m_clusterId);
- sb.append("\n\tmemberId=" + getFromChannelMember());
- sb.append("\n\tserviceGroup=" + m_serviceGroup);
+ sb.append("\n\tclusterId=" + m_clusterChannelId);
+ sb.append("\n\tmemberId=" + getFromChannelMemberId());
+ sb.append("\n\tserviceGroup=" + m_serviceGroupId);
sb.append("\n}");
return sb.toString();
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointInvokeMessage.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointInvokeMessage.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointInvokeMessage.java
Tue Jan 11 11:54:17 2011
@@ -33,7 +33,7 @@
private final Map<String, Object> m_payload;
public EndpointInvokeMessage(ServiceEndPoint serviceEndPoint, Map<String,
Object> payload) {
- super(serviceEndPoint.getClusterId(), serviceEndPoint.getMemberId(),
serviceEndPoint.getServiceGroup());
+ super(serviceEndPoint.getClusterChannelId(),
serviceEndPoint.getChannelMemberId(), serviceEndPoint.getServiceGroupId());
m_serviceEndPoint = serviceEndPoint;
m_payload = payload;
}
@@ -47,8 +47,8 @@
}
public String getLocalTopic() {
- return DistributionUtilities.getLocalInvokeTopic(getToClusterChannel(),
- getToServiceGroup());
+ return
DistributionUtilities.getLocalInvokeTopic(getToClusterChannelId(),
+ getToServiceGroupId());
}
@Override
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointPublishMessage.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointPublishMessage.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointPublishMessage.java
Tue Jan 11 11:54:17 2011
@@ -31,19 +31,19 @@
private ServiceEndPoint m_serviceEndPoint;
public EndpointPublishMessage(ServiceEndPoint serviceEndPoint) {
- super(serviceEndPoint.getServiceGroup());
+ super(serviceEndPoint.getServiceGroupId());
m_serviceEndPoint = serviceEndPoint;
}
public ServiceEndPoint getServiceEndPoint() {
- m_serviceEndPoint.setClusterId(getFromClusterChannel());
- m_serviceEndPoint.setMemberId(getFromChannelMember());
+ m_serviceEndPoint.setClusterChannelId(getFromClusterChannelId());
+ m_serviceEndPoint.setChannelMemberId(getFromChannelMemberId());
return m_serviceEndPoint;
}
public String getLocalTopic() {
- return
DiscoveryUtilities.getLocalDiscoveryTopic(m_serviceEndPoint.getClusterId(),
- m_serviceEndPoint.getServiceGroup());
+ return
DiscoveryUtilities.getLocalDiscoveryTopic(m_serviceEndPoint.getClusterChannelId(),
+ m_serviceEndPoint.getServiceGroupId());
}
@Override
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointResponseMessage.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointResponseMessage.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/EndpointResponseMessage.java
Tue Jan 11 11:54:17 2011
@@ -30,10 +30,10 @@
private Map<String, Object> m_payload;
- public EndpointResponseMessage(final String targetClusterId, final String
targetMemberId,
- final String targetServiceGroup,
+ public EndpointResponseMessage(final String toClusterChannelId, final
String toChannelMemberId,
+ final String toServiceGroupId,
final Map<String, Object> payload) {
- super(targetClusterId, targetMemberId, targetServiceGroup);
+ super(toClusterChannelId, toChannelMemberId, toServiceGroupId);
m_payload = payload;
}
@@ -42,8 +42,8 @@
}
public String getLocalTopic() {
- return
DistributionUtilities.getLocalResponseTopic(getToClusterChannel(),
- getToServiceGroup());
+ return
DistributionUtilities.getLocalResponseTopic(getToClusterChannelId(),
+ getToServiceGroupId());
}
@Override
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/LocalServiceInvocationHandler.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/LocalServiceInvocationHandler.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/internal/LocalServiceInvocationHandler.java
Tue Jan 11 11:54:17 2011
@@ -65,7 +65,7 @@
private final ServiceEndPoint m_serviceEndpoint;
private final Set<Method> m_serviceInterfaceMethods = new
HashSet<Method>();
- private final String m_clusterGroupId;
+ private final String m_clusterChannelId;
private final String m_serviceGroupId;
private final String m_clusterChannelInvokeTopic;
@@ -74,10 +74,10 @@
* Constructors
********************************************************/
- public LocalServiceInvocationHandler(String clusterGroupId, String
serviceGroupId,
+ public LocalServiceInvocationHandler(String clusterChannelId, String
serviceGroupId,
ServiceEndPoint serviceEndpoint,
Class<?>[] interfaceClasses) {
- m_clusterGroupId = clusterGroupId;
+ m_clusterChannelId = clusterChannelId;
m_serviceGroupId = serviceGroupId;
m_serviceEndpoint = serviceEndpoint;
for (Class<?> interfaceClass : interfaceClasses) {
@@ -85,7 +85,7 @@
m_serviceInterfaceMethods.add(serviceMethod);
}
}
- m_clusterChannelInvokeTopic =
ClusterUtilities.getClusterChannelSendTopic(m_clusterGroupId);
+ m_clusterChannelInvokeTopic =
ClusterUtilities.getClusterChannelSendTopic(m_clusterChannelId);
}
/********************************************************
@@ -114,7 +114,7 @@
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(EventConstants.EVENT_TOPIC,
- new String[] {
DistributionUtilities.getLocalResponseTopic(m_clusterGroupId, m_serviceGroupId)
});
+ new String[] {
DistributionUtilities.getLocalResponseTopic(m_clusterChannelId,
m_serviceGroupId) });
m_serviceInvocationEventHandlerComponent =
m_dependencyManager.createComponent();
m_serviceInvocationEventHandlerComponent.setInterface(EventHandler.class.getName(),
props);
m_serviceInvocationEventHandlerComponent.setImplementation(new
ServiceInvocationEventHandler());
@@ -144,7 +144,7 @@
Map<String, Object> messagePayload =
getInvocationPayload(invocationIdentifier, method, args);
EndpointInvokeMessage message = new
EndpointInvokeMessage(m_serviceEndpoint, messagePayload);
// FIXME this is awkward
- message.setFromServiceGroup(m_serviceGroupId);
+ message.setFromServiceGroupId(m_serviceGroupId);
Dictionary<String, Object> eventPayload = new Hashtable<String,
Object>();
eventPayload.put(ClusterChannelService.EVENT_MESSAGE_PROPERTY,
message);
@@ -212,6 +212,8 @@
boolean isResponseRecieved = false;
boolean isResponseTimedOut = false;
Object response = null;
+
+ //FIXME use blocking queue
while (!isResponseRecieved && !isResponseTimedOut) {
if (invocationResponseRecieved(invocationId)) {
response = retrieveInvocationResponseObject(invocationId);
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DiscoveryServiceImpl.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DiscoveryServiceImpl.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DiscoveryServiceImpl.java
Tue Jan 11 11:54:17 2011
@@ -70,15 +70,15 @@
private volatile Component m_discoveryEventHandlerComponent;
- private final String m_clusterGroupId;
+ private final String m_clusterChannelId;
private final String m_serviceGroupId;
/********************************************************
* Constructors
********************************************************/
- public DiscoveryServiceImpl(String clusterGroupId, String serviceGroupId) {
- m_clusterGroupId = clusterGroupId;
+ public DiscoveryServiceImpl(String clusterChannelId, String
serviceGroupId) {
+ m_clusterChannelId = clusterChannelId;
m_serviceGroupId = serviceGroupId;
}
@@ -93,8 +93,8 @@
if (discoveryProps == null) {
discoveryProps = new Hashtable<String, Object>();
}
-
discoveryProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterGroupId);
- discoveryProps.put(DiscoveryService.REMOTE_SERVICEGROUPID_PROP,
m_serviceGroupId);
+
discoveryProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterChannelId);
+ discoveryProps.put(DiscoveryService.REMOTE_SERVICEGROUP_PROP,
m_serviceGroupId);
m_component.setServiceProperties(discoveryProps);
ServiceDependency eventAdminServiceDependency =
m_dependencyManager.createServiceDependency();
@@ -107,7 +107,7 @@
clusterMemberDependency
.setService(
ClusterChannelService.class,
- "(" + ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY +
"=" + m_clusterGroupId + ")")
+ "(" + ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY +
"=" + m_clusterChannelId + ")")
.setRequired(true);
clusterMemberDependency.setInstanceBound(true);
m_component.add(clusterMemberDependency);
@@ -122,7 +122,7 @@
remotableServiceEndpointsDependecy
.setService(RemotableServiceEndpoint.class,
"(&(" +
ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY + "="
- + m_clusterGroupId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUPID_PROP + "="
+ + m_clusterChannelId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUP_PROP + "="
+ m_serviceGroupId + "))")
.setCallbacks("remotableServiceEndPointAdded",
"remotableServiceEndPointRemoved")
.setRequired(false);
@@ -130,8 +130,8 @@
Dictionary<String, Object> eventHandlerProps = new Hashtable<String,
Object>();
eventHandlerProps.put(EventConstants.EVENT_TOPIC,
- new String[] {
DiscoveryUtilities.getLocalDiscoveryTopic(m_clusterGroupId, m_serviceGroupId),
-
ClusterUtilities.getClusterChannelReceiveTopic(m_clusterGroupId) });
+ new String[] {
DiscoveryUtilities.getLocalDiscoveryTopic(m_clusterChannelId, m_serviceGroupId),
+
ClusterUtilities.getClusterChannelReceiveTopic(m_clusterChannelId) });
m_discoveryEventHandlerComponent =
m_dependencyManager.createComponent();
m_discoveryEventHandlerComponent.setInterface(EventHandler.class.getName(),
eventHandlerProps);
m_discoveryEventHandlerComponent.setImplementation(new
DiscoveryEventHandler());
@@ -201,18 +201,18 @@
private Event createDiscoveryEvent(ChannelMemberAddedEvent
memberAddedEvent) {
EndpointDiscoveryMessage endpointDiscoveryMessage =
- new EndpointDiscoveryMessage(m_clusterGroupId, m_serviceGroupId);
+ new EndpointDiscoveryMessage(m_clusterChannelId, m_serviceGroupId);
if (memberAddedEvent != null) {
- endpointDiscoveryMessage.setToClusterChannel(m_clusterGroupId);
-
endpointDiscoveryMessage.setToChannelMember(memberAddedEvent.getMemberName());
+ endpointDiscoveryMessage.setToClusterChannelId(m_clusterChannelId);
+
endpointDiscoveryMessage.setToChannelMemberId(memberAddedEvent.getMemberName());
}
Dictionary<String, Object> eventProps = new Hashtable<String,
Object>();
eventProps.put(ClusterChannelService.EVENT_MESSAGE_PROPERTY,
- new EndpointDiscoveryMessage(m_clusterGroupId, m_serviceGroupId));
+ new EndpointDiscoveryMessage(m_clusterChannelId,
m_serviceGroupId));
Event discoveryEvent =
- new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterGroupId),
+ new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterChannelId),
eventProps);
return discoveryEvent;
}
@@ -223,13 +223,13 @@
EndpointPublishMessage endpointPublishMessage = new
EndpointPublishMessage(serviceEndPoint);
if (endpointDiscoveryMessage != null) {
-
endpointPublishMessage.setToClusterChannel(endpointDiscoveryMessage.getFromClusterChannel());
-
endpointPublishMessage.setToChannelMember(endpointDiscoveryMessage.getFromChannelMember());
+
endpointPublishMessage.setToClusterChannelId(endpointDiscoveryMessage.getFromClusterChannelId());
+
endpointPublishMessage.setToChannelMemberId(endpointDiscoveryMessage.getFromChannelMemberId());
}
props.put(ClusterChannelService.EVENT_MESSAGE_PROPERTY,
endpointPublishMessage);
Event event =
- new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterGroupId),
+ new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterChannelId),
props);
return event;
}
@@ -238,7 +238,7 @@
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(ClusterChannelService.EVENT_MESSAGE_PROPERTY, new
EndpointDepublishMessage(serviceEndPoint));
Event event =
- new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterGroupId),
+ new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterChannelId),
props);
return event;
}
@@ -297,11 +297,11 @@
}
Dictionary<String, Object> distributionProps = new
Hashtable<String, Object>();
distributionProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
- m_clusterGroupId);
- distributionProps.put(DiscoveryService.REMOTE_SERVICEGROUPID_PROP,
+ m_clusterChannelId);
+ distributionProps.put(DiscoveryService.REMOTE_SERVICEGROUP_PROP,
m_serviceGroupId);
-
distributionProps.put(ClusterChannelService.SERVICE_CLUSTERMEMBER_PROPERTY,
- serviceEndPoint.getMemberId());
+
distributionProps.put(ClusterChannelService.SERVICE_CHANNELMEMBER_PROPERTY,
+ serviceEndPoint.getChannelMemberId());
serviceComponent =
m_dependencyManager.createComponent()
.setInterface(RemoteServiceEndPoint.class.getName(),
distributionProps)
@@ -309,7 +309,7 @@
serviceComponent.add(m_dependencyManager.createServiceDependency().setService(
DiscoveryService.class,
"(&(" + ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY
+ "="
- + m_clusterGroupId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUPID_PROP + "="
+ + m_clusterChannelId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUP_PROP + "="
+ m_serviceGroupId + "))")
.setRequired(true));
m_remoteEndPointComponents.put(serviceEndPoint, serviceComponent);
@@ -335,7 +335,7 @@
m_remoteEndPointComponentsLock.writeLock().lock();
try {
for (ServiceEndPoint serviceEndPoint :
m_remoteEndPointComponents.keySet()) {
- if
(serviceEndPoint.getMemberId().equals(memberRemovedEvent.getMemberName())) {
+ if
(serviceEndPoint.getChannelMemberId().equals(memberRemovedEvent.getMemberName()))
{
if (removeServiceEndpointList == null)
removeServiceEndpointList = new
LinkedList<ServiceEndPoint>();
removeServiceEndpointList.add(serviceEndPoint);
@@ -389,7 +389,7 @@
return;
}
throw new IllegalStateException("Unknown message type " +
message.getClass().getName() + "on channel "
- + DiscoveryUtilities.getLocalDiscoveryTopic(m_clusterGroupId,
m_serviceGroupId));
+ +
DiscoveryUtilities.getLocalDiscoveryTopic(m_clusterChannelId,
m_serviceGroupId));
}
}
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DistributionServiceImpl.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DistributionServiceImpl.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/remote/service/DistributionServiceImpl.java
Tue Jan 11 11:54:17 2011
@@ -75,15 +75,15 @@
private volatile Component m_distributionEventHandlerComponent;
- private final String m_clusterGroupId;
+ private final String m_clusterChannelId;
private final String m_serviceGroupId;
/********************************************************
* Constructor methods
********************************************************/
- public DistributionServiceImpl(String clusterGroupId, String
serviceGroupId) {
- m_clusterGroupId = clusterGroupId;
+ public DistributionServiceImpl(String clusterChannelId, String
serviceGroupId) {
+ m_clusterChannelId = clusterChannelId;
m_serviceGroupId = serviceGroupId;
}
@@ -98,8 +98,8 @@
if (distributionProps == null) {
distributionProps = new Hashtable<String, Object>();
}
-
distributionProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterGroupId);
- distributionProps.put(DiscoveryService.REMOTE_SERVICEGROUPID_PROP,
m_serviceGroupId);
+
distributionProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterChannelId);
+ distributionProps.put(DiscoveryService.REMOTE_SERVICEGROUP_PROP,
m_serviceGroupId);
distributionProps.put(DistributionService.DISTRIBUTION_CONFIGS_SUPPORTED_PROP,
DistributionService.DISTRIBUTION_CONFIGS_SUPPORTED);
distributionProps.put(DistributionService.DISTRIBUTION_INTENTS_SUPPORTED_PROP,
@@ -116,7 +116,7 @@
clusterMemberDependency
.setService(
ClusterChannelService.class,
- "(" + ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY +
"=" + m_clusterGroupId + ")")
+ "(" + ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY +
"=" + m_clusterChannelId + ")")
.setRequired(true);
clusterMemberDependency.setInstanceBound(true);
m_component.add(clusterMemberDependency);
@@ -141,7 +141,7 @@
remoteServiceEndpointsDependecy
.setService(RemoteServiceEndPoint.class,
"(&(" +
ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY + "="
- + m_clusterGroupId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUPID_PROP + "="
+ + m_clusterChannelId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUP_PROP + "="
+ m_serviceGroupId + "))")
.setCallbacks("remoteServiceEndPointAdded",
"remoteServiceEndPointRemoved")
.setRequired(false);
@@ -149,7 +149,7 @@
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(EventConstants.EVENT_TOPIC,
- new String[] {
DistributionUtilities.getLocalInvokeTopic(m_clusterGroupId, m_serviceGroupId)
});
+ new String[] {
DistributionUtilities.getLocalInvokeTopic(m_clusterChannelId, m_serviceGroupId)
});
m_distributionEventHandlerComponent =
m_dependencyManager.createComponent();
m_distributionEventHandlerComponent.setInterface(EventHandler.class.getName(),
props);
m_distributionEventHandlerComponent.setImplementation(new
DistributionEventHandler());
@@ -313,8 +313,8 @@
private Component createRemotableEndPointComponent(final ServiceEndPoint
serviceEndPoint) {
Dictionary<String, Object> distributionProps = new Hashtable<String,
Object>();
-
distributionProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterGroupId);
- distributionProps.put(DiscoveryService.REMOTE_SERVICEGROUPID_PROP,
m_serviceGroupId);
+
distributionProps.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterChannelId);
+ distributionProps.put(DiscoveryService.REMOTE_SERVICEGROUP_PROP,
m_serviceGroupId);
Component serviceComponent =
m_dependencyManager.createComponent()
.setInterface(RemotableServiceEndpoint.class.getName(),
distributionProps)
@@ -325,7 +325,7 @@
.setService(
DistributionService.class,
"(&(" +
ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY + "="
- + m_clusterGroupId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUPID_PROP + "="
+ + m_clusterChannelId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUP_PROP + "="
+ m_serviceGroupId + "))")
.setRequired(true);
serviceComponent.add(serviceDependency);
@@ -346,7 +346,7 @@
}
}
LocalServiceInvocationHandler localServiceInvocationHandler =
- new LocalServiceInvocationHandler(m_clusterGroupId,
m_serviceGroupId, serviceEndpoint,
+ new LocalServiceInvocationHandler(m_clusterChannelId,
m_serviceGroupId, serviceEndpoint,
interfaceClasses);
Object serviceObject =
Proxy.newProxyInstance(interfaceClasses[0].getClassLoader(),
interfaceClasses, localServiceInvocationHandler);
@@ -361,8 +361,8 @@
props.remove(DistributionService.SERVICE_EXPORTED_INTERFACES_PROP);
props.remove(DistributionService.SERVICE_EXPORTED_INTENTS_PROP);
props.remove(DistributionService.SERVICE_EXPORTED_INTENTS_EXTRA_PROP);
- props.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterGroupId);
- props.put(DiscoveryService.REMOTE_SERVICEGROUPID_PROP,
m_serviceGroupId);
+ props.put(ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY,
m_clusterChannelId);
+ props.put(DiscoveryService.REMOTE_SERVICEGROUP_PROP, m_serviceGroupId);
props.put(DistributionService.SERVICE_IMPORTED_PROP, "true");
props.put(DistributionService.SERVICE_INTENTS_PROP, importedIntents);
props.put(DistributionService.SERVICE_IMPORTED_CONFIGS_PROP,
@@ -376,7 +376,7 @@
.setService(
DistributionService.class,
"(&(" +
ClusterChannelService.SERVICE_CLUSTERCHANNEL_PROPERTY + "="
- + m_clusterGroupId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUPID_PROP + "="
+ + m_clusterChannelId + ")(" +
DiscoveryService.REMOTE_SERVICEGROUP_PROP + "="
+ m_serviceGroupId + "))")
.setRequired(true);
serviceComponent.add(serviceDependency);
@@ -384,7 +384,7 @@
}
private boolean isServiceEndpointForServiceGroup(ServiceEndPoint
serviceEndpoint) {
- Object serviceGroupProperty =
serviceEndpoint.getProperties().get(DiscoveryService.REMOTE_SERVICEGROUPID_PROP);
+ Object serviceGroupProperty =
serviceEndpoint.getProperties().get(DiscoveryService.REMOTE_SERVICEGROUP_PROP);
if (serviceGroupProperty == null) {
return true;
}
@@ -429,8 +429,8 @@
private ServiceEndPoint serviceEndPointFromServiceReference(final
ServiceReference serviceReference) {
ServiceEndPoint serviceEndPoint = new ServiceEndPoint();
- serviceEndPoint.setClusterId(m_clusterGroupId);
- serviceEndPoint.setServiceGroup(m_serviceGroupId);
+ serviceEndPoint.setClusterChannelId(m_clusterChannelId);
+ serviceEndPoint.setServiceGroupId(m_serviceGroupId);
serviceEndPoint.setObjectClass((String[]) serviceReference
.getProperty(DistributionService.SERVICE_EXPORTED_INTERFACES_PROP));
serviceEndPoint.setOriginalServiceId((Long)
serviceReference.getProperty(Constants.SERVICE_ID));
@@ -446,7 +446,7 @@
ServiceEndPoint serviceEndPoint =
endpointInvokeMessage.getServiceEndPoint();
// FIXME address this
- serviceEndPoint.setMemberId(null);
+ serviceEndPoint.setChannelMemberId(null);
Object serviceResponse = null;
m_localServiceEndPointServiceReferenceComponentsLock.readLock().lock();
@@ -455,7 +455,7 @@
m_localServiceEndPointServiceReferenceComponents.get(serviceEndPoint);
if (serviceReferenceComponentTuple == null) {
// FIXME check is not ok
- if (serviceEndPoint.getMemberId().equals(m_clusterGroupId)) {
+ if
(serviceEndPoint.getChannelMemberId().equals(m_clusterChannelId)) {
m_logService
.log(LogService.LOG_WARNING,
"Dropping EndpointInvokeMessage for unknown
ServiceEndPoint: " + serviceEndPoint.toString());
@@ -520,9 +520,9 @@
private Event createEndpointResponseEvent(EndpointInvokeMessage
endpointInvokeMessage, Object serviceResponse) {
Map<String, Object> payload = endpointInvokeMessage.getPayload();
String invocationId = (String) payload.get(MESSAGE_INVOCATION_ID_KEY);
- String originClusterId = (String)
endpointInvokeMessage.getFromClusterChannel();
- String originMemberId = (String)
endpointInvokeMessage.getFromChannelMember();
- String originServiceGroup = (String)
endpointInvokeMessage.getFromServiceGroup();
+ String originClusterId = (String)
endpointInvokeMessage.getFromClusterChannelId();
+ String originMemberId = (String)
endpointInvokeMessage.getFromChannelMemberId();
+ String originServiceGroup = (String)
endpointInvokeMessage.getFromServiceGroupId();
Map<String, Object> responsePayload = new HashMap<String, Object>();
responsePayload.put(MESSAGE_INVOCATION_ID_KEY, invocationId);
@@ -533,7 +533,7 @@
originMemberId, originServiceGroup, responsePayload));
Event responseEvent =
- new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterGroupId),
+ new
Event(ClusterUtilities.getClusterChannelSendTopic(m_clusterChannelId),
eventPayload);
return responseEvent;
}
Modified:
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java
(original)
+++
sandbox/bdekruijff/fabric/src/main/java/org/amdatu/core/fabric/service/FabricManagerServiceImpl.java
Tue Jan 11 11:54:17 2011
@@ -125,10 +125,10 @@
* FabricManagerService methods
********************************************************/
- public boolean createClusterChannel(String clusterChannelName,
Dictionary<String, Object> clusterChannelProperties) {
- if (!ClusterUtilities.isValidChannelName(clusterChannelName)) {
+ public boolean createClusterChannel(String clusterChannelId,
Dictionary<String, Object> clusterChannelProperties) {
+ if (!ClusterUtilities.isValidClusterChannelId(clusterChannelId)) {
m_logService.log(LogService.LOG_ERROR, "Failed to create
clusterchannel. Invalid clusterChannelName: "
- + clusterChannelName);
+ + clusterChannelId);
return false;
}
@@ -136,7 +136,7 @@
m_dependencyManager
.createComponent()
.setInterface(ClusterChannelService.class.getName(),
clusterChannelProperties)
- .setFactory(new
ClusterMemberServiceFactory(clusterChannelName, clusterChannelProperties),
+ .setFactory(new ClusterMemberServiceFactory(clusterChannelId,
clusterChannelProperties),
"getInstance")
.add(
m_dependencyManager.createServiceDependency()
@@ -145,12 +145,12 @@
m_clusterMemberComponentsLock.writeLock().lock();
try {
- if (m_clusterMemberComponents.containsKey(clusterChannelName)) {
+ if (m_clusterMemberComponents.containsKey(clusterChannelId)) {
m_dependencyManager.remove(m_clusterMemberComponents
- .remove(clusterChannelName));
+ .remove(clusterChannelId));
}
- m_clusterMemberComponents.put(clusterChannelName,
clusterMemberComponent);
+ m_clusterMemberComponents.put(clusterChannelId,
clusterMemberComponent);
m_dependencyManager.add(clusterMemberComponent);
return true;
}
@@ -159,17 +159,17 @@
}
}
- public boolean removeClusterChannel(String clusterGroupId) {
- if (!ClusterUtilities.isValidChannelName(clusterGroupId)) {
+ public boolean removeClusterChannel(String clusterChannelId) {
+ if (!ClusterUtilities.isValidClusterChannelId(clusterChannelId)) {
m_logService.log(LogService.LOG_ERROR, "Failed to remove
clusterchannel. Invalid clusterChannelName: "
- + clusterGroupId);
+ + clusterChannelId);
return false;
}
m_clusterMemberComponentsLock.writeLock().lock();
try {
- if (m_clusterMemberComponents.containsKey(clusterGroupId)) {
-
m_dependencyManager.remove(m_clusterMemberComponents.remove(clusterGroupId));
+ if (m_clusterMemberComponents.containsKey(clusterChannelId)) {
+
m_dependencyManager.remove(m_clusterMemberComponents.remove(clusterChannelId));
return true;
}
return false;
@@ -179,16 +179,16 @@
}
}
- public boolean createDiscovery(String clusterChannelName, String
serviceGroupName) {
- if (!ClusterUtilities.isValidChannelName(clusterChannelName)) {
+ public boolean createDiscovery(String clusterChannelId, String
serviceGroupId) {
+ if (!ClusterUtilities.isValidClusterChannelId(clusterChannelId)) {
m_logService
.log(LogService.LOG_ERROR, "Failed to create discovery.
Invalid clusterChannelName: "
- + clusterChannelName);
+ + clusterChannelId);
return false;
}
- if (!ClusterUtilities.isValidChannelName(serviceGroupName)) {
+ if (!ClusterUtilities.isValidClusterChannelId(serviceGroupId)) {
m_logService.log(LogService.LOG_ERROR, "Failed to create
discovery. Invalid serviceGroupName: "
- + serviceGroupName);
+ + serviceGroupId);
return false;
}
@@ -197,7 +197,7 @@
.createComponent()
.setInterface(DiscoveryService.class.getName(),
null)
- .setFactory(new DiscoveryServiceFactory(clusterChannelName,
serviceGroupName), "getInstance")
+ .setFactory(new DiscoveryServiceFactory(clusterChannelId,
serviceGroupId), "getInstance")
.add(
m_dependencyManager.createServiceDependency()
.setService(FabricManagerService.class)
@@ -205,11 +205,11 @@
m_discoveryComponentsLock.writeLock().lock();
try {
- if (m_discoveryComponents.containsKey(getKey(clusterChannelName,
serviceGroupName))) {
-
m_dependencyManager.remove(m_discoveryComponents.remove(getKey(clusterChannelName,
- serviceGroupName)));
+ if (m_discoveryComponents.containsKey(getKey(clusterChannelId,
serviceGroupId))) {
+
m_dependencyManager.remove(m_discoveryComponents.remove(getKey(clusterChannelId,
+ serviceGroupId)));
}
- m_discoveryComponents.put(getKey(clusterChannelName,
serviceGroupName), discoveryComponent);
+ m_discoveryComponents.put(getKey(clusterChannelId,
serviceGroupId), discoveryComponent);
m_dependencyManager.add(discoveryComponent);
return true;
}
@@ -218,23 +218,23 @@
}
}
- public boolean removeDiscovery(String clusterChannelName, String
serviceGroupName) {
- if (!ClusterUtilities.isValidChannelName(clusterChannelName)) {
+ public boolean removeDiscovery(String clusterChannelId, String
serviceGroupId) {
+ if (!ClusterUtilities.isValidClusterChannelId(clusterChannelId)) {
m_logService
.log(LogService.LOG_ERROR, "Failed to remove discovery.
Invalid clusterChannelName: "
- + clusterChannelName);
+ + clusterChannelId);
return false;
}
- if (!ClusterUtilities.isValidChannelName(serviceGroupName)) {
+ if (!ClusterUtilities.isValidClusterChannelId(serviceGroupId)) {
m_logService.log(LogService.LOG_ERROR, "Failed to remove
discovery. Invalid serviceGroupName: "
- + serviceGroupName);
+ + serviceGroupId);
return false;
}
m_discoveryComponentsLock.writeLock().lock();
try {
- if (m_discoveryComponents.containsKey(getKey(clusterChannelName,
serviceGroupName))) {
-
m_dependencyManager.remove(m_discoveryComponents.remove(getKey(clusterChannelName,
- serviceGroupName)));
+ if (m_discoveryComponents.containsKey(getKey(clusterChannelId,
serviceGroupId))) {
+
m_dependencyManager.remove(m_discoveryComponents.remove(getKey(clusterChannelId,
+ serviceGroupId)));
return true;
}
return false;
@@ -244,22 +244,22 @@
}
}
- public boolean createDistribution(String clusterChannelName, String
serviceGroupName) {
- if (!ClusterUtilities.isValidChannelName(clusterChannelName)) {
+ public boolean createDistribution(String clusterChannelId, String
serviceGroupId) {
+ if (!ClusterUtilities.isValidClusterChannelId(clusterChannelId)) {
m_logService
- .log(LogService.LOG_ERROR, "Failed to create distribution.
Invalid clustername: " + clusterChannelName);
+ .log(LogService.LOG_ERROR, "Failed to create distribution.
Invalid clustername: " + clusterChannelId);
return false;
}
- if (!ClusterUtilities.isValidChannelName(serviceGroupName)) {
+ if (!ClusterUtilities.isValidClusterChannelId(serviceGroupId)) {
m_logService.log(LogService.LOG_ERROR, "Failed to remove
distribution. Invalid servicegroupname: "
- + serviceGroupName);
+ + serviceGroupId);
return false;
}
Component distributionComponent =
m_dependencyManager
.createComponent()
.setInterface(DistributionService.class.getName(), null)
- .setFactory(new DistributionServiceFactory(clusterChannelName,
serviceGroupName), "getInstance")
+ .setFactory(new DistributionServiceFactory(clusterChannelId,
serviceGroupId), "getInstance")
.add(
m_dependencyManager.createServiceDependency()
.setService(FabricManagerService.class)
@@ -267,11 +267,11 @@
m_distributionComponentsLock.writeLock().lock();
try {
- if
(m_distributionComponents.containsKey(getKey(clusterChannelName,
serviceGroupName))) {
-
m_dependencyManager.remove(m_distributionComponents.remove(getKey(clusterChannelName,
- serviceGroupName)));
+ if (m_distributionComponents.containsKey(getKey(clusterChannelId,
serviceGroupId))) {
+
m_dependencyManager.remove(m_distributionComponents.remove(getKey(clusterChannelId,
+ serviceGroupId)));
}
- m_distributionComponents.put(getKey(clusterChannelName,
serviceGroupName),
+ m_distributionComponents.put(getKey(clusterChannelId,
serviceGroupId),
distributionComponent);
m_dependencyManager.add(distributionComponent);
return true;
@@ -281,23 +281,23 @@
}
}
- public boolean removeDistribution(String clusterChannelName, String
serviceGroupName) {
- if (!ClusterUtilities.isValidChannelName(clusterChannelName)) {
+ public boolean removeDistribution(String clusterChannelId, String
serviceGroupId) {
+ if (!ClusterUtilities.isValidClusterChannelId(clusterChannelId)) {
m_logService
.log(LogService.LOG_ERROR, "Failed to create distribution.
Invalid clusterChannelname: "
- + clusterChannelName);
+ + clusterChannelId);
return false;
}
- if (!ClusterUtilities.isValidChannelName(serviceGroupName)) {
+ if (!ClusterUtilities.isValidClusterChannelId(serviceGroupId)) {
m_logService.log(LogService.LOG_ERROR, "Failed to remove
distribution. Invalid serviceGroupName: "
- + serviceGroupName);
+ + serviceGroupId);
return false;
}
m_distributionComponentsLock.writeLock().lock();
try {
- if
(m_distributionComponents.containsKey(getKey(clusterChannelName,
serviceGroupName))) {
-
m_dependencyManager.remove(m_distributionComponents.remove(getKey(clusterChannelName,
- serviceGroupName)));
+ if (m_distributionComponents.containsKey(getKey(clusterChannelId,
serviceGroupId))) {
+
m_dependencyManager.remove(m_distributionComponents.remove(getKey(clusterChannelId,
+ serviceGroupId)));
return true;
}
return false;
@@ -311,8 +311,8 @@
* Private methods
********************************************************/
- private String getKey(String clusterChannelName, String serviceGroupName) {
- return clusterChannelName + "#" + serviceGroupName;
+ private String getKey(String clusterChannelId, String serviceGroupId) {
+ return clusterChannelId + "#" + serviceGroupId;
}
/********************************************************
@@ -321,47 +321,47 @@
static class ClusterMemberServiceFactory {
- private final String m_clusterChannelName;
+ private final String m_clusterChannelId;
private final Dictionary<String, Object> m_clusterChannelProperties;
- public ClusterMemberServiceFactory(String clusterChannelName,
+ public ClusterMemberServiceFactory(String clusterChannelId,
Dictionary<String, Object> clusterChannelProperties) {
- m_clusterChannelName = clusterChannelName;
+ m_clusterChannelId = clusterChannelId;
m_clusterChannelProperties = clusterChannelProperties;
}
public ClusterChannelService getInstance() {
- return new TribesClusterMemberServiceImpl(m_clusterChannelName,
m_clusterChannelProperties);
+ return new TribesClusterMemberServiceImpl(m_clusterChannelId,
m_clusterChannelProperties);
}
}
static class DiscoveryServiceFactory {
- private final String m_clusterChannelName;
- private final String m_serviceGroupName;
+ private final String m_clusterChannelId;
+ private final String m_serviceGroupId;
- public DiscoveryServiceFactory(String clusterChannelName, String
serviceGroupName) {
- m_clusterChannelName = clusterChannelName;
- m_serviceGroupName = serviceGroupName;
+ public DiscoveryServiceFactory(String clusterChannelId, String
serviceGroupId) {
+ m_clusterChannelId = clusterChannelId;
+ m_serviceGroupId = serviceGroupId;
}
public DiscoveryService getInstance() {
- return new DiscoveryServiceImpl(m_clusterChannelName,
m_serviceGroupName);
+ return new DiscoveryServiceImpl(m_clusterChannelId,
m_serviceGroupId);
}
}
static class DistributionServiceFactory {
- private final String m_clusterChannelName;
- private final String m_serviceGroupName;
+ private final String m_clusterChannelId;
+ private final String m_serviceGroupId;
- public DistributionServiceFactory(String clusterChannelName, String
serviceGroupName) {
- m_clusterChannelName = clusterChannelName;
- m_serviceGroupName = serviceGroupName;
+ public DistributionServiceFactory(String clusterChannelId, String
serviceGroupId) {
+ m_clusterChannelId = clusterChannelId;
+ m_serviceGroupId = serviceGroupId;
}
public DistributionService getInstance() {
- return new DistributionServiceImpl(m_clusterChannelName,
m_serviceGroupName);
+ return new DistributionServiceImpl(m_clusterChannelId,
m_serviceGroupId);
}
}
}
Modified:
sandbox/bdekruijff/fabric/src/test/java/org/amdatu/core/fabric/remote/service/ChannelMemberUtilitiesTest.java
==============================================================================
---
sandbox/bdekruijff/fabric/src/test/java/org/amdatu/core/fabric/remote/service/ChannelMemberUtilitiesTest.java
(original)
+++
sandbox/bdekruijff/fabric/src/test/java/org/amdatu/core/fabric/remote/service/ChannelMemberUtilitiesTest.java
Tue Jan 11 11:54:17 2011
@@ -24,20 +24,20 @@
@Test
public void testIsValidChannelName() {
- Assert.assertTrue(ClusterUtilities.isValidChannelName("a"));
- Assert.assertTrue(ClusterUtilities.isValidChannelName("hello"));
- Assert.assertTrue(ClusterUtilities.isValidChannelName("hello_world"));
- Assert.assertTrue(ClusterUtilities.isValidChannelName("hello-world"));
- Assert.assertTrue(ClusterUtilities.isValidChannelName("hello_123"));
- Assert.assertTrue(ClusterUtilities.isValidChannelName("123hello_"));
+ Assert.assertTrue(ClusterUtilities.isValidClusterChannelId("a"));
+ Assert.assertTrue(ClusterUtilities.isValidClusterChannelId("hello"));
+
Assert.assertTrue(ClusterUtilities.isValidClusterChannelId("hello_world"));
+
Assert.assertTrue(ClusterUtilities.isValidClusterChannelId("hello-world"));
+
Assert.assertTrue(ClusterUtilities.isValidClusterChannelId("hello_123"));
+
Assert.assertTrue(ClusterUtilities.isValidClusterChannelId("123hello_"));
- Assert.assertFalse(ClusterUtilities.isValidChannelName(null));
- Assert.assertFalse(ClusterUtilities.isValidChannelName(""));
- Assert.assertFalse(ClusterUtilities.isValidChannelName(" "));
- Assert.assertFalse(ClusterUtilities.isValidChannelName(" hello"));
- Assert.assertFalse(ClusterUtilities.isValidChannelName("hello "));
- Assert.assertFalse(ClusterUtilities.isValidChannelName("hello.world"));
- Assert.assertFalse(ClusterUtilities.isValidChannelName("hello/world"));
+ Assert.assertFalse(ClusterUtilities.isValidClusterChannelId(null));
+ Assert.assertFalse(ClusterUtilities.isValidClusterChannelId(""));
+ Assert.assertFalse(ClusterUtilities.isValidClusterChannelId(" "));
+ Assert.assertFalse(ClusterUtilities.isValidClusterChannelId(" hello"));
+ Assert.assertFalse(ClusterUtilities.isValidClusterChannelId("hello "));
+
Assert.assertFalse(ClusterUtilities.isValidClusterChannelId("hello.world"));
+
Assert.assertFalse(ClusterUtilities.isValidClusterChannelId("hello/world"));
}
}