final Map<String,String> peers = new HashMap<>(); final String definedPeersPrefix = Property.REPLICATION_PEERS.getKey(); final ReplicaSystemFactory replicaSystemFactory = new ReplicaSystemFactory(); ReplicaSystem replica; try { replica = replicaSystemFactory.get(Monitor.getContext(), property.getValue()); } catch (Exception e) { log.warn("Could not instantiate ReplicaSystem for {} with configuration {}",
/** * @param value * {@link ReplicaSystem} implementation class name * @return A {@link ReplicaSystem} object from the given name */ public ReplicaSystem get(ServerContext context, String value) { final Entry<String,String> entry = parseReplicaSystemConfiguration(value); try { Class<?> clz = Class.forName(entry.getKey()); if (ReplicaSystem.class.isAssignableFrom(clz)) { Object o = clz.newInstance(); ReplicaSystem rs = (ReplicaSystem) o; rs.configure(context, entry.getValue()); return rs; } throw new IllegalArgumentException( "Class is not assignable to ReplicaSystem: " + entry.getKey()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { log.error("Error creating ReplicaSystem object", e); throw new IllegalArgumentException(e); } }
public ReplicationUtil(ServerContext context) { this(context, new ReplicaSystemFactory()); }
ReplicaSystemFactory.getPeerConfigurationValue(MockReplicaSystem.class, "1000")); attempts = 0; } catch (Exception e) {
protected ReplicaSystem getReplicaSystem(ReplicationTarget target) { // Find the configured replication peer so we know how to replicate to it // Classname,Configuration String peerType = getPeerType(target.getPeerName()); // Get the peer that we're replicating to return factory.get(context, peerType); }
public ReplicationProcessor(ServerContext context, AccumuloConfiguration conf, VolumeManager fs) { this.context = context; this.conf = conf; this.fs = fs; this.helper = new ReplicaSystemHelper(context); this.factory = new ReplicaSystemFactory(); }
ReplicaSystemFactory.getPeerConfigurationValue(MockReplicaSystem.class, "50000"));
protected ReplicaSystem getReplicaSystem(ReplicationTarget target) { // Find the configured replication peer so we know how to replicate to it // Classname,Configuration String peerType = getPeerType(target.getPeerName()); // Get the peer that we're replicating to return factory.get(peerType); }
public ReplicationProcessor(ClientContext context, AccumuloConfiguration conf, VolumeManager fs) { this.context = context; this.conf = conf; this.fs = fs; this.helper = new ReplicaSystemHelper(context); this.factory = new ReplicaSystemFactory(); }
ReplicaSystemFactory.getPeerConfigurationValue(AccumuloReplicaSystem.class, AccumuloReplicaSystem.buildConfiguration(peerCluster.getInstanceName(), peerCluster.getZooKeepers())));
/** * Extract replication peers from system configuration * * @return Configured replication peers */ public Map<String,String> getPeers() { Map<String,String> peers = new HashMap<>(); // Get the defined peers and what ReplicaSystem impl they're using for (Entry<String,String> property : context.getConfiguration() .getAllPropertiesWithPrefix(Property.REPLICATION_PEERS).entrySet()) { String key = property.getKey(); // Filter out cruft that we don't want if (!key.startsWith(Property.REPLICATION_PEER_USER.getKey()) && !key.startsWith(Property.REPLICATION_PEER_PASSWORD.getKey()) && !key.startsWith(Property.REPLICATION_PEER_KEYTAB.getKey())) { String peerName = property.getKey().substring(Property.REPLICATION_PEERS.getKey().length()); Entry<String,String> entry; try { entry = factory.parseReplicaSystemConfiguration(property.getValue()); } catch (Exception e) { log.warn("Could not instantiate ReplicaSystem for {} with configuration {}", property.getKey(), property.getValue(), e); continue; } peers.put(peerName, entry.getKey()); } } return peers; }
public ReplicationUtil(AccumuloServerContext context) { this(context, new ZooCache(), new ReplicaSystemFactory()); }
ReplicaSystemFactory.getPeerConfigurationValue(AccumuloReplicaSystem.class, AccumuloReplicaSystem.buildConfiguration(peerCluster.getInstanceName(), peerCluster.getZooKeepers())));
/** * @param value * {@link ReplicaSystem} implementation class name * @return A {@link ReplicaSystem} object from the given name */ public ReplicaSystem get(String value) { final Entry<String,String> entry = parseReplicaSystemConfiguration(value); try { Class<?> clz = Class.forName(entry.getKey()); if (ReplicaSystem.class.isAssignableFrom(clz)) { Object o = clz.newInstance(); ReplicaSystem rs = (ReplicaSystem) o; rs.configure(entry.getValue()); return rs; } throw new IllegalArgumentException( "Class is not assignable to ReplicaSystem: " + entry.getKey()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { log.error("Error creating ReplicaSystem object", e); throw new IllegalArgumentException(e); } }
ReplicaSystemFactory.getPeerConfigurationValue(MockReplicaSystem.class, "50000"));
/** * Extract replication peers from system configuration * * @return Configured replication peers */ public Map<String,String> getPeers() { Map<String,String> peers = new HashMap<>(); // Get the defined peers and what ReplicaSystem impl they're using for (Entry<String,String> property : context.getConfiguration() .getAllPropertiesWithPrefix(Property.REPLICATION_PEERS).entrySet()) { String key = property.getKey(); // Filter out cruft that we don't want if (!key.startsWith(Property.REPLICATION_PEER_USER.getKey()) && !key.startsWith(Property.REPLICATION_PEER_PASSWORD.getKey()) && !key.startsWith(Property.REPLICATION_PEER_KEYTAB.getKey())) { String peerName = property.getKey().substring(Property.REPLICATION_PEERS.getKey().length()); Entry<String,String> entry; try { entry = factory.parseReplicaSystemConfiguration(property.getValue()); } catch (Exception e) { log.warn("Could not instantiate ReplicaSystem for {} with configuration {}", property.getKey(), property.getValue(), e); continue; } peers.put(peerName, entry.getKey()); } } return peers; }
Property.TABLE_REPLICATION_TARGET.getKey() + "cluster1", "1"); conn.instanceOperations().setProperty(Property.REPLICATION_PEERS.getKey() + "cluster1", ReplicaSystemFactory.getPeerConfigurationValue(MockReplicaSystem.class, null));
ReplicaSystemFactory.getPeerConfigurationValue(MockReplicaSystem.class, "100000")); break; } catch (Exception e) {
ReplicaSystemFactory.getPeerConfigurationValue(AccumuloReplicaSystem.class, AccumuloReplicaSystem.buildConfiguration(peerCluster.getInstanceName(), peerCluster.getZooKeepers())));
iOps.setProperty(REPLICATION_PEERS.getKey() + instName, getPeerConfigurationValue( AccumuloReplicaSystem.class, instName + "," + inst.getZooKeepers())); iOps.setProperty(REPLICATION_PEER_USER.getKey() + instName, env.getUserName());