/
INodeService.java
195 lines (135 loc) · 6.49 KB
/
INodeService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jumpmind.symmetric.service;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jumpmind.db.sql.ISqlTransaction;
import org.jumpmind.symmetric.config.INodeIdCreator;
import org.jumpmind.symmetric.ext.IOfflineServerListener;
import org.jumpmind.symmetric.io.IOfflineClientListener;
import org.jumpmind.symmetric.model.NetworkedNode;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.NodeGroupLinkAction;
import org.jumpmind.symmetric.model.NodeHost;
import org.jumpmind.symmetric.model.NodeSecurity;
import org.jumpmind.symmetric.model.NodeStatus;
import org.jumpmind.symmetric.security.INodePasswordFilter;
/**
* This service provides an API to access {@link Node}s and Node related
* information.
*/
public interface INodeService {
public Node findNode(String nodeId);
public List<NodeHost> findNodeHosts(String nodeId);
public boolean isRegistrationServer();
public Node findNodeByExternalId(String nodeGroupId, String externalId);
/**
* Find a list of {@link Node}s that were create at the passed in node or
* were created at a node that was created by the passed in node
* (recursively).
*/
public Set<Node> findNodesThatOriginatedFromNodeId(String originalNodeId);
public Set<Node> findNodesThatOriginatedFromNodeId(String originalNodeId, boolean recursive);
public Collection<Node> findEnabledNodesFromNodeGroup(String nodeGroupId);
public Collection<Node> findNodesWithOpenRegistration();
public Map<String, NodeSecurity> findAllNodeSecurity(boolean useCache);
public List<NodeSecurity> findNodeSecurityWithLoadEnabled();
public List<String> findAllExternalIds();
public NodeSecurity findNodeSecurity(String nodeId);
public NodeSecurity findNodeSecurity(String nodeId, boolean createIfNotFound);
public void deleteNodeSecurity(String nodeId);
public void deleteNode(String nodeId, boolean syncChange);
public String findSymmetricVersion();
public String findIdentityNodeId();
public void ignoreNodeChannelForExternalId(boolean ignore, String channelId,
String nodeGroupId, String externalId);
public boolean isNodeAuthorized(String nodeId, String password);
public void flushNodeAuthorizedCache();
public boolean isRegistrationEnabled(String nodeId);
public Node findIdentity();
public Node findIdentity(boolean useCache);
public Node findIdentity(boolean useCache, boolean logSqlError);
public Node getCachedIdentity();
public boolean deleteIdentity();
public List<Node> findAllNodes();
public List<Node> findNodesToPull();
public List<Node> findNodesToPushTo();
public List<Node> findSourceNodesFor(NodeGroupLinkAction eventAction);
public List<Node> findTargetNodesFor(NodeGroupLinkAction eventAction);
public boolean isExternalIdRegistered(String nodeGroupId, String externalId);
public void save(Node node);
public void updateNodeHost(NodeHost nodeHost);
public void updateNodeHostForCurrentNode();
public void insertNodeIdentity(String nodeId);
public void insertNodeGroup(String groupId, String description);
public boolean updateNodeSecurity(NodeSecurity security);
public boolean updateNodeSecurity(ISqlTransaction transaction, NodeSecurity security);
public boolean setInitialLoadEnabled(String nodeId, boolean initialLoadEnabled, boolean syncChange, long loadId, String createBy);
public boolean setInitialLoadEnabled(ISqlTransaction transaction, String nodeId, boolean initialLoadEnabled, boolean syncChange, long loadId, String createBy);
public boolean setReverseInitialLoadEnabled(ISqlTransaction transaction, String nodeId, boolean initialLoadEnabled, boolean syncChange, long loadId, String createBy);
public boolean setReverseInitialLoadEnabled(String nodeId, boolean initialLoadEnabled, boolean syncChange, long loadId, String createBy);
public INodeIdCreator getNodeIdCreator();
public void setNodeIdCreator(INodeIdCreator nodeIdGenerator);
public void setNodePasswordFilter(INodePasswordFilter nodePasswordFilter);
/**
* @return true if a data load has occurred and has been completed.
*/
public boolean isDataLoadCompleted();
/**
* @return true if a data load has started but not yet completed.
*/
public boolean isDataLoadStarted();
/**
* Get the current status of this node.
*
* @return {@link NodeStatus}
*/
public NodeStatus getNodeStatus();
/**
* Check to see if any nodes are offline and process any nodes found using
* the configured IOfflineNodeHandler.
*/
public void checkForOfflineNodes();
/**
* Find nodes that have been offline for the configured timeframe before {@link IOfflineClientListener}
* and {@link IOfflineServerListener} will be called
*
* @return list of offline nodes
*/
public List<Node> findOfflineNodes();
/**
* Find nodes that have been offline for a number of minutes
*
* @return list of offline nodes
* @param minutesOffline
* the number of minutes that have passed that a node has not
* checked in for until it is considered offline
*/
public List<Node> findOfflineNodes(long minutesOffline);
public Map<String, Date> findLastHeartbeats();
public List<String> findOfflineNodeIds(long minutesOffline);
public void addOfflineServerListener(IOfflineServerListener listener);
public boolean removeOfflineServerListener(IOfflineServerListener listener);
public NetworkedNode getRootNetworkedNode();
}