Installs the ZooKeeper discovery bundles and instantiates components
323130
def discovery_zookeeper(self):
        
        # Install the bundle
        self.context.install_bundle("pelix.remote.discovery.zookeeper").start()

        with use_waiting_list(self.context) as ipopo:
            # Instantiate the discovery
            ipopo.add(
                rs.FACTORY_DISCOVERY_ZOOKEEPER,
                "pelix-discovery-zookeeper",
                {
                    "application.id": "sample.rs",
                    "zookeeper.hosts": self.arguments.zk_hosts,
                    "zookeeper.prefix": self.arguments.zk_prefix,
                },
            )
1291463
def setup(app):
    

    for name, (default, rebuild, _) in ref.CONFIG_VALUES.iteritems():
        app.add_config_value(name, default, rebuild)

    app.add_directive('javaimport', ref.JavarefImportDirective)
    app.add_role('javaref', ref.JavarefRole(app))

    app.connect('builder-inited', initialize_env)
    app.connect('env-purge-doc', ref.purge_imports)
    app.connect('env-merge-info', ref.merge_imports)
    app.connect('build-finished', ref.cleanup)
137073
@Route(method = HttpMethod.POST, uri = "")
    public Result installBundle(@FormParameter("bundle") final FileItem bundle,
                                @FormParameter("start") @DefaultValue("false") final boolean startIfNeeded) {
        if (bundle != null) {
            return async(new Callable<Result>() {
                @Override
                public Result call() throws Exception {
                    Bundle b;

                    try {
                        b = context.installBundle("file/temp/" + bundle.name(), bundle.stream());
                        logger().info("Bundle {} installed", b.getSymbolicName());
                    } catch (BundleException e) {
                        flash("error", "Cannot install bundle '" + bundle.name() + "' : "
                                + e.getMessage());
                        return bundle();
                    }

                    if (startIfNeeded  && ! isFragment(b)) {
                        try {
                            b.start();
                            flash("success", "Bundle '" + b.getSymbolicName() + "' installed and started");
                            return bundle();
                        } catch (BundleException e) {
                            flash("error", "Bundle '" + b.getSymbolicName() + "' installed but " +
                                    "failed to start: " + e.getMessage());
                            return bundle();
                        }
                    } else {
                        flash("success", "Bundle '" + b.getSymbolicName() + "' installed.");
                        return bundle();
                    }
                }
            });
        } else {
            logger().error("No bundle to install");
            flash("error", "Unable to install the bundle - no uploaded file");
            return bundle();
        }
    }
1353954
private void initResourceBundles(List<JoinableResourceBundle> resourceBundles)
			throws DuplicateBundlePathException, BundleDependencyException {

		// Create custom defined bundles
		bundleDefinitionsWithDependencies = new HashSet<>();
		if (null != bundleDefinitions) {
			if (LOGGER.isInfoEnabled())
				LOGGER.info("Adding custom bundle definitions. ");
			for (ResourceBundleDefinition def : bundleDefinitions) {
				// If this is a composite bundle
				if (def.isComposite()) {
					resourceBundles.add(buildCompositeResourcebundle(def));
				} else
					resourceBundles.add(buildResourcebundle(def));
			}
		}

		// Normalize the base Dir if needed
		if (!jawrConfig.getGeneratorRegistry().isPathGenerated(baseDir)) {
			this.baseDir = PathNormalizer.asDirPath(baseDir);
		}

		// Use the dirmapper if specified
		if (useDirMapperFactory) {
			if (LOGGER.isInfoEnabled())
				LOGGER.info("Using ResourceBundleDirMapper. ");

			ResourceBundleDirMapper dirFactory = new ResourceBundleDirMapper(baseDir, resourceReaderHandler,
					resourceBundles, fileExtension, excludedDirMapperDirs);
			Map<String, String> mappings = dirFactory.getBundleMapping();
			for (Entry<String, String> entry : mappings.entrySet()) {
				resourceBundles.add(buildDirMappedResourceBundle(entry.getKey(), entry.getValue()));
			}
		}

		if (this.scanForOrphans) {
			// Add all orphan bundles
			OrphanResourceBundlesMapper orphanFactory = new OrphanResourceBundlesMapper(baseDir, resourceReaderHandler,
					jawrConfig.getGeneratorRegistry(), resourceBundles, fileExtension);
			List<String> orphans = orphanFactory.getOrphansList();

			// Orphans may be added separately or as one single resource bundle.
			if (useSingleResourceFactory) {
				// Add extension to the filename
				if (!singleFileBundleName.endsWith(fileExtension))
					singleFileBundleName += fileExtension;

				if (LOGGER.isInfoEnabled())
					LOGGER.info("Building bundle of orphan resources with the name: " + singleFileBundleName);

				resourceBundles.add(buildOrphansResourceBundle(singleFileBundleName, orphans));

			} else {
				if (LOGGER.isInfoEnabled())
					LOGGER.info("Creating mappings for orphan resources. ");
				for (Iterator<String> it = orphans.iterator(); it.hasNext();) {
					resourceBundles.add(buildOrphanResourceBundle(it.next()));
				}
			}
		} else if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("Skipping orphan file auto processing. ");
			if ("".equals(jawrConfig.getServletMapping()))
				LOGGER.debug("Note that there is no specified mapping for Jawr "
						+ "(it has been seet to serve *.js or *.css requests). "
						+ "The orphan files will become unreachable through the server.");
		}

		// Initialize bundle dependencies
		for (ResourceBundleDefinition definition : bundleDefinitionsWithDependencies) {
			JoinableResourceBundle bundle = getBundleFromName(definition.getBundleName(), resourceBundles);
			if (bundle != null) {
				bundle.setDependencies(getBundleDependencies(definition, resourceBundles));
			}
		}
	}
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());
	}
1081175
void setupBundles() {

        Locale oldLocale;

        synchronized (BundleHandler.class) {
            oldLocale = BundleHandler.getLocale();

            BundleHandler.setLocale(Locale.getDefault());

            hnd_column_remarks =
                BundleHandler.getBundleHandle("column-remarks", null);
            hnd_table_remarks = BundleHandler.getBundleHandle("table-remarks",
                    null);

            BundleHandler.setLocale(oldLocale);
        }
    }
1006207
def add_bundled_jars():
    
    # determine lib directory with jars
    rootdir = os.path.split(os.path.dirname(__file__))[0]
    libdir = rootdir + os.sep + "lib"

    # add jars from lib directory
    for l in glob.glob(libdir + os.sep + "*.jar"):
        if l.lower().find("-src.") == -1:
            javabridge.JARS.append(str(l))
1026485
public ZooKeeperUpdatingListener build() {
        final boolean internalClient;
        if (client == null) {
            client = CuratorFrameworkFactory.builder()
                                            .connectString(connectionStr)
                                            .retryPolicy(ZooKeeperDefaults.DEFAULT_RETRY_POLICY)
                                            .connectionTimeoutMs(connectTimeoutMillis)
                                            .sessionTimeoutMs(sessionTimeoutMillis)
                                            .build();
            internalClient = true;
        } else {
            internalClient = false;
        }

        return new ZooKeeperUpdatingListener(client, zNodePath, nodeValueCodec, endpoint, internalClient);
    }
421247
public void setup() {
        JadeAgentIntrospector.getMyInstance(this);
        LogActivator.logToFile(logger, this.getName(), Level.ALL);
        this.template = MessageTemplate.MatchAll();
        addBehaviour(new RequestServer());
    }
36149
private void installModules(final Node node, final NetworkContext context, final Handler<AsyncResult<Void>> doneHandler) {
    List<ModuleContext> modules = new ArrayList<>();
    for (ComponentContext<?> component : context.components()) {
      if (component.isModule()) {
        modules.add(component.asModule());
      }
    }

    final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(modules.size()).setHandler(doneHandler);
    for (ModuleContext module : modules) {
      installModule(node, module, counter);
    }
  }
632419
def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
        """"""
        unnamed = list(self.unnamed_requirements)
        reqs = list(self.requirements.values())
        while reqs or unnamed:
            if unnamed:
                req_to_install = unnamed.pop(0)
            else:
                req_to_install = reqs.pop(0)
            req_version = None
            install = True
            best_installed = False
            if not self.ignore_installed and not req_to_install.editable:
                req_to_install.check_if_exists()
                if req_to_install.satisfied_by:
                    if self.upgrade:
                        if not self.force_reinstall:
                            try:
                                url, req_version = finder.find_requirement(
                                    req_to_install, self.upgrade)
                            except BestVersionAlreadyInstalled:
                                best_installed = True
                                install = False
                            else:
                                # Avoid the need to call find_requirement again
                                req_to_install.url = url.url

                        if not best_installed:
                            req_to_install.conflicts_with = req_to_install.satisfied_by
                            req_to_install.satisfied_by = None
                    else:
                        install = False
                if req_to_install.satisfied_by:
                    if best_installed:
                        logger.notify('Requirement already up-to-date: %s'
                                      % req_to_install)
                    else:
                        logger.notify('Requirement already satisfied '
                                      '(use --upgrade to upgrade): %s'
                                      % req_to_install)
            if req_to_install.editable:
                logger.notify('Obtaining %s' % req_to_install)
            elif install:
                if req_to_install.url and req_to_install.url.lower().startswith('file:'):
                    logger.notify('Unpacking %s' % display_path(url_to_path(req_to_install.url)))
                else:
                    logger.notify('Downloading/unpacking %s' % req_to_install)
            logger.indent += 2
            try:
                is_bundle = False
                if req_to_install.editable:
                    if req_to_install.source_dir is None:
                        location = req_to_install.build_location(self.src_dir)
                        req_to_install.source_dir = location
                    else:
                        location = req_to_install.source_dir
                    if not os.path.exists(self.build_dir):
                        _make_build_dir(self.build_dir)
                    req_to_install.update_editable(not self.is_download)
                    if self.is_download:
                        req_to_install.run_egg_info()
                        req_to_install.archive(self.download_dir)
                    else:
                        req_to_install.run_egg_info()
                elif install:
                    ##@@ if filesystem packages are not marked
                    ##editable in a req, a non deterministic error
                    ##occurs when the script attempts to unpack the
                    ##build directory

                    location = req_to_install.build_location(self.build_dir, not self.is_download)
                    ## FIXME: is the existance of the checkout good enough to use it?  I don't think so.
                    unpack = True
                    if not os.path.exists(os.path.join(location, 'setup.py')):
                        ## FIXME: this won't upgrade when there's an existing package unpacked in `location`
                        if req_to_install.url is None:
                            url, req_version = finder.find_requirement(req_to_install, upgrade=self.upgrade)
                        else:
                            ## FIXME: should req_to_install.url already be a link?
                            url = Link(req_to_install.url)
                            assert url
                        if url:
                            try:
                                self.unpack_url(req_to_install, req_version, url, location, self.is_download)
                            except HTTPError:
                                e = sys.exc_info()[1]
                                logger.fatal('Could not install requirement %s because of error %s'
                                             % (req_to_install, e))
                                raise InstallationError(
                                    'Could not install requirement %s because of HTTP error %s for URL %s'
                                    % (req_to_install, e, url))
                        else:
                            unpack = False
                    if unpack:
                        is_bundle = req_to_install.is_bundle
                        url = None
                        if is_bundle:
                            req_to_install.move_bundle_files(self.build_dir, self.src_dir)
                            for subreq in req_to_install.bundle_requirements():
                                reqs.append(subreq)
                                self.add_requirement(subreq)
                        elif self.is_download:
                            req_to_install.source_dir = location
                            if url and url.scheme in vcs.all_schemes:
                                req_to_install.run_egg_info()
                                req_to_install.archive(self.download_dir)
                        else:
                            req_to_install.source_dir = location
                            req_to_install.run_egg_info()
                            if force_root_egg_info:
                                # We need to run this to make sure that the .egg-info/
                                # directory is created for packing in the bundle
                                req_to_install.run_egg_info(force_root_egg_info=True)
                            req_to_install.assert_source_matches_version()
                            #@@ sketchy way of identifying packages not grabbed from an index
                            if bundle and req_to_install.url:
                                self.copy_to_build_dir(req_to_install)
                                install = False
                        # req_to_install.req is only avail after unpack for URL pkgs
                        # repeat check_if_exists to uninstall-on-upgrade (#14)
                        req_to_install.check_if_exists()
                        if req_to_install.satisfied_by:
                            if self.upgrade or self.ignore_installed:
                                req_to_install.conflicts_with = req_to_install.satisfied_by
                                req_to_install.satisfied_by = None
                            else:
                                install = False
                if not is_bundle and not self.is_download:
                    ## FIXME: shouldn't be globally added:
                    finder.add_dependency_links(req_to_install.dependency_links)
                    if (req_to_install.extras):
                        logger.notify("Installing extra requirements: %r" % ','.join(req_to_install.extras))
                    if not self.ignore_dependencies:
                        for req in req_to_install.requirements(req_to_install.extras):
                            try:
                                name = pkg_resources.Requirement.parse(req).project_name
                            except ValueError:
                                e = sys.exc_info()[1]
                                ## FIXME: proper warning
                                logger.error('Invalid requirement: %r (%s) in requirement %s' % (req, e, req_to_install))
                                continue
                            if self.has_requirement(name):
                                ## FIXME: check for conflict
                                continue
                            subreq = InstallRequirement(req, req_to_install)
                            reqs.append(subreq)
                            self.add_requirement(subreq)
                    if req_to_install.name not in self.requirements:
                        self.requirements[req_to_install.name] = req_to_install
                else:
                    self.reqs_to_cleanup.append(req_to_install)
                if install:
                    self.successfully_downloaded.append(req_to_install)
                    if bundle and (req_to_install.url and req_to_install.url.startswith('file:///')):
                        self.copy_to_build_dir(req_to_install)
            finally:
                logger.indent -= 2
1201274
function init() {
    try {
        keepOrganized().then((AllFiles) => {
            console.log('Marked Reference Links');
            console.log('Created Directory Tree');
            console.log('Setting up watchers...');
            let watcher = new Watcher(AllFiles);
            console.log('Watching for file changes...');
            watcher.on('update', () => {
                console.log('Updating dirTree...')
                keepOrganized().then((AllFiles) => {
                    console.log('Updated dirTree.');
                    watcher.update(AllFiles);
                })
            })
        })
    } catch (err) {
        console.error(err);
    }
}
453121
def _install_wrappers(self):
        
        global action_loader__get
        action_loader__get = ansible_mitogen.loaders.action_loader.get
        ansible_mitogen.loaders.action_loader.get = wrap_action_loader__get

        global connection_loader__get
        connection_loader__get = ansible_mitogen.loaders.connection_loader.get
        ansible_mitogen.loaders.connection_loader.get = wrap_connection_loader__get

        global worker__run
        worker__run = ansible.executor.process.worker.WorkerProcess.run
        ansible.executor.process.worker.WorkerProcess.run = wrap_worker__run
1287459
@Before
	public final void setUp() {
		fileUtil = new FileUtils();
		xmlUtils = new XMLUtils(fileUtil);
		httpUtils = new HttpCallUtils(fileUtil);

		fileUtil.loadPropertiesBundle("selenium");

		String browserName = fileUtil
				.getPropertyAsString("selenium", "browser");
		String browserVersion = fileUtil.getPropertyAsString("selenium",
				"browserVersion");
		String runMode = fileUtil.getPropertyAsString("selenium", "runMode");
		String proxyHost = fileUtil
				.getPropertyAsString("selenium", "proxyHost");
		String proxyPort = fileUtil
				.getPropertyAsString("selenium", "proxyPort");
		String gridUrl = fileUtil.getPropertyAsString("selenium", "gridUrl");
		String platform = fileUtil.getPropertyAsString("selenium", "platform");
		String userAgent = fileUtil
				.getPropertyAsString("selenium", "userAgent");
		String noProxyFor = fileUtil.getPropertyAsString("selenium",
				"noProxyFor");
		String screenShotFolder = fileUtil.getPropertyAsString("selenium",
				"screenshotFolder");

		boolean assumeAllCertsUntrusted = fileUtil.getPropertyAsBoolean(
				"selenium", "assumeAllCertsUntrusted");
		String jsEnabled = fileUtil
				.getPropertyAsString("selenium", "jsEnabled");
		boolean flakiness = fileUtil.getPropertyAsBoolean("selenium",
				"flakiness");
		boolean acceptAllCerts = fileUtil.getPropertyAsBoolean("selenium",
				"acceptAllCerts");
		String profileLocation = fileUtil.getPropertyAsString("selenium",
				"browserProfile");
		String takeScreenshots = fileUtil.getPropertyAsString("selenium",
				"takeScreenshots");

		boolean jsEnabledBoolean = Boolean.getBoolean(jsEnabled);
		boolean takeScreenshotsBoolean = Boolean.getBoolean(takeScreenshots);

		/**
		 * assign default values if these are null
		 */
		if (isPropertyNotSet(profileLocation)) {
			profileLocation = null;
		}
		if (isPropertyNotSet(userAgent)) {
			userAgent = null;
		}

		if (isPropertyNotSet(screenShotFolder)) {
			screenShotFolder = Constants.DEFAULT_SCREENSHOT_FOLDER;
		}

		if (isPropertyNotSet(noProxyFor)) {
			noProxyFor = null;
		}

		if (isPropertyNotSet(browserVersion)) {
			browserVersion = null;
		}

		if (isPropertyNotSet(browserName)) {
			browserName = Constants.Browsers.HTML_UNIT;
		}

		if (isPropertyNotSet(runMode)) {
			runMode = Constants.RunMode.NORMAL;
		}

		if (isPropertyNotSet(platform)) {
			platform = Constants.Platform.WINDOWS;
		}

		if (isPropertyNotSet(proxyHost)) {
			proxyHost = null;
		}

		if (isPropertyNotSet(proxyPort)) {
			proxyPort = null;
		}

		if (isPropertyNotSet(jsEnabled)) {
			jsEnabledBoolean = true;
		}

		if (isPropertyNotSet(takeScreenshots)) {
			takeScreenshotsBoolean = true;
		}

		screen.setTakeScreenshot(takeScreenshotsBoolean);
		screen.setScreenshotFolder(new File(screenShotFolder));

		WebDriverHelper.Builder driverBuilder = new WebDriverHelper.Builder();
		driver = driverBuilder.browser(browserName).runMode(runMode)
				.proxy(proxyHost, proxyPort, noProxyFor)
				.acceptAllCerts(acceptAllCerts).grid(gridUrl)
				.platform(platform).flackinessForIe(flakiness)
				.profileLocation(profileLocation).userAgent(userAgent)
				.jsEnabled(jsEnabledBoolean).browserVersion(browserVersion)
				.assumeAllCertsUtrusted(assumeAllCertsUntrusted).buildDriver();

		LOG.info("Driver returned: " + driver);

		helper = new WebDriverHelper(driver);
		screen.setDriver(driver);

		this.doAdditionalSetUp();
	}
943405
public static function install()
    {
        static::updatePackages();
        static::updateBootstrapping();

        tap(new Filesystem, function ($filesystem) {
            $filesystem->deleteDirectory(resource_path('js/components'));
            $filesystem->delete(resource_path('sass/_variables.scss'));
            $filesystem->deleteDirectory(base_path('node_modules'));
            $filesystem->deleteDirectory(public_path('css'));
            $filesystem->deleteDirectory(public_path('js'));
        });
    }
1120014
def main():
    '''
    
    '''
    import argparse
    from kazoo.client import KazooClient

    parser = argparse.ArgumentParser(
            description="Crawler config file pusher to Zookeeper")
    parser.add_argument('-f', '--file', action='store', required=True,
                        help="The yaml file to use")
    parser.add_argument('-i', '--id', action='store', default="all",
                        help="The crawler id to use in zookeeper")
    parser.add_argument('-p', '--path', action='store',
                        default="/scrapy-cluster/crawler/",
                        help="The zookeeper path to use")
    parser.add_argument('-w', '--wipe', action='store_const', const=True,
                        help="Remove the current config")
    parser.add_argument('-z', '--zoo-keeper', action='store', required=True,
                        help="The Zookeeper connection <host>:<port>")
    args = vars(parser.parse_args())

    filename = args['file']
    id = args['id']
    wipe = args['wipe']
    zoo = args['zoo_keeper']
    path = args['path']

    zk = KazooClient(hosts=zoo)
    zk.start()

    # ensure path exists
    zk.ensure_path(path)

    bytes = open(filename, 'rb').read()

    if zk.exists(path):
        # push the conf file
        if not zk.exists(path + id) and not wipe:
            print("creaing conf node")
            zk.create(path + id, bytes)
        elif not wipe:
            print("updating conf file")
            zk.set(path + id, bytes)

        if wipe:
            zk.set(path + id, None)

    zk.stop()
964367
private void setupBlobstore() throws Exception {
        BlobStore blobStore = data.getBlobStore();
        StormClusterState clusterState = data.getStormClusterState();
        Set<String> localSetOfKeys = Sets.newHashSet(blobStore.listKeys());
        Set<String> allKeys = Sets.newHashSet(clusterState.active_keys());
        Set<String> localAvailableActiveKeys = Sets.intersection(localSetOfKeys, allKeys);
        // keys on local but not on zk, we will delete it
        Set<String> keysToDelete = Sets.difference(localSetOfKeys, allKeys);
        LOG.debug("deleting keys not on zookeeper {}", keysToDelete);
        for (String key : keysToDelete) {
            blobStore.deleteBlob(key);
        }
        LOG.debug("Creating list of key entries for blobstore inside zookeeper {} local {}",
                allKeys, localAvailableActiveKeys);
        for (String key : localAvailableActiveKeys) {
            int versionForKey = BlobStoreUtils.getVersionForKey(key, data.getNimbusHostPortInfo(), data.getConf());
            clusterState.setup_blobstore(key, data.getNimbusHostPortInfo(), versionForKey);
        }
    }