public ClientServiceHandler(AccumuloServerContext context, TransactionWatcher transactionWatcher, VolumeManager fs) { this.context = context; this.instance = context.getInstance(); this.transactionWatcher = transactionWatcher; this.fs = fs; this.security = AuditedSecurityOperation.getInstance(context); }
private String getTableName(String tableId) { try { return Tables.getTableName(context.getInstance(), tableId); } catch (TableNotFoundException e) { return "Unknown Table with ID " + tableId; } }
private HostAndPort getMasterAddress() { try { List<String> locations = context.getInstance().getMasterLocations(); if (locations.size() == 0) return null; return HostAndPort.fromString(locations.get(0)); } catch (Exception e) { log.warn("Failed to obtain master host " + e); } return null; }
protected SecurityOperation(AccumuloServerContext context) { this.context = context; ZKUserPath = Constants.ZROOT + "/" + context.getInstance().getInstanceID() + "/users"; zooCache = new ZooCache(); }
private Iterator<String> getIter1() { if (iter1 == null) { try { List<String> children; if (table == null || isMeta(table)) { children = zoo .getChildren(ZooUtil.getRoot(context.getInstance()) + Constants.ZPROBLEMS); } else { children = Collections.emptyList(); } iter1 = children.iterator(); } catch (Exception e) { throw new RuntimeException(e); } } return iter1; }
@Override protected void pageBody(HttpServletRequest req, HttpServletResponse response, StringBuilder sb) throws Exception { Map<String,String> tidToNameMap = Tables.getIdToNameMap(Monitor.getContext().getInstance()); String tableId = req.getParameter("t"); doProblemsBanner(sb); if (tableId == null || tableId.isEmpty() || tidToNameMap.containsKey(tableId) == false) { doTableList(req, sb, tidToNameMap); return; } doTableDetails(req, sb, tidToNameMap, tableId); }
@Override protected String getTitle(HttpServletRequest req) { List<String> masters = Monitor.getContext().getInstance().getMasterLocations(); return "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0), false).getHost()); }
@Override public List<Cookie> execute(HttpServletRequest req, Logger log) { String server = req.getParameter("server"); // a dead server should have a uniq address: a logger or tserver DeadServerList obit = new DeadServerList( ZooUtil.getRoot(Monitor.getContext().getInstance()) + Constants.ZDEADTSERVERS); obit.delete(server); return Collections.emptyList(); } }
public Set<ReplicationTarget> getReplicationTargets() { // The total set of configured targets final Set<ReplicationTarget> allConfiguredTargets = new HashSet<>(); final Map<String,String> tableNameToId = Tables.getNameToIdMap(context.getInstance()); for (String table : tableNameToId.keySet()) { if (MetadataTable.NAME.equals(table) || RootTable.NAME.equals(table)) { continue; } String localId = tableNameToId.get(table); if (null == localId) { log.trace("Could not determine ID for {}", table); continue; } TableConfiguration tableConf = context.getServerConfigurationFactory() .getTableConfiguration(localId); if (null == tableConf) { log.trace("Could not get configuration for table {} (it no longer exists)", table); continue; } for (Entry<String,String> prop : tableConf .getAllPropertiesWithPrefix(Property.TABLE_REPLICATION_TARGET).entrySet()) { String peerName = prop.getKey() .substring(Property.TABLE_REPLICATION_TARGET.getKey().length()); String remoteIdentifier = prop.getValue(); ReplicationTarget target = new ReplicationTarget(peerName, remoteIdentifier, localId); allConfiguredTargets.add(target); } } return allConfiguredTargets; }
@Override protected void pageBody(final HttpServletRequest req, HttpServletResponse resp, StringBuilder sb) { Map<String,String> tidToNameMap = Tables.getIdToNameMap(Monitor.getContext().getInstance()); doProblemSummary(req, sb, tidToNameMap); doProblemDetails(req, sb, req.getParameter("table"), tidToNameMap); }
OutputStreamWriter osw = new OutputStreamWriter(dataOut, UTF_8); osw.append(ExportTable.EXPORT_VERSION_PROP + ":" + ExportTable.VERSION + "\n"); osw.append("srcInstanceName:" + context.getInstance().getInstanceName() + "\n"); osw.append("srcInstanceID:" + context.getInstance().getInstanceID() + "\n"); osw.append("srcZookeepers:" + context.getInstance().getZooKeepers() + "\n"); osw.append("srcTableName:" + tableName + "\n"); osw.append("srcTableID:" + tableID + "\n");
public static synchronized SecurityOperation getInstance(AccumuloServerContext context, boolean initialize) { if (instance == null) { String instanceId = context.getInstance().getInstanceID(); instance = new AuditedSecurityOperation(context, getAuthorizor(instanceId, initialize), getAuthenticator(instanceId, initialize), getPermHandler(instanceId, initialize)); } return instance; }
public static synchronized SecurityOperation getInstance(AccumuloServerContext context, boolean initialize) { if (instance == null) { String instanceId = context.getInstance().getInstanceID(); instance = new SecurityOperation(context, getAuthorizor(instanceId, initialize), getAuthenticator(instanceId, initialize), getPermHandler(instanceId, initialize)); } return instance; }
private void doTableDetails(HttpServletRequest req, StringBuilder sb, Map<String,String> tidToNameMap, String tableId) { String displayName = Tables.getPrintableTableNameFromId(tidToNameMap, tableId); Instance instance = Monitor.getContext().getInstance(); TreeSet<String> locs = new TreeSet<>(); if (RootTable.ID.equals(tableId)) {
@Override public Connector getConnector() throws AccumuloException, AccumuloSecurityException { // avoid making more connectors than necessary if (conn == null) { if (inst instanceof ZooKeeperInstance || inst instanceof HdfsZooInstance) { // reuse existing context conn = new ConnectorImpl(this); } else { Credentials c = getCredentials(); conn = getInstance().getConnector(c.getPrincipal(), c.getToken()); } } return conn; } }
this.walMarker = new WalStateManager(context.getInstance(), ZooReaderWriter.getInstance()); this.store = new Iterable<TabletLocationState>() { @Override
@Override protected void pageBody(HttpServletRequest req, HttpServletResponse response, StringBuilder sb) throws IOException { Map<String,String> tidToNameMap = Tables.getIdToNameMap(Monitor.getContext().getInstance()); doLogEventBanner(sb); TablesServlet.doProblemsBanner(sb); doMasterStatus(req, sb); doRecoveryList(req, sb); TablesServlet.doTableList(req, sb, tidToNameMap); }
String zPath = ZooUtil.getRoot(context.getInstance()) + Constants.ZTSERVERS + "/" + addressString; ZooReaderWriter zoo = ZooReaderWriter.getInstance();
protected void authenticate(TCredentials credentials) throws ThriftSecurityException { if (!credentials.getInstanceId().equals(context.getInstance().getInstanceID())) throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.INVALID_INSTANCEID);
.getNameToIdMap(Monitor.getContext().getInstance()).entrySet()) { String tableName = tableName_tableId.getKey(); String tableId = tableName_tableId.getValue();