Initializing method.

@return
@throws Exception
347484
public AbstractQueue<ID, DATA> init() throws Exception {
        if (observer != null) {
            observer.preInit(this);
        }
        try {
            return this;
        } finally {
            if (observer != null) {
                observer.postInit(this);
            }
        }
    }
662241
private void init() throws Exception {
        this.useCertAuth = (((Boolean) props.get(USE_CERTIFICATE_AUTHENTICATION)) == null) ? false : (Boolean) props.get(USE_CERTIFICATE_AUTHENTICATION);

        ClassLoader loader = libraryRef.getServiceWithException().getClassLoader();

        // Lazy initialization for version 2.x of the Mongo Java driver.

        boolean sslEnabled = (((Boolean) props.get(SSL_ENABLED)) == null) ? false : (Boolean) props.get(SSL_ENABLED);

        assertLibrary(loader, sslEnabled);
        assertValidSSLConfig();

        // Initialize List<ServerAddress>
        List<Object> serverAddresses = new LinkedList<Object>();
        Constructor<?> ServerAddress_constructor = loader.loadClass("com.mongodb.ServerAddress").getConstructor(String.class, int.class);
        String[] hosts = (String[]) props.get(HOST_NAMES);
        int[] ports = (int[]) props.get(PORTS);
        int numServerAddresses = hosts.length;
        if (hosts.length != ports.length) {
            IllegalArgumentException failure = ignoreWarnOrFail(null, IllegalArgumentException.class, "CWKKD0011.hosts.ports.mismatch",
                                                                MONGO, id, hosts.length, ports.length);
            if (failure == null) // tolerate the error and keep going
                numServerAddresses = hosts.length < ports.length ? hosts.length : ports.length;
            else
                throw failure;
        }

        //Initialise URI. Only used when constructing mongo with the default SSL turned on.
        StringBuilder uriBuilder = new StringBuilder();
        uriBuilder.append("mongodb://");
        for (int i = 0; i < numServerAddresses; i++) {
            serverAddresses.add(ServerAddress_constructor.newInstance(hosts[i], ports[i]));
            //Add server addresses to URI
            uriBuilder.append(hosts[i] + ":" + ports[i]);
            if (i != numServerAddresses - 1) {
                uriBuilder.append(",");
            }
        }

        // Initialize MongoOptions
        Class<?> MongoClientOptions = loader.loadClass("com.mongodb.MongoClientOptions");
        Class<?> MongoClientOptions_Builder = loader.loadClass("com.mongodb.MongoClientOptions$Builder");

        Object optionsBuilder = MongoClientOptions_Builder.newInstance();
        for (Map.Entry<String, Object> prop : props.entrySet()) {
            String name = prop.getKey();
            Object value = prop.getValue();
            if (value != null && name.indexOf('.') < 0 && !NOT_MONGO_CLIENT_OPTIONS.contains(name))
                set(MongoClientOptions_Builder, optionsBuilder, name, value);
        }

        String value = (String) props.get(READ_PREFERENCE);
        if (value != null) {
            setReadPreference(MongoClientOptions_Builder, optionsBuilder, value);
        }
        value = (String) props.get(WRITE_CONCERN);
        if (value != null) {
            setWriteConcern(MongoClientOptions_Builder, optionsBuilder, value);
        }

        //SSL setup
        boolean sslRefExists = props.containsKey(SSL_REF);
        Properties sslProperties = null;
        if (sslEnabled) {
            Map<String, Object> connectionInfo = getConnectionInfo();
            setSocketFactory(MongoClientOptions_Builder, optionsBuilder, connectionInfo);
            sslProperties = sslHelper.getSSLProperties(sslConfigurationRef.getService(), connectionInfo, this);
        }
        // Initialize the Mongo instance
        Class<?> MongoClient = loader.loadClass(com_mongodb_MongoClient);
        Class<?> MongoClientURI = loader.loadClass("com.mongodb.MongoClientURI");
        if (sslEnabled && !sslRefExists && !useCertAuth) {
            // TODO check if this is still needed as we are setting the socket factory above
            uriBuilder.append("/?ssl=true");
            String uri = uriBuilder.toString();
            Constructor<?> MongoClientURI_constructor = MongoClientURI.getConstructor(String.class, MongoClientOptions_Builder);
            Object uriObject = MongoClientURI_constructor.newInstance(uri, optionsBuilder);
            Constructor<?> MongoClient_constructor = MongoClient.getConstructor(MongoClientURI);
            mongoClient = MongoClient_constructor.newInstance(uriObject);

        } else if (sslEnabled && useCertAuth) {
            // get the name from the certificate and handle exceptions / null
            String certificateDN = getCerticateSubject(keyStoreServiceRef, sslProperties);

            // Create an x509 credential calling the MongoCredential class reflectively passing the DN
            Class<?> MongoCredential = loader.loadClass("com.mongodb.MongoCredential");
            Method MongoCredential_createCertificate = MongoCredential.getMethod("createMongoX509Credential", String.class);
            Object credential = MongoCredential_createCertificate.invoke(null, certificateDN);

            // create a client authenticated using this credential
            Constructor<?> MongoClient_constructor = MongoClient.getConstructor(List.class, List.class, MongoClientOptions);
            Object mongoClientOptions = MongoClientOptions_Builder.getMethod("build").invoke(optionsBuilder);
            mongoClient = MongoClient_constructor.newInstance(serverAddresses, Arrays.asList(credential), mongoClientOptions);
        } else {
            Constructor<?> MongoClient_constructor = MongoClient.getConstructor(List.class, MongoClientOptions);
            Object mongoClientOptions = MongoClientOptions_Builder.getMethod("build").invoke(optionsBuilder);
            mongoClient = MongoClient_constructor.newInstance(serverAddresses, mongoClientOptions);
        }

        // Methods that we need each each time a DB instance is created
        MongoClient_getDB = MongoClient.getMethod("getDB", String.class);
        Class<?> DB = loader.loadClass("com.mongodb.DB");
        DB_authenticate = DB.getMethod("authenticate", String.class, char[].class);
        DB_isAuthenticated = DB.getMethod("isAuthenticated");
    }
341289
@Override
  public void initialize() {

    loadHelpers = new LinkedList<ClassLoadHelper>();

    loadHelpers.add(new LoadingLoaderClassLoadHelper());
    loadHelpers.add(new SimpleClassLoadHelper());
    loadHelpers.add(new ThreadContextClassLoadHelper());
    loadHelpers.add(new InitThreadContextClassLoadHelper());

    for (ClassLoadHelper loadHelper : loadHelpers) {
      loadHelper.initialize();
    }
  }
245019
@SuppressWarnings("UnusedDeclaration")
    public void init() throws Exception {
        initBuilderSpecific();
        resetFields();
        if (!UserPluginInfo.NO_PLUGIN_KEY.equals(getSelectedStagingPluginName())) {
            PluginSettings selectedStagingPluginSettings = getSelectedStagingPlugin();
            try {
                stagingStrategy = getArtifactoryServer().getStagingStrategy(selectedStagingPluginSettings, Util.rawEncode(project.getName()), project);
            } catch (Exception e) {
                log.log(Level.WARNING, "Failed to obtain staging strategy: " + e.getMessage(), e);
                strategyRequestFailed = true;
                strategyRequestErrorMessage = "Failed to obtain staging strategy '" +
                        selectedStagingPluginSettings.getPluginName() + "': " + e.getMessage() +
                        ".\nPlease review the log for further information.";
                stagingStrategy = null;
            }
            strategyPluginExists = (stagingStrategy != null) && !stagingStrategy.isEmpty();
        }

        prepareDefaultVersioning();
        prepareDefaultGlobalModule();
        prepareDefaultModules();
        prepareDefaultVcsSettings();
        prepareDefaultPromotionConfig();
    }
1182271
private void initTemplates() throws Exception {
        if (templates != null && templates.length > 0) {
            for (String template : templates) {
                Assert.hasText(template, "Can not read template in ["
                        + template
                        + "]. Check that templates is not empty.");
                createTemplate(client.getLowLevelClient(), classpathRoot, template, forceTemplate);
            }
        }
    }
1325800
public login login() throws Exception
	{
		login login_obj = new login();
		login_obj.set_username(this.user_name);
		login_obj.set_password(this.password);
		login_obj.set_session_timeout(this.timeout);
		
		login result = login.add(this, login_obj);
		sessionid = result.get_sessionid();
		
		return result;
	}
421872
public void init() throws Exception {
        userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
        System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());

        if (!cfg.exists()) {

            ConfigurationManager manager = new ConfigurationManager(cfg, false, locateConfigurationProvider());

            try {

                manager.runProjectConfigurationInitializers();

                if (options.isVerbose()) {
                    log.info("CONFIGURATION FILE [" + cfg.getAbsolutePath() + "] CREATION COMPLETE");
                }

            } catch (IOException aux) {
                if (options.isVerbose()) {
                    log.error("The system can't create the file [ " + cfg.getAbsolutePath() + "]");
                }
                if (options.isThrowException()) {
                    System.setProperty("user.dir", userDir);
                    throw aux;
                }
            }

        } else {
            if (options.isVerbose()) {
                log.error("The configuration file [" + cfg.getAbsolutePath() + "] already exists");
            }
        }
        System.setProperty("user.dir", userDir);
    }
371819
@Override
    public void initialize() {
        this.fileAlterationObserver = new FileAlterationObserver(directory, fileFilter);
        this.fileAlterationObserver.addListener(this);
        try {
            this.fileAlterationObserver.initialize();
        } catch (Exception e) {
        }
    }
320012
public RocksDbQueue<ID, DATA> init() throws Exception {
        File STORAGE_DIR = new File(storageDir);
        LOGGER.info("Storage Directory: " + STORAGE_DIR.getAbsolutePath());
        try {
            FileUtils.forceMkdir(STORAGE_DIR);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        try {
            batchPutToQueue = new WriteBatch();
            batchTake = new WriteBatch();

            dbOptions = RocksDbUtils.buildDbOptions();
            rocksDbWrapper = RocksDbWrapper.openReadWrite(STORAGE_DIR, dbOptions, null, null,
                    new String[] { cfNameEphemeral, cfNameMetadata, cfNameQueue });
            readOptions = rocksDbWrapper.getReadOptions();
            writeOptions = rocksDbWrapper.getWriteOptions();

            cfEphemeral = rocksDbWrapper.getColumnFamilyHandle(cfNameEphemeral);
            cfMetadata = rocksDbWrapper.getColumnFamilyHandle(cfNameMetadata);
            cfQueue = rocksDbWrapper.getColumnFamilyHandle(cfNameQueue);

            itQueue = rocksDbWrapper.getIterator(cfNameQueue);
            itEphemeral = rocksDbWrapper.getIterator(cfNameEphemeral);
            lastFetchedId = loadLastFetchedId();
        } catch (Exception e) {
            destroy();
            throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
        }

        super.init();

        return this;
    }
1069358
public static void initializeFips() throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "initializeFips");

        if (!fipsInitialized) {
            int ibmjcefips_position = 0;
            Provider[] provider_list = null;
            Provider ibmjcefips = null;
            Provider sun = null;

            try {
                System.setProperty("com.ibm.jsse2.JSSEFIPS", "true");
                provider_list = Security.getProviders();

                for (int i = 0; i < provider_list.length; i++) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                        Tr.debug(tc, "Provider[" + i + "]: " + provider_list[i].getName());
                    if (provider_list[i].getName().equals("IBMJCEFIPS")) {
                        ibmjcefips_position = i;
                        ibmjcefips = provider_list[i];
                    } else if (provider_list[i].getName().equals("SUN")) {
                        sun = provider_list[i];
                    }
                }

                if (ibmjcefips == null) {
                    provider_list = Security.getProviders();

                    try {
                        ibmjcefips = (Provider) Class.forName(Constants.IBMJCEFIPS).newInstance();

                        if (sun != null) {
                            insertProviderAt(sun, 1);
                            insertProviderAt(ibmjcefips, 2);
                        } else {
                            insertProviderAt(ibmjcefips, 1);
                        }
                    } catch (Exception e) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                            Tr.debug(tc, "Exception loading provider: " + Constants.IBMJCEFIPS + "; " + e);
                    }
                } else if (ibmjcefips_position != 0) {
                    // it's there but not the first, let's reorder it.
                    provider_list = Security.getProviders();

                    if (sun != null) {
                        insertProviderAt(sun, 1);
                        insertProviderAt(ibmjcefips, 2);
                    } else {
                        insertProviderAt(ibmjcefips, 1);
                    }
                }

                provider_list = Security.getProviders();

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    for (int i = 0; i < provider_list.length; i++) {
                        Tr.debug(tc, "Provider[" + i + "]: " + provider_list[i].getName() + ", info: " + provider_list[i].getInfo());
                    }
                }

                fipsInitialized = true;
            } catch (Exception e) {
                Tr.error(tc, "security.addprovider.error", new Object[] { e });
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "Exception caught adding IBMJCEFIPS provider.", new Object[] { e });
                throw e;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "initializeFips");
    }
46995
public void init(Configuration configuration)
			throws Exception
	{
		String baseName = configuration.getBootstrapPropertyResolver().getProperty("ResourceBundleFactory.Bundle");
		if (baseName != null)
		{
			this.baseName = baseName;
		}
	}
95861
protected function initializeTargets()
    {
        foreach ($this->settings['targets'] as $targetName => $targetDefinition) {
            if (!isset($targetDefinition['target'])) {
                throw new Exception(sprintf('The configuration for the resource target "%s" defined in your settings has no valid "target" option. Please check the configuration syntax and make sure to specify a valid target class name.', $targetName), 1361467838);
            }
            if (!class_exists($targetDefinition['target'])) {
                throw new Exception(sprintf('The configuration for the resource target "%s" defined in your settings has not defined a valid "target" option. Please check the configuration syntax and make sure that the specified class "%s" really exists.', $targetName, $targetDefinition['target']), 1361467839);
            }
            $options = (isset($targetDefinition['targetOptions']) ? $targetDefinition['targetOptions'] : []);
            $this->targets[$targetName] = new $targetDefinition['target']($targetName, $options);
        }
    }
1110332
protected function initialize() {
	$request   = bootstrap::get_library('request');
	$response  = bootstrap::get_library('response');
	$exception = bootstrap::get_library('exception');
	
	$this->url    = $request::get_url();
	$this->method = $request::get_method();
	
	if (empty($this->method)) {
		throw new $exception('unknown http method', $response::STATUS_METHOD_NOT_ALLOWED);
	}
}
1280951
@PostConstruct
    public void init() throws Exception
    {
        long startTime = System.currentTimeMillis();
        
        filterLoader.putFiltersForClasses(config.getClassNames());
        manageFiles();
        startPoller();
        
        LOG.warn("Finished loading all zuul filters. Duration = " + (System.currentTimeMillis() - startTime) + " ms.");
    }
444754
public static synchronized void init ()
    {
        // only initialize ourselves once
        if (_keys != null) {
            return;
        } else {
            _keys = new ArrayList<Class<?>>();
            _values = new ArrayList<String>();
        }

        // first try loading the properties file without a leading slash
        ClassLoader cld = ExceptionMap.class.getClassLoader();
        InputStream config = ConfigUtil.getStream(PROPS_NAME, cld);
        if (config == null) {
            log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH.");

        } else {
            // otherwise process ye old config file.
            try {
                // we'll do some serious jiggery pokery to leverage the parsing
                // implementation provided by java.util.Properties. god bless
                // method overloading
                final ArrayList<String> classes = new ArrayList<String>();
                Properties loader = new Properties() {
                    @Override public Object put (Object key, Object value) {
                        classes.add((String)key);
                        _values.add((String)value);
                        return key;
                    }
                };
                loader.load(config);

                // now cruise through and resolve the exceptions named as
                // keys and throw out any that don't appear to exist
                for (int i = 0; i < classes.size(); i++) {
                    String exclass = classes.get(i);
                    try {
                        Class<?> cl = Class.forName(exclass);
                        // replace the string with the class object
                        _keys.add(cl);

                    } catch (Throwable t) {
                        log.warning("Unable to resolve exception class.", "class", exclass,
                                    "error", t);
                        _values.remove(i);
                        i--; // back on up a notch
                    }
                }

            } catch (IOException ioe) {
                log.warning("Error reading exception mapping file: " + ioe);
            }
        }
    }
1105866
private static void initialize() throws AsyncException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "initialize");
        }

        capabilities = aio_init(MAX_IDENTIFIERS, AsyncException.class);
        aioInitialized = AIO_INITIALIZED;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "initialize: " + capabilities);
        }
    }
695664
private void initMappings() throws Exception {
        checkClient();
        // We extract indexes and mappings to manage from mappings definition
        if (mappings != null && mappings.length > 0) {
            Map<String, Collection<String>> indices = getIndexMappings(mappings);

            // Let's initialize indexes and mappings if needed
            for (String index : indices.keySet()) {
                createIndex(client.getLowLevelClient(), classpathRoot, index, forceMapping);
                if (mergeSettings) {
                    updateSettings(client.getLowLevelClient(), classpathRoot, index);
                }

                createMapping(client, classpathRoot, index, mergeMapping);
            }
        }
    }