diff --git a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/core/EnterpriseCoreEditionModule.java b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/core/EnterpriseCoreEditionModule.java
index 3535434da77f..a55d778f9ef6 100644
--- a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/core/EnterpriseCoreEditionModule.java
+++ b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/core/EnterpriseCoreEditionModule.java
@@ -38,6 +38,7 @@
import org.neo4j.coreedge.core.consensus.ConsensusModule;
import org.neo4j.coreedge.core.consensus.RaftMachine;
import org.neo4j.coreedge.core.consensus.RaftMessages;
+import org.neo4j.coreedge.discovery.procedures.CoreRoleProcedure;
import org.neo4j.coreedge.messaging.CoreReplicatedContentMarshal;
import org.neo4j.coreedge.messaging.LoggingOutbound;
import org.neo4j.coreedge.messaging.Outbound;
@@ -53,7 +54,6 @@
import org.neo4j.coreedge.discovery.procedures.AcquireEndpointsProcedure;
import org.neo4j.coreedge.discovery.procedures.ClusterOverviewProcedure;
import org.neo4j.coreedge.discovery.procedures.DiscoverMembersProcedure;
-import org.neo4j.coreedge.discovery.procedures.RoleProcedure;
import org.neo4j.coreedge.logging.BetterMessageLogger;
import org.neo4j.coreedge.logging.MessageLogger;
import org.neo4j.coreedge.logging.NullMessageLogger;
@@ -91,8 +91,6 @@
import org.neo4j.logging.LogProvider;
import org.neo4j.udc.UsageData;
-import static org.neo4j.coreedge.discovery.procedures.RoleProcedure.CoreOrEdge.CORE;
-
/**
* This implementation of {@link org.neo4j.kernel.impl.factory.EditionModule} creates the implementations of services
* that are specific to the Enterprise Core edition that provides a core cluster.
@@ -120,7 +118,7 @@ public void registerProcedures( Procedures procedures )
procedures.register( new DiscoverMembersProcedure( discoveryService, logProvider ) );
procedures.register( new AcquireEndpointsProcedure( discoveryService, consensusModule.raftMachine(), logProvider ) );
procedures.register( new ClusterOverviewProcedure( discoveryService, consensusModule.raftMachine(), logProvider ) );
- procedures.register( new RoleProcedure( CORE ) );
+ procedures.register( new CoreRoleProcedure( consensusModule.raftMachine()) );
}
catch ( ProcedureException e )
{
diff --git a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/CoreRoleProcedure.java b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/CoreRoleProcedure.java
new file mode 100644
index 000000000000..0d9537ee3795
--- /dev/null
+++ b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/CoreRoleProcedure.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2016 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.coreedge.discovery.procedures;
+
+import org.neo4j.coreedge.core.consensus.RaftMachine;
+
+public class CoreRoleProcedure extends RoleProcedure
+{
+ private final RaftMachine raft;
+
+ public CoreRoleProcedure( RaftMachine raft )
+ {
+ super();
+ this.raft = raft;
+ }
+
+ @Override
+ Role role()
+ {
+ return raft.isLeader() ? Role.LEADER : Role.FOLLOWER;
+ }
+}
diff --git a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/EdgeRoleProcedure.java b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/EdgeRoleProcedure.java
new file mode 100644
index 000000000000..1acd2f6b57bb
--- /dev/null
+++ b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/EdgeRoleProcedure.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2002-2016 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.coreedge.discovery.procedures;
+
+public class EdgeRoleProcedure extends RoleProcedure
+{
+ public EdgeRoleProcedure()
+ {
+ super();
+ }
+
+ @Override
+ Role role()
+ {
+ return RoleProcedure.Role.READ_REPLICA;
+ }
+}
diff --git a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/RoleProcedure.java b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/RoleProcedure.java
index f3be629f52d8..a3ca4bd588b2 100644
--- a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/RoleProcedure.java
+++ b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/discovery/procedures/RoleProcedure.java
@@ -27,31 +27,30 @@
import static org.neo4j.kernel.api.proc.ProcedureSignature.procedureSignature;
-public class RoleProcedure extends CallableProcedure.BasicProcedure
+abstract class RoleProcedure extends CallableProcedure.BasicProcedure
{
- public static final String NAME = "role";
- private final CoreOrEdge role;
+ private static final String PROCEDURE_NAME = "role";
+ private static final String[] PROCEDURE_NAMESPACE = {"dbms", "cluster"};
+ private static final String OUTPUT_NAME = "role";
- public RoleProcedure( CoreOrEdge role )
+ RoleProcedure()
{
- super( procedureSignature( new ProcedureSignature.ProcedureName( new String[]{"dbms", "cluster"}, NAME ) )
- .out( "role", Neo4jTypes.NTString ).build() );
- this.role = role;
+ super( procedureSignature( new ProcedureSignature.ProcedureName( PROCEDURE_NAMESPACE, PROCEDURE_NAME ) )
+ .out( OUTPUT_NAME, Neo4jTypes.NTString ).build() );
}
@Override
- public RawIterator