Checks if the Zookeeper address has been set when running the Alluxio HA mode.

@param reportWriter save user-facing messages to a generated file
@param alluxioConf Alluxio configuration
@return true if Alluxio HA mode is supported, false otherwise
420785
public static boolean supportAlluxioHA(PrintWriter reportWriter,
      AlluxioConfiguration alluxioConf) {
    if (alluxioConf.getBoolean(PropertyKey.ZOOKEEPER_ENABLED)) {
      reportWriter.println("Alluixo is running in high availability mode.\n");
      if (!alluxioConf.isSet(PropertyKey.ZOOKEEPER_ADDRESS)) {
        reportWriter.println("Please set Zookeeper address to support "
            + "Alluxio high availability mode.\n");
        return false;
      } else {
        reportWriter.printf("Zookeeper address is: %s.%n",
            alluxioConf.get(PropertyKey.ZOOKEEPER_ADDRESS));
      }
    }
    return true;
  }
1073402
protected boolean isAllowed(File path, boolean write) throws IOException {
		return isAllowedInternal(path, write, config.isReadOnly());
	}
657365
public static GrpcServerBuilder forAddress(String hostName, SocketAddress address,
      AlluxioConfiguration conf) {
    return new GrpcServerBuilder(hostName, address, null, conf);
  }
122880
private static boolean isLocalJournal(JournalManager jm) {
    if (jm == null || (!(jm instanceof FileJournalManager))) {
      return false;
    }
    return NNStorage.isPreferred(StorageLocationType.LOCAL,
        ((FileJournalManager) jm).getStorageDirectory());
  }
748500
public synchronized void initialize(URI uri, org.apache.hadoop.conf.Configuration conf,
      @Nullable AlluxioConfiguration alluxioConfiguration)
      throws IOException {
    Preconditions.checkArgument(uri.getScheme().equals(getScheme()),
        PreconditionMessage.URI_SCHEME_MISMATCH.toString(), uri.getScheme(), getScheme());

    super.initialize(uri, conf);
    LOG.debug("initialize({}, {}). Connecting to Alluxio", uri, conf);
    HadoopUtils.addSwiftCredentials(conf);
    setConf(conf);

    // HDFS doesn't allow the authority to be empty; it must be "/" instead.
    String authority = uri.getAuthority() == null ? "/" : uri.getAuthority();
    mAlluxioHeader = getScheme() + "://" + authority;
    // Set the statistics member. Use mStatistics instead of the parent class's variable.
    mStatistics = statistics;

    Authority auth = Authority.fromString(uri.getAuthority());
    if (auth instanceof UnknownAuthority) {
      throw new IOException(String.format("Authority \"%s\" is unknown. The client can not be "
              + "configured with the authority from %s", auth, uri));
    }

    mUri = URI.create(mAlluxioHeader);

    if (mFileSystem != null) {
      return;
    }

    Map<String, Object> uriConfProperties = getConfigurationFromUri(uri);

    AlluxioProperties alluxioProps =
        (alluxioConfiguration != null) ? alluxioConfiguration.copyProperties()
            : ConfigurationUtils.defaults();
    AlluxioConfiguration alluxioConf = mergeConfigurations(uriConfProperties, conf, alluxioProps);
    Subject subject = getHadoopSubject();
    if (subject != null) {
      LOG.debug("Using Hadoop subject: {}", subject);
    } else {
      LOG.debug("No Hadoop subject. Using context without subject.");
    }

    LOG.info("Initializing filesystem with connect details {}",
        Factory.getConnectDetails(alluxioConf));

    mFileSystem = FileSystem.Factory.create(ClientContext.create(subject, alluxioConf));
  }
1205311
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        // Restore an un-cached message to we can dump its state
        if (msg == null)
            getJSMessage(true);

        try
        {
            if (msg != null)
            {
                writer.newLine();
                writer.taggedValue("JsMessage", msg.getClass().getName());
                writer.newLine();
                writer.taggedValue("systemMessageId", msg.getSystemMessageId());

                if (msg instanceof JsApiMessage)
                {
                    writer.newLine();
                    writer.taggedValue("APIMessageId", ((JsApiMessage) msg).getApiMessageId());
                    writer.newLine();
                    writer.taggedValue("APICorrelId", ((JsApiMessage) msg).getCorrelationId());
                }
                else
                {
                    if (msg.getApiMessageIdAsBytes() != null)
                    {
                        writer.newLine();
                        writer.taggedValue("APIMessageId", new String(msg.getApiMessageIdAsBytes()));
                    }
                    if (msg.getCorrelationIdAsBytes() != null)
                    {
                        writer.newLine();
                        writer.taggedValue("APICorrelId", new String(msg.getCorrelationIdAsBytes()));
                    }
                }

                writer.newLine();
                writer.taggedValue("putTime", new Date(msg.getTimestamp()));

                // If this MessageItem is sitting on an xmit ItemStream then we're probably
                // going to be interested in the GD data in the message.
                try
                {
                    ItemStream is = getItemStream();
                    if (is instanceof PtoPXmitMsgsItemStream)
                    {
                        writer.newLine();
                        writer.startTag("xmitData");
                        writer.indent();

                        writer.newLine();
                        writer.taggedValue("startTick", msg.getGuaranteedValueStartTick());
                        writer.newLine();
                        writer.taggedValue("endTick", msg.getGuaranteedValueEndTick());
                        writer.newLine();
                        writer.taggedValue("priority", msg.getPriority());
                        writer.newLine();
                        writer.taggedValue("reliability", msg.getReliability());
                        writer.newLine();
                        writer.taggedValue("streamId", msg.getGuaranteedStreamUUID());
                        if (msg.getRoutingDestination() != null)
                        {
                            writer.newLine();
                            writer.taggedValue("routingDestination", msg.getRoutingDestination());
                        }

                        writer.outdent();
                        writer.newLine();
                        writer.endTag("xmitData");
                    }
                } catch (SevereMessageStoreException se)
                {
                    // No FFDC code needed
                } catch (RuntimeException re)
                {
                    // No FFDC code needed
                }

                String text = null;
                //if we can easily get the text of the message then use that
                if (msg instanceof JsJmsTextMessage)
                {
                    try
                    {
                        text = ((JsJmsTextMessage) msg).getText();
                        if (text != null && text.length() > 40)
                            text = text.substring(0, 37) + "...";
                    } catch (UnsupportedEncodingException e)
                    {
                        // No FFDC code needed
                        text = "Unsupported message encoding";
                    }
                }
                else
                    text = String.valueOf(msg);

                writer.newLine();
                writer.taggedValue("data", text);
            }
        } catch (RuntimeException e)
        {
            // No FFDC code needed

            // As we're not locking the state down there's very slim chance of hitting
            // something like a NPE while we do this, we'll just catch it and ignore it
        }
    }
968864
public ZookeeperTxId getPrimaryLastTxId(String address, boolean sync)
      throws IOException,
      KeeperException, InterruptedException, ClassNotFoundException {
    Stat stat = new Stat();
    String node = getLastTxIdNode(address);
    byte[] data = getNodeData(node, stat, false, sync);
    if (data == null) {
      return null;
    }
    return ZookeeperTxId.getFromBytes(data);
  }
418527
protected void writeExtensions(List<ExtensionReport> extensionReports) throws IOException {

        writer.append("== ").append(this.resourceBundle.getString("asciidoc.reporter.extensions")).append(NEW_LINE)
            .append(NEW_LINE);

        for (ExtensionReport extensionReport : extensionReports) {

            writer.append("[cols=\"2*\"]").append(NEW_LINE);
            writer.append(".").append(extensionReport.getQualifier()).append(NEW_LINE);
            writer.append("|===").append(NEW_LINE).append(NEW_LINE);

            writer.append("2+|").append(extensionReport.getQualifier()).append(NEW_LINE).append(NEW_LINE);

            writer.append("h|KEY").append(NEW_LINE);
            writer.append("h|VALUE").append(NEW_LINE).append(NEW_LINE);

            writeConfigurationRows(extensionReport.getConfiguration());

            writer.append("|===").append(NEW_LINE).append(NEW_LINE);

        }

    }
300020
private boolean checkWriteConfiguration() {

        if ((m_fieldconfiguration != null) || m_fieldconfiguration.getFields().isEmpty()) {
            for (CmsSearchField field : m_fieldconfiguration.getFields()) {
                if (field.getMappings().isEmpty()) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
1306708
@BuilderMethod
    public void setReportField(@NonNull ReportField field, boolean enable) {
        this.reportContentChanges.put(field, enable);
    }
748137
public static void main(String[] args) {
    if (args.length != 0) {
      LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR,
          AlluxioWorkerMonitor.class.getCanonicalName());
      LOG.warn("ignoring arguments");
    }
    AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());

    HealthCheckClient client = new WorkerHealthCheckClient(
        NetworkAddressUtils.getConnectAddress(NetworkAddressUtils.ServiceType.WORKER_RPC, conf),
        ONE_MIN_EXP_BACKOFF, conf);
    if (!client.isServing()) {
      System.exit(1);
    }
    System.exit(0);
  }
59408
@Override
public RecordWriter<NullWritable,SpreadSheetCellDAO> getRecordWriter(TaskAttemptContext context) throws IOException {
	// check if mimeType is set. If not assume new Excel format (.xlsx)
	Configuration conf=context.getConfiguration();
	String defaultConf=conf.get(HadoopOfficeWriteConfiguration.CONF_MIMETYPE,ExcelFileOutputFormat.DEFAULT_MIMETYPE);
	conf.set(HadoopOfficeWriteConfiguration.CONF_MIMETYPE,defaultConf);
	// add suffix	
	Path file = getDefaultWorkFile(context,ExcelFileOutputFormat.getSuffix(conf.get(HadoopOfficeWriteConfiguration.CONF_MIMETYPE)));


	 	try {
			return new ExcelRecordWriter<>(HadoopUtil.getDataOutputStream(conf,file,context,getCompressOutput(context),getOutputCompressorClass(context, ExcelFileOutputFormat.defaultCompressorClass)),file.getName(),conf);
		} catch (InvalidWriterConfigurationException | InvalidCellSpecificationException | FormatNotUnderstoodException
				| GeneralSecurityException | OfficeWriterException e) {
			LOG.error(e);
		}

	return null;
}
1151361
public static Status printNodesResults(Map<Status, List<String>> map, PrintWriter reportWriter) {
    boolean canFindClass = true;
    boolean canFindFS = true;

    for (Map.Entry<Status, List<String>> entry : map.entrySet()) {
      String nodeAddresses = String.join(" ", entry.getValue());
      switch (entry.getKey()) {
        case FAIL_TO_FIND_CLASS:
          canFindClass = false;
          reportWriter.printf("Nodes of IP addresses: %s "
              + "cannot recognize Alluxio classes.%n%n", nodeAddresses);
          break;
        case FAIL_TO_FIND_FS:
          canFindFS = false;
          reportWriter.printf("Nodes of IP addresses: %s "
              + "cannot recognize Alluxio filesystem.%n%n", nodeAddresses);
          break;
        default:
          reportWriter.printf("Nodes of IP addresses: %s "
              + "can recognize Alluxio filesystem.%n%n", nodeAddresses);
      }
    }
    return canFindClass ? (canFindFS ? Status.SUCCESS : Status.FAIL_TO_FIND_FS)
        : Status.FAIL_TO_FIND_CLASS;
  }
990206
public final void setReportCOA(Byte value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setReportCOA", value);
        if (value != null) {
            getHdr2().setField(JsHdr2Access.REPORTCOA_VALUE, value);
        }
        else {
            getHdr2().setChoiceField(JsHdr2Access.REPORTCOA, JsHdr2Access.IS_REPORTCOA_UNSET);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setReportCOA");
    }
1370718
public static boolean saveStaticResolutions(Configuration conf) {
    List<String[]> staticResolutions = NetUtils.getAllStaticResolutions();
    if (staticResolutions != null && staticResolutions.size() > 0) {
      StringBuffer str = new StringBuffer();

      for (int i = 0; i < staticResolutions.size(); i++) {
        String[] hostToResolved = staticResolutions.get(i);
        str.append(hostToResolved[0]+"="+hostToResolved[1]);
        if (i != staticResolutions.size() - 1) {
          str.append(',');
        }
      }
      conf.set("hadoop.net.static.resolutions", str.toString());
      return true;
    }
    return false;
  }
605748
private static AlluxioFuseOptions parseOptions(String[] args, AlluxioConfiguration alluxioConf) {
    final Options opts = new Options();
    final Option mntPoint = Option.builder("m")
        .hasArg()
        .required(true)
        .longOpt("mount-point")
        .desc("Desired local mount point for alluxio-fuse.")
        .build();

    final Option alluxioRoot = Option.builder("r")
        .hasArg()
        .required(true)
        .longOpt("alluxio-root")
        .desc("Path within alluxio that will be used as the root of the FUSE mount "
            + "(e.g., /users/foo; defaults to /)")
        .build();

    final Option help = Option.builder("h")
        .required(false)
        .desc("Print this help")
        .build();

    final Option fuseOption = Option.builder("o")
        .valueSeparator(',')
        .required(false)
        .hasArgs()
        .desc("FUSE mount options")
        .build();

    opts.addOption(mntPoint);
    opts.addOption(alluxioRoot);
    opts.addOption(help);
    opts.addOption(fuseOption);

    final CommandLineParser parser = new DefaultParser();
    try {
      CommandLine cli = parser.parse(opts, args);

      if (cli.hasOption("h")) {
        final HelpFormatter fmt = new HelpFormatter();
        fmt.printHelp(AlluxioFuse.class.getName(), opts);
        return null;
      }

      String mntPointValue = cli.getOptionValue("m");
      String alluxioRootValue = cli.getOptionValue("r");

      List<String> fuseOpts = new ArrayList<>();
      boolean noUserMaxWrite = true;
      if (cli.hasOption("o")) {
        String[] fopts = cli.getOptionValues("o");
        // keep the -o
        for (final String fopt: fopts) {
          fuseOpts.add("-o" + fopt);
          if (noUserMaxWrite && fopt.startsWith("max_write")) {
            noUserMaxWrite = false;
          }
        }
      }
      // check if the user has specified his own max_write, otherwise get it
      // from conf
      if (noUserMaxWrite) {
        final long maxWrite = alluxioConf.getBytes(PropertyKey.FUSE_MAXWRITE_BYTES);
        fuseOpts.add(String.format("-omax_write=%d", maxWrite));
      }

      final boolean fuseDebug = alluxioConf.getBoolean(PropertyKey.FUSE_DEBUG_ENABLED);

      return new AlluxioFuseOptions(mntPointValue, alluxioRootValue, fuseDebug, fuseOpts);
    } catch (ParseException e) {
      System.err.println("Error while parsing CLI: " + e.getMessage());
      final HelpFormatter fmt = new HelpFormatter();
      fmt.printHelp(AlluxioFuse.class.getName(), opts);
      return null;
    }
  }
1285951
public boolean isHomeKeyPresent() {
        final GVRApplication application = mApplication.get();
        if (null != application) {
            final String model = getHmtModel();
            if (null != model && model.contains("R323")) {
                return true;
            }
        }
        return false;
    }