Initialize the plugin

@param jsonFile
A file containing the JSON configuration
@throws IndexerException
if errors occur during initialization
325098
@Override
	public void init(File jsonFile) throws IndexerException {
		try {
			config = new JsonSimpleConfig(jsonFile);
			init();
		} catch (IOException ioe) {
			throw new IndexerException(ioe);
		}
	}
484771
@SuppressWarnings("unchecked")
    public void load(File propertiesFile) throws IOException {
        String paramName;
        String paramValue;
        
        Reader reader = new FileReader(propertiesFile);
        _properties.load(reader);
        reader.close();
        
        paramName = StoreParams.PARAM_INDEXES_CACHED;
        paramValue = _properties.getProperty(paramName);
        setIndexesCached(parseBoolean(paramName, paramValue, StoreParams.INDEXES_CACHED_DEFAULT));
        
        paramName = StoreParams.PARAM_BATCH_SIZE;
        paramValue = _properties.getProperty(paramName);
        setBatchSize(parseInt(paramName, paramValue, StoreParams.BATCH_SIZE_DEFAULT));
        
        paramName = StoreParams.PARAM_NUM_SYNC_BATCHES;
        paramValue = _properties.getProperty(paramName);
        setNumSyncBatches(parseInt(paramName, paramValue, StoreParams.NUM_SYNC_BATCHES_DEFAULT));
        
        paramName = StoreParams.PARAM_SEGMENT_FILE_SIZE_MB;
        paramValue = _properties.getProperty(paramName);
        setSegmentFileSizeMB(parseInt(paramName, paramValue, StoreParams.SEGMENT_FILE_SIZE_MB_DEFAULT));
        
        paramName = StoreParams.PARAM_SEGMENT_COMPACT_FACTOR;
        paramValue = _properties.getProperty(paramName);
        setSegmentCompactFactor(parseDouble(paramName, paramValue, StoreParams.SEGMENT_COMPACT_FACTOR_DEFAULT));
        
        paramName = StoreParams.PARAM_HASH_LOAD_FACTOR;
        paramValue = _properties.getProperty(paramName);
        setHashLoadFactor(parseDouble(paramName, paramValue, StoreParams.HASH_LOAD_FACTOR_DEFAULT));
        
        // Create _segmentFactory
        paramName = StoreParams.PARAM_SEGMENT_FACTORY_CLASS;
        paramValue = _properties.getProperty(paramName);
        SegmentFactory segmentFactory = null;
        if(paramValue != null) {
            try {
                segmentFactory = Class.forName(paramValue).asSubclass(SegmentFactory.class).newInstance();
            } catch(Exception e) {
                _logger.warn("Invalid SegmentFactory class: " + paramValue);
            }
        }
        if(segmentFactory == null) {
            segmentFactory = new MappedSegmentFactory();
        }
        setSegmentFactory(segmentFactory);
        
        // Create _hashFunction
        paramName = StoreParams.PARAM_HASH_FUNCTION_CLASS;
        paramValue = _properties.getProperty(paramName);
        HashFunction<byte[]> hashFunction = null;
        if(paramValue != null) {
            try {
                hashFunction = (HashFunction<byte[]>)Class.forName(paramValue).newInstance();
            } catch(Exception e) {
                _logger.warn("Invalid HashFunction<byte[]> class: " + paramValue);
            }
        }
        if(hashFunction == null) {
            hashFunction = new FnvHashFunction();
        }
        setHashFunction(hashFunction);
        
        // Create _dataHandler
        paramName = StoreParams.PARAM_DATA_HANDLER_CLASS;
        paramValue = _properties.getProperty(paramName);
        DataHandler dataHandler = null;
        if(paramValue != null) {
            try {
                dataHandler = (DataHandler)Class.forName(paramValue).newInstance();
            } catch(Exception e) {
                _logger.warn("Invalid DataHandler class: " + paramValue);
            }
        }
        if(dataHandler != null) {
            setDataHandler(dataHandler);
        }
    }
1065655
private void reloadJsonConfig() throws
      IOException, SAXException, ParserConfigurationException, JSONException {
    Map<ResourceType, Long> newTypeToNodeWait;
    Map<ResourceType, Long> newTypeToRackWait;
    ScheduleComparator newDefaultPoolComparator = DEFAULT_POOL_COMPARATOR;
    double newShareStarvingRatio = DEFAULT_SHARE_STARVING_RATIO;
    long newMinPreemptPeriod = DEFAULT_MIN_PREEMPT_PERIOD;
    int newGrantsPerIteration = DEFAULT_GRANTS_PER_ITERATION;
    long newStarvingTimeForMinimum = DEFAULT_STARVING_TIME_FOR_MINIMUM;
    long newStarvingTimeForShare = DEFAULT_STARVING_TIME_FOR_SHARE;
    long newPreemptedTaskMaxRunningTime = DEFAULT_PREEMPT_TASK_MAX_RUNNING_TIME;
    int newPreemptionRounds = DEFAULT_PREEMPTION_ROUNDS;
    boolean newScheduleFromNodeToSession = DEFAULT_SCHEDULE_FROM_NODE_TO_SESSION;

    newTypeToNodeWait = new EnumMap<ResourceType, Long>(ResourceType.class);
    newTypeToRackWait = new EnumMap<ResourceType, Long>(ResourceType.class);
    Map<PoolInfo, PoolInfo> newPoolInfoToRedirect =
            new HashMap<PoolInfo, PoolInfo>();
    for (ResourceType type : TYPES) {
      newTypeToNodeWait.put(type, 0L);
      newTypeToRackWait.put(type, 0L);
    }
    
    // All the configuration files for a cluster are placed in one large	
    // json object. This large json object has keys that map to smaller	
    // json objects which hold the same resources as xml configuration 	
    // files. Here, we try to parse the json object that corresponds to	
    // corona.xml
    File jsonConfigFile = new File(configFileName);
    InputStream in = new BufferedInputStream(new FileInputStream(jsonConfigFile));
    JSONObject json = conf.instantiateJsonObject(in);
    json = json.getJSONObject(conf.xmlToThrift(CoronaConf.DEFAULT_CONFIG_FILE));
    Iterator<String> keys = json.keys();
    while (keys.hasNext()) {
      String key = keys.next();
      if (!json.isNull(key)) {
        if (key.equals("localityWaits")) {
          JSONObject jsonTypes = json.getJSONObject(key);
          loadLocalityWaits(jsonTypes, newTypeToNodeWait, newTypeToRackWait);
        }
        if (key.equals("defaultSchedulingMode")) {
          newDefaultPoolComparator =
              ScheduleComparator.valueOf(json.getString(key));
        }
        if (key.equals("shareStarvingRatio")) {
          newShareStarvingRatio = json.getDouble(key);
          if (newShareStarvingRatio < 0 || newShareStarvingRatio > 1.0) {
            LOG.error("Illegal shareStarvingRatio:" + newShareStarvingRatio);
            newShareStarvingRatio = DEFAULT_SHARE_STARVING_RATIO;
          }
        }
        if (key.equals("grantsPerIteration")) {
          newGrantsPerIteration = json.getInt(key);
          if (newMinPreemptPeriod < 0) {
            LOG.error("Illegal grantsPerIteration: " + newGrantsPerIteration);
            newGrantsPerIteration = DEFAULT_GRANTS_PER_ITERATION;
          }
        }
        if (key.equals("minPreemptPeriod")) {
          newMinPreemptPeriod = json.getLong(key);
          if (newMinPreemptPeriod < 0) {
            LOG.error("Illegal minPreemptPeriod: " + newMinPreemptPeriod);
            newMinPreemptPeriod = DEFAULT_MIN_PREEMPT_PERIOD;
          }
        }
        if (key.equals("starvingTimeForShare")) {
          newStarvingTimeForShare = json.getLong(key);
          if (newStarvingTimeForShare < 0) {
            LOG.error("Illegal starvingTimeForShare:" + newStarvingTimeForShare);
            newStarvingTimeForShare = DEFAULT_STARVING_TIME_FOR_SHARE;
          }
        }
        if (key.equals("starvingTimeForMinimum")) {
          newStarvingTimeForMinimum = json.getLong(key);
          if (newStarvingTimeForMinimum < 0) {
            LOG.error("Illegal starvingTimeForMinimum:" +
                      newStarvingTimeForMinimum);
            newStarvingTimeForMinimum = DEFAULT_STARVING_TIME_FOR_MINIMUM;
          }
        }
        if (key.equals("preemptedTaskMaxRunningTime")) {
          newPreemptedTaskMaxRunningTime = json.getLong(key);
          if (newPreemptedTaskMaxRunningTime < 0) {
            LOG.error("Illegal preemptedTaskMaxRunningTime:" +
                      newPreemptedTaskMaxRunningTime);
            newPreemptedTaskMaxRunningTime =
              DEFAULT_PREEMPT_TASK_MAX_RUNNING_TIME;
          }
        }
        if (key.equals("preemptionRounds")) {
          newPreemptionRounds = json.getInt(key);
          if (newPreemptionRounds < 0) {
            LOG.error("Illegal preemptedTaskMaxRunningTime:" +
                      newPreemptionRounds);
            newPreemptionRounds = DEFAULT_PREEMPTION_ROUNDS;
          }
        }
        if (key.equals("scheduleFromNodeToSession")) {
          newScheduleFromNodeToSession = json.getBoolean(key);
        }
        if (key.equals(REDIRECT_TAG_NAME)) {
          JSONArray jsonPoolInfoToRedirect = json.getJSONArray(key);
          loadPoolInfoToRedirect(jsonPoolInfoToRedirect, 
                                 newPoolInfoToRedirect);
        }
      }
    }
    synchronized (this) {
      this.typeToNodeWait = newTypeToNodeWait;
      this.typeToRackWait = newTypeToRackWait;
      this.defaultPoolComparator = newDefaultPoolComparator;
      this.shareStarvingRatio = newShareStarvingRatio;
      this.minPreemptPeriod = newMinPreemptPeriod;
      this.grantsPerIteration = newGrantsPerIteration;
      this.starvingTimeForMinimum = newStarvingTimeForMinimum;
      this.starvingTimeForShare = newStarvingTimeForShare;
      this.preemptedTaskMaxRunningTime = newPreemptedTaskMaxRunningTime;
      this.preemptionRounds = newPreemptionRounds;
      this.scheduleFromNodeToSession = newScheduleFromNodeToSession;
      this.poolInfoToRedirect = newPoolInfoToRedirect;
    }
  }
1306560
private JSONObject jsonFromElement(final AtlasElement element) throws JSONException {
        final ObjectNode objectNode = this.objectNodeFromElement(element);

        try {
            return new JSONObject(new JSONTokener(MAPPER.writeValueAsString(objectNode)));
        } catch (IOException ioe) {
            // repackage this as a JSONException...seems sensible as the caller will only know about
            // the jettison object not being created
            throw new JSONException(ioe);
        }
    }
745974
public void loadPropertyFile(File propertyFile) throws IOException {
        userSettings.load(new FileReader(propertyFile));
        loadDataSource(obdaModel, userSettings);
    }
744929
function Json(filepath) {
  this.filepath = filepath;
  this.dirname = undefined;
  this.json = undefined;
  this.realpath = undefined;
}
1151018
public void setJsonCredentialsFile(String jsonCredentialsPath) {
    if (!Utility.isNullOrEmpty(jsonCredentialsPath)) {
      setJsonCredentialsFile(new File(jsonCredentialsPath));
    } else {
      setJsonCredentialsFile((File) null);
    }
  }
907097
@PostConstruct
    public synchronized void initialize() {
        final FwCoreDirection direction = assistCoreDirection();
        developmentHere = direction.isDevelopmentHere();

        final JsonResourceProvider provider = direction.assistJsonResourceProvider();
        mappingOption = OptionalThing.ofNullable(extractMappingOption(provider), () -> {
            throw new IllegalStateException("Not found the JSON mapping option.");
        });
        printControlState = OptionalThing.of(preparePrintState(provider)); // fixedly exists for now
        yourEngineCreator = OptionalThing.ofNullable(extractYourEngineCreator(provider), () -> {
            throw new IllegalStateException("Not found the your engine creator.");
        });

        // should be last because of using other instance variable
        realJsonEngine = createDefaultJsonEngine();
        showBootLogging();
    }
133533
@Override
  public void initialize(InputSplit genericSplit, TaskAttemptContext context)
      throws IOException {
    if (logger.atFine().isEnabled()) {
      try {
        logger.atFine().log(
            "initialize('%s', '%s')",
            HadoopToStringUtil.toString(genericSplit), HadoopToStringUtil.toString(context));
      } catch (InterruptedException ie) {
        logger.atFine().withCause(ie).log(
            "InterruptedException during HadoopToStringUtil.toString");
      }
    }
    Preconditions.checkArgument(genericSplit instanceof FileSplit,
        "InputSplit genericSplit should be an instance of FileSplit.");
    // Get FileSplit.
    FileSplit fileSplit = (FileSplit) genericSplit;
    // Create the JsonParser.
    jsonParser = new JsonParser();
    // Initialize the LineRecordReader.
    lineReader = new LineRecordReader();
    lineReader.initialize(fileSplit, context);
  }
1254468
public static File toJsonFile(String jsonString, File returnJsonFile) {
        try {
            jsonMapper.writeValue(returnJsonFile, jsonString);
            return returnJsonFile;
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "toJsonFile", jsonString);
        }
    }
106141
private void init(JSONTokener x) {
		char c;
		String key;

		if (x.nextClean() != '{') {
			throw x.syntaxError("A JSONObject text must begin with '{'");
		}
		for (;;) {
			c = x.nextClean();
			switch (c) {
			case 0:
				throw x.syntaxError("A JSONObject text must end with '}'");
			case '}':
				return;
			default:
				x.back();
				key = x.nextValue().toString();
			}

			// The key is followed by ':'.

			c = x.nextClean();
			if (c != ':') {
				throw x.syntaxError("Expected a ':' after a key");
			}
			this.putOnce(key, x.nextValue());

			// Pairs are separated by ','.

			switch (x.nextClean()) {
			case ';':
			case ',':
				if (x.nextClean() == '}') {
					return;
				}
				x.back();
				break;
			case '}':
				return;
			default:
				throw x.syntaxError("Expected a ',' or '}'");
			}
		}
	}
1252483
public void initialize(URI name, Configuration conf) throws IOException {
    // if an underlying fs has not already been specified,
    // create and initialize one
    if (this.fs == null) {
      Class<?> clazz = conf.getClass("fs.apitrace.underlyingfs.impl",
                                     DistributedFileSystem.class);
      if (clazz == null) {
        throw new IOException("No FileSystem for fs.apitrace.underlyingfs.impl.");
      }

      this.fs = (FileSystem)ReflectionUtils.newInstance(clazz, null);
      super.initialize(name, conf);
    }

    // trace conf options
    for (String opt : traceConfOpts) {
      APITrace.CallEvent ce = new APITrace.CallEvent();
      ce.logCall(APITrace.COMMENT_msg, null,
                 new Object[] {opt, conf.get(opt, "")});
    }
  }
913510
private void init(JSONTokener x) {
		if (x.nextClean() != '[') {
			throw x.syntaxError("A JSONArray text must start with '['");
		}
		if (x.nextClean() != ']') {
			x.back();
			for (;;) {
				if (x.nextClean() == ',') {
					x.back();
					this.rawList.add(JSONNull.NULL);
				} else {
					x.back();
					this.rawList.add(x.nextValue());
				}
				switch (x.nextClean()) {
				case ',':
					if (x.nextClean() == ']') {
						return;
					}
					x.back();
					break;
				case ']':
					return;
				default:
					throw x.syntaxError("Expected a ',' or ']'");
				}
			}
		}
	}
1016101
@Override
  public void initialize() {
    TreeIndexHeader header = createHeader();
    if(this.file.initialize(header)) {
      initializeFromFile(header, file);
    }
    rootEntry = createRootEntry();
  }
774012
private void init(Object object) throws JSONException{
		if (object instanceof CharSequence) {
			// JSON字符串
			init((CharSequence) object);
		} else {
			Iterator<?> iter;
			if (object.getClass().isArray()) {// 数组
				iter = new ArrayIter<>(object);
			} else if (object instanceof Iterator<?>) {// Iterator
				iter = ((Iterator<?>) object);
			} else if (object instanceof Iterable<?>) {// Iterable
				iter = ((Iterable<?>) object).iterator();
			} else {
				throw new JSONException("JSONArray initial value should be a string or collection or array.");
			}
			while (iter.hasNext()) {
				this.add(iter.next());
			}
		}
	}
598847
public void setJsonPath(URL url) throws IOException {
        String path = url.toString();
        if (path.startsWith(ValueConsts.LOCAL_FILE_URL)) {
            setJsonPath(NetUtils.urlToString(url));
        } else {
            setJsonObject(FileExecutor.read(url));
        }
    }
687779
public void index(String indexName, String indexType, String... json) {
        index(
                Arrays.stream(json)
                        .map(item -> new IndexRequest.IndexRequestBuilder(indexName, indexType, item).build())
                        .collect(toList())
        );
    }