Initializes repository (reads file, or remote address).
494368
protected function initialize()
    {
        parent::initialize();

        if (!$this->file->exists()) {
            return;
        }

        try {
            $packages = $this->file->read();

            if (!is_array($packages)) {
                throw new \UnexpectedValueException('Could not parse package list from the repository');
            }
        } catch (\Exception $e) {
            throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
        }

        $loader = new ArrayLoader(null, true);
        foreach ($packages as $packageData) {
            $package = $loader->load($packageData);
            $this->addPackage($package);
        }
    }
909356
def init(ctx, client, directory, name, force, use_external_storage):
    """"""
    if not client.use_external_storage:
        use_external_storage = False

    ctx.obj = client = attr.evolve(
        client,
        path=directory,
        use_external_storage=use_external_storage,
    )

    msg = 'Initialized empty project in {path}'
    branch_name = None

    stack = contextlib.ExitStack()

    if force and client.repo:
        msg = 'Initialized project in {path} (branch {branch_name})'
        merge_args = ['--no-ff', '-s', 'recursive', '-X', 'ours']

        try:
            commit = client.find_previous_commit(
                str(client.renku_metadata_path),
            )
            branch_name = 'renku/init/' + str(commit)
        except KeyError:
            from git import NULL_TREE
            commit = NULL_TREE
            branch_name = 'renku/init/root'
            merge_args.append('--allow-unrelated-histories')

        ctx.obj = client = stack.enter_context(
            client.worktree(
                branch_name=branch_name,
                commit=commit,
                merge_args=merge_args,
            )
        )

    try:
        with client.lock:
            path = client.init_repository(name=name, force=force)
    except FileExistsError:
        raise click.UsageError(
            'Renku repository is not empty. '
            'Please use --force flag to use the directory as Renku '
            'repository.'
        )

    stack.enter_context(client.commit())

    with stack:
        # Install Git hooks.
        from .githooks import install
        ctx.invoke(install, force=force)

        # Create all necessary template files.
        from .runner import template
        ctx.invoke(template, force=force)

    click.echo(msg.format(path=path, branch_name=branch_name))
710049
private void initializePropertyReader()
    {
        if (propertyReader == null)
        {
            propertyReader = new KuduDBPropertyReader(externalProperties,
                    kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(getPersistenceUnit()));
            propertyReader.read(getPersistenceUnit());
        }
    }
364458
public void init(boolean isSecure,
                   CharSequence host, int port,
                   byte []uri, int uriLength)
  {
    _isSecure = isSecure;
    
    _host = host;
    _port = port;
    
    _uri = uri;
    _uriLength = uriLength;
  }
183822
def initialize(self, request):
        """"""
        if request.method == 'GET':
            # PDT only - this data is currently unused
            self.query = request.META.get('QUERY_STRING', '')
        elif request.method == 'POST':
            # The following works if paypal sends an ASCII bytestring, which it does.
            self.query = request.body.decode('ascii')
        self.ipaddress = request.META.get('REMOTE_ADDR', '')
213174
private void init() {
        curDirectory = new File(Environment.getExternalStorageDirectory().getPath());
        currentFile = new File(curDirectory.getPath());
        lastDirectory = curDirectory.getParentFile();

        if (curDirectory.isDirectory()) {
            new UpdateFilesTask(this).execute(curDirectory);
        } else {
            try {
                throw new Exception(getString(R.string.file_picker_directory_error));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
1137148
@Override
	public void init() {

		RepositoryConfigurationExtension extension = new SolrRepositoryConfigExtension();
		RepositoryBeanDefinitionParser parser = new RepositoryBeanDefinitionParser(extension);

		registerBeanDefinitionParser("repositories", parser);
		registerBeanDefinitionParser("embedded-solr-server", new EmbeddedSolrServerBeanDefinitionParser());
		registerBeanDefinitionParser("solr-client", new HttpSolrClientBeanDefinitionParser());
	}
385115
def initialize_repo(self):
        

        logging.info('Repo {} doesn\'t exist. Cloning...'.format(self.repo_dir))
        clone_args = ['git', 'clone']
        if self.depth and self.depth > 0:
            clone_args.extend(['--depth', str(self.depth)])
        clone_args.extend(['--branch', self.branch_name])
        clone_args.extend([self.git_url, self.repo_dir])
        yield from execute_cmd(clone_args)
        yield from execute_cmd(['git', 'config', 'user.email', 'nbgitpuller@example.com'], cwd=self.repo_dir)
        yield from execute_cmd(['git', 'config', 'user.name', 'nbgitpuller'], cwd=self.repo_dir)
        logging.info('Repo {} initialized'.format(self.repo_dir))
1372346
private void initClonedRepository() throws GitAPIException, IOException {
		if (!getUri().startsWith(FILE_URI_PREFIX)) {
			deleteBaseDirIfExists();
			Git git = cloneToBasedir();
			if (git != null) {
				git.close();
			}
			git = openGitRepository();
			if (git != null) {
				git.close();
			}
		}

	}
1345788
public function setRepositoryPath($repository_path, $createNew = false, $_init = true)
    {
        if (is_string($repository_path)) {
            if ($new_path = realpath($repository_path)) {
                $repository_path = $new_path;
                if (is_dir($repository_path)) {
                    if (file_exists($repository_path."/.git") && is_dir($repository_path."/.git")) {
                        $this->repository_path = $repository_path;
                    } else {
                        if ($createNew) {
                            $this->repository_path = $repository_path;
                            if ($_init) {
                                $this->run('init');
                            }
                        } else {
                            throw new \Exception(
                                sprintf('"%s" is not a git repository!', $repository_path)
                            );
                        }
                    }
                } else {
                    throw new \Exception(
                        sprintf('"%s" is not a directory', $repository_path)
                    );
                }
            } else {
                if ($createNew) {
                    if ($parent = realpath(dirname($repository_path))) {
                        mkdir($repository_path);
                        $this->repository_path = $repository_path;
                        if ($_init) {
                            $this->run('init');
                        }
                    } else {
                        throw new \Exception('Cannot create repository in non-existent directory');
                    }
                } else {
                    throw new \Exception(
                        sprintf('"%s" does not exist', $repository_path)
                    );
                }
            }
        }
    }
1175877
public void addRemoteRepository(RemoteRepository remoteRepository) {
        if (this.repositoryIds.add(remoteRepository.getId()) ) {
            getRemoteRepositories().add(remoteRepository);
        }
    }
1256101
public void start() {
        if (state == State.RUNNING) return;
        final Lock lock = this.lock.writeLock();
        try {
            lock.lock();
            this.state = State.STARTING;

            // Create an executor service that we'll use to start the repositories ...
            ThreadFactory threadFactory = new NamedThreadFactory("modeshape-start-repo");
            repositoryStarterService = Executors.newCachedThreadPool(threadFactory);

            state = State.RUNNING;
        } catch (RuntimeException e) {
            state = State.NOT_RUNNING;
            throw e;
        } finally {
            lock.unlock();
        }
    }
181567
public function initialize($url, $user = null, $password = null)
    {
        if (!is_file($url) || !is_readable($url)) {
            throw new \RuntimeException("Cannot initialize repository from $url");
        }

        // Try to extract given zip archive
        $archive = new \ZipArchive();
        $return  = $archive->open($url);
        if ($return !== true) {
            throw new \RuntimeException($url, $return);
        }

        // Extract, if archive has been opened successfully
        $archive->extractTo($this->root);

        // Move all files from the repository root to the checkout root.
        $root  = $this->findRepositoryRoot($archive);
        $files = glob($this->root . '/' . $root . '*');
        foreach ($files as $file) {
            rename($file, $this->root . '/' . basename($file));
        }
        rmdir($this->root . '/' . $root);

        // Finished Zip extraction
        $archive->close();
    }
828719
private static void initRepositoryDefinitions() throws JSONException {
        final JSONObject jsonObject = Repositories.getRepositoriesDescription();
        if (null == jsonObject) {
            LOGGER.warn("Loads repository description [repository.json] failed");

            return;
        }

        repositoryDefinitions = new ArrayList<>();
        final JSONArray repositoritArray = jsonObject.getJSONArray(REPOSITORIES);
        JSONObject repositoryObject;
        JSONObject keyObject;
        for (int i = 0; i < repositoritArray.length(); i++) {
            repositoryObject = repositoritArray.getJSONObject(i);

            final RepositoryDefinition repositoryDefinition = new RepositoryDefinition();
            repositoryDefinitions.add(repositoryDefinition);
            repositoryDefinition.setName(repositoryObject.getString(NAME));
            repositoryDefinition.setDescription(repositoryObject.optString(DESCRIPTION));
            final List<FieldDefinition> keys = new ArrayList<>();
            repositoryDefinition.setKeys(keys);
            final JSONArray keysJsonArray = repositoryObject.getJSONArray(KEYS);
            FieldDefinition definition;
            for (int j = 0; j < keysJsonArray.length(); j++) {
                keyObject = keysJsonArray.getJSONObject(j);
                definition = fillFieldDefinitionData(keyObject);
                keys.add(definition);
            }
            repositoryDefinition.setCharset(repositoryObject.optString(CHARSET));
            repositoryDefinition.setCollate(repositoryObject.optString(COLLATE));
        }
    }
922051
public ConnectionRepository readConnectionRepository(String fileName)
    {
        try
        {
            RepositoryPersistor persistor = new RepositoryPersistor();
            return persistor.readConnectionRepository(fileName);
        }
        catch (Exception e)
        {
            throw new MetadataException("Can not read repository " + fileName, e);
        }
    }
1283334
@Override
    public void initialize(Map<String, Object> puProperties)
    {
        reader = new KuduDBEntityReader(kunderaMetadata);
        setExternalProperties(puProperties);
        initializePropertyReader();
        PersistenceUnitMetadata pum = kunderaMetadata.getApplicationMetadata()
                .getPersistenceUnitMetadata(getPersistenceUnit());

        Properties pumProps = pum.getProperties();

        if (puProperties != null)
        {
            pumProps.putAll(puProperties);
        }

        String kuduMasterHost = (String) pumProps.getProperty("kundera.nodes");

        String kuduMasterPort = (String) pumProps.getProperty("kundera.port");

        if (kuduMasterHost == null || kuduMasterPort == null)
        {
            throw new KunderaException("Hostname/IP or Port is null.");
        }

        kuduClient = new KuduClient.KuduClientBuilder(kuduMasterHost + ":" + kuduMasterPort).build();
    }
427470
@Override
    public void init() throws ServletException {

        String fedoraHome = Constants.FEDORA_HOME;

        if (fedoraHome == null || fedoraHome.length() == 0) {
            throw new ServletException("FEDORA_HOME is not defined");
        } else {
            _serverDir = new File(new File(fedoraHome), "server");
            if (!_serverDir.isDirectory()) {
                throw new ServletException("No such directory: "
                        + _serverDir.getPath());
            }
        }

    }