private void printSystemConfiguration(File outputDirectory) throws IOException { TreeMap<String,String> conf = new TreeMap<>(); TreeMap<String,String> site = new TreeMap<>(siteConfig); for (Entry<String,String> prop : site.entrySet()) { String defaultValue = getDefaultConfigValue(prop.getKey()); if (!prop.getValue().equals(defaultValue) && !systemConfig.containsKey(prop.getKey())) { conf.put(prop.getKey(), prop.getValue()); } } TreeMap<String,String> system = new TreeMap<>(systemConfig); for (Entry<String,String> prop : system.entrySet()) { String defaultValue = getDefaultConfigValue(prop.getKey()); if (!prop.getValue().equals(defaultValue)) { conf.put(prop.getKey(), prop.getValue()); } } File siteBackup = new File(outputDirectory, ACCUMULO_SITE_BACKUP_FILE); try (FileWriter fw = new FileWriter(siteBackup)) { for (Entry<String,String> prop : conf.entrySet()) { fw.write(prop.getKey() + "=" + prop.getValue() + "\n"); } } }
private static void stopTabletServer(final ClientContext context, List<String> servers, final boolean force) throws AccumuloException, AccumuloSecurityException { if (context.getMasterLocations().size() == 0) { log.info("No masters running. Not attempting safe unload of tserver."); return; } final String zTServerRoot = getTServersZkPath(context); final ZooCache zc = context.getZooCache(); for (String server : servers) { for (int port : context.getConfiguration().getPort(Property.TSERV_CLIENTPORT)) { HostAndPort address = AddressUtil.parseAddress(server, port); final String finalServer = qualifyWithZooKeeperSessionId(zTServerRoot, zc, address.toString()); log.info("Stopping server {}", finalServer); MasterClient.executeVoid(context, client -> client.shutdownTabletServer(Tracer.traceInfo(), context.rpcCreds(), finalServer, force)); } } }
listIntancesOpts.printErrors); } else if (cl.getParsedCommand().equals("ping")) { if (ping(context, pingCommand.args) != 0) rc = 4; } else if (cl.getParsedCommand().equals("checkTablets")) { stopTabletServer(context, stopOpts.args, opts.force); } else if (cl.getParsedCommand().equals("dumpConfig")) { printConfig(context, dumpConfigCommand); } else if (cl.getParsedCommand().equals("volumes")) { ListVolumesUsed.listVolumes(context); flushAll(context); stopServer(context, everything);
stopTabletServer(instance, CredentialHelper.create(principal, token, instance.getInstanceID()), stopOpts.args, opts.force); } else { everything = cl.getParsedCommand().equals("stopAll"); flushAll(instance, principal, token); stopServer(instance, CredentialHelper.create(principal, token, instance.getInstanceID()), everything);
Admin f2=new Admin(); f2.getContentPane().setBackground(Color.darkGray); f2.setVisible(true);
Admin form = new Admin(); form.setVisible( true );
listIntancesOpts.printErrors); } else if (cl.getParsedCommand().equals("ping")) { if (ping(context, pingCommand.args) != 0) rc = 4; } else if (cl.getParsedCommand().equals("checkTablets")) { stopTabletServer(context, stopOpts.args, opts.force); } else if (cl.getParsedCommand().equals("dumpConfig")) { printConfig(context, dumpConfigCommand); } else if (cl.getParsedCommand().equals("volumes")) { ListVolumesUsed.listVolumes(context); flushAll(context); stopServer(context, everything);
public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new FileReader("Admin.txt")); ArrayList<Admin> al = new ArrayList<Admin>(); String line = null; while ((line = br.readLine()) != null) { Admin admin = new Admin(); String lines[] = line.split("|"); /*adjust accordingly admin.setName(lines[0]); admin.setUser(lines[1]); ....*/ al.add(admin); } br.close(); }
employee[0] = new Manager("Joe Bloggs","gdr",4,32.5); employee[1] = new Admin("Mary Jennings","nnv",35.3,88.5,34.3); ... employee[6] = new Clerk("Jack Jones","bbb",43.4,78.5,23.5,47.3)
private static void stopTabletServer(final ClientContext context, List<String> servers, final boolean force) throws AccumuloException, AccumuloSecurityException { if (context.getInstance().getMasterLocations().size() == 0) { log.info("No masters running. Not attempting safe unload of tserver."); return; } final Instance instance = context.getInstance(); final String zTServerRoot = getTServersZkPath(instance); final ZooCache zc = new ZooCacheFactory().getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut()); for (String server : servers) { for (int port : context.getConfiguration().getPort(Property.TSERV_CLIENTPORT)) { HostAndPort address = AddressUtil.parseAddress(server, port); final String finalServer = qualifyWithZooKeeperSessionId(zTServerRoot, zc, address.toString()); log.info("Stopping server " + finalServer); MasterClient.execute(context, new ClientExec<MasterClientService.Client>() { @Override public void execute(MasterClientService.Client client) throws Exception { client.shutdownTabletServer(Tracer.traceInfo(), context.rpcCreds(), finalServer, force); } }); } } }
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "code runs in same security context as user who provided input") private void printNameSpaceConfiguration(AccumuloClient accumuloClient, String namespace, File outputDirectory) throws IOException, AccumuloException, AccumuloSecurityException, NamespaceNotFoundException { File namespaceScript = new File(outputDirectory, namespace + NS_FILE_SUFFIX); FileWriter nsWriter = new FileWriter(namespaceScript); nsWriter.write(createNsFormat.format(new String[] {namespace})); TreeMap<String,String> props = new TreeMap<>(); for (Entry<String,String> p : accumuloClient.namespaceOperations().getProperties(namespace)) { props.put(p.getKey(), p.getValue()); } for (Entry<String,String> entry : props.entrySet()) { String defaultValue = getDefaultConfigValue(entry.getKey()); if (defaultValue == null || !defaultValue.equals(entry.getValue())) { if (!entry.getValue().equals(siteConfig.get(entry.getKey())) && !entry.getValue().equals(systemConfig.get(entry.getKey()))) { nsWriter.write(nsConfigFormat .format(new String[] {namespace, entry.getKey() + "=" + entry.getValue()})); } } } nsWriter.close(); }
private Timer timer = new Timer(0, this); public InactivityListener() throws ClassNotFoundException{ Admin frame = new Admin(); frame.setVisible(true); Action logout = new AbstractAction() {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "code runs in same security context as user who provided input") private void printTableConfiguration(AccumuloClient accumuloClient, String tableName, File outputDirectory) throws AccumuloException, TableNotFoundException, IOException { File tableBackup = new File(outputDirectory, tableName + ".cfg"); FileWriter writer = new FileWriter(tableBackup); writer.write(createTableFormat.format(new String[] {tableName})); TreeMap<String,String> props = new TreeMap<>(); for (Entry<String,String> p : accumuloClient.tableOperations().getProperties(tableName)) { props.put(p.getKey(), p.getValue()); } for (Entry<String,String> prop : props.entrySet()) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { String defaultValue = getDefaultConfigValue(prop.getKey()); if (defaultValue == null || !defaultValue.equals(prop.getValue())) { if (!prop.getValue().equals(siteConfig.get(prop.getKey())) && !prop.getValue().equals(systemConfig.get(prop.getKey()))) { writer.write(configFormat .format(new String[] {tableName, prop.getKey() + "=" + prop.getValue()})); } } } } writer.close(); } }
private void printSystemConfiguration(Connector connector, File outputDirectory) throws IOException, AccumuloException, AccumuloSecurityException { Configuration conf = new Configuration(false); TreeMap<String,String> site = new TreeMap<>(siteConfig); for (Entry<String,String> prop : site.entrySet()) { String defaultValue = getDefaultConfigValue(prop.getKey()); if (!prop.getValue().equals(defaultValue) && !systemConfig.containsKey(prop.getKey())) { conf.set(prop.getKey(), prop.getValue()); } } TreeMap<String,String> system = new TreeMap<>(systemConfig); for (Entry<String,String> prop : system.entrySet()) { String defaultValue = getDefaultConfigValue(prop.getKey()); if (!prop.getValue().equals(defaultValue)) { conf.set(prop.getKey(), prop.getValue()); } } File siteBackup = new File(outputDirectory, ACCUMULO_SITE_BACKUP_FILE); FileOutputStream fos = new FileOutputStream(siteBackup); try { conf.writeXml(fos); } finally { fos.close(); } }
private void printNameSpaceConfiguration(Connector connector, String namespace, File outputDirectory) throws IOException, AccumuloException, AccumuloSecurityException, NamespaceNotFoundException { File namespaceScript = new File(outputDirectory, namespace + NS_FILE_SUFFIX); FileWriter nsWriter = new FileWriter(namespaceScript); nsWriter.write(createNsFormat.format(new String[] {namespace})); TreeMap<String,String> props = new TreeMap<>(); for (Entry<String,String> p : connector.namespaceOperations().getProperties(namespace)) { props.put(p.getKey(), p.getValue()); } for (Entry<String,String> entry : props.entrySet()) { String defaultValue = getDefaultConfigValue(entry.getKey()); if (defaultValue == null || !defaultValue.equals(entry.getValue())) { if (!entry.getValue().equals(siteConfig.get(entry.getKey())) && !entry.getValue().equals(systemConfig.get(entry.getKey()))) { nsWriter.write(nsConfigFormat .format(new String[] {namespace, entry.getKey() + "=" + entry.getValue()})); } } } nsWriter.close(); }
private void printTableConfiguration(Connector connector, String tableName, File outputDirectory) throws AccumuloException, TableNotFoundException, IOException, AccumuloSecurityException { File tableBackup = new File(outputDirectory, tableName + ".cfg"); FileWriter writer = new FileWriter(tableBackup); writer.write(createTableFormat.format(new String[] {tableName})); TreeMap<String,String> props = new TreeMap<>(); for (Entry<String,String> p : connector.tableOperations().getProperties(tableName)) { props.put(p.getKey(), p.getValue()); } for (Entry<String,String> prop : props.entrySet()) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { String defaultValue = getDefaultConfigValue(prop.getKey()); if (defaultValue == null || !defaultValue.equals(prop.getValue())) { if (!prop.getValue().equals(siteConfig.get(prop.getKey())) && !prop.getValue().equals(systemConfig.get(prop.getKey()))) { writer.write(configFormat .format(new String[] {tableName, prop.getKey() + "=" + prop.getValue()})); } } } } writer.close(); } }