Sets up external resources that are required by the example,
such as Pub/Sub topics and BigQuery tables.

@throws IOException if there is a problem setting up the resources
542215
public void setup() throws IOException {
    Sleeper sleeper = Sleeper.DEFAULT;
    BackOff backOff =
        FluentBackoff.DEFAULT
            .withMaxRetries(3).withInitialBackoff(Duration.millis(200)).backoff();
    Throwable lastException = null;
    try {
      do {
        try {
          setupPubsub();
          setupBigQueryTable();
          return;
        } catch (GoogleJsonResponseException e) {
          lastException = e;
        }
      } while (BackOffUtils.next(sleeper, backOff));
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      // Ignore InterruptedException
    }
    throw new RuntimeException(lastException);
  }
712152
public void load(String config)
        throws IOException
    {
        _config=config;
        if(log.isDebugEnabled())log.debug("Load "+this+" from "+config);
        Properties properties = new Properties();
        Resource resource=Resource.newResource(config);
        properties.load(resource.getInputStream());

        Iterator iter = properties.entrySet().iterator();
        while(iter.hasNext())
        {
            Map.Entry entry = (Map.Entry)iter.next();

            String username=entry.getKey().toString().trim();
            String credentials=entry.getValue().toString().trim();
            String roles=null;
            int c=credentials.indexOf(',');
            if (c>0)
            {
                roles=credentials.substring(c+1).trim();
                credentials=credentials.substring(0,c).trim();
            }

            if (username!=null && username.length()>0 &&
                credentials!=null && credentials.length()>0)
            {
                put(username,credentials);
                if(roles!=null && roles.length()>0)
                {
                    StringTokenizer tok = new StringTokenizer(roles,", ");
                    while (tok.hasMoreTokens())
                        addUserToRole(username,tok.nextToken());
                }
            }
        }
    }
790755
@Override
  public final void setupJob(org.apache.hadoop.mapreduce.JobContext jobContext
                             ) throws IOException {
    setupJob((JobContext) jobContext);
  }
1002576
protected function setupResources(IOInterface $io)
    {
        // Setup root dir
        $resourcesPath = $this->getResourcesPath();
        $this->filesystem->ensureDirectoryExists($resourcesPath);

        // Copy missing resources
        $files = new DirectoryIterator(__DIR__.'/../resources');
        foreach ($files as $file) {
            $targetPath = $resourcesPath . DIRECTORY_SEPARATOR . $file->getFilename();
            if ($file->isFile() && !file_exists($targetPath)) {
                $name = $file->getFilename();
                $io->write("Writing <info>{$name}</info> to resources folder");
                copy($file->getPathname(), $targetPath);
            }
        }
    }
1025112
public static void main(String[] args) throws IOException {
		ExampleHelpers.configureLogging();
		ClassPropertyUsageAnalyzer.printDocumentation();

		ClassPropertyUsageAnalyzer processor = new ClassPropertyUsageAnalyzer();
		ExampleHelpers.processEntitiesFromWikidataDump(processor);
		processor.writeFinalReports();
	}
595644
public void setResourceProviders(IResourceProvider... theResourceProviders) {
		myResourceProviders.clear();
		if (theResourceProviders != null) {
			myResourceProviders.addAll(Arrays.asList(theResourceProviders));
		}
	}
206510
public void initialize() throws IOException  {
    rootEntry.refresh(rootEntry.getPath());
    final FileStatusEntry[] children = doListPathsEntry(rootEntry.getPath(), rootEntry);
    rootEntry.setChildren(children);
  }
1081661
protected void setup(Mapper.Context context) {
        Configuration conf = context.getConfiguration();
        extractor = new CooccurrenceExtractor(conf);

        // Set up the IteratorFactory properties           
        Properties props = new Properties();
        for (String property : ITERATOR_FACTORY_PROPERTIES) {
            String propVal = conf.get(property);
            if (propVal != null)
                props.setProperty(property, propVal);
        }
        
        // Create the ResourceFinder that the IteratorFactory will use to find
        // the various files on HDFS
        ResourceFinder hadoopRf = null;
        try {
            hadoopRf = new HadoopResourceFinder(conf);
        } catch (IOException ioe) {
            throw new IOError(ioe);
        }

        // Set the IteratorFactory to locate the resources and then have it
        // reconfigure itself based on the user specified properties
        IteratorFactory.setResourceFinder(hadoopRf);        
        IteratorFactory.setProperties(props);
    }
67455
private void setup() {
        super.setMapperClass(Mapper.class);
        super.setMapOutputKeyClass(Key.class);
        super.setMapOutputValueClass(Value.class);

        super.setPartitionerClass(SimplePartitioner.class);
        super.setGroupingComparatorClass(SimpleGroupingComparator.class);
        super.setSortComparatorClass(SimpleSortComparator.class);

        super.setReducerClass(Reducer.class);
        super.setOutputKeyClass(Key.class);
        super.setOutputValueClass(Value.class);
    }
370669
private void writeResources() throws IOException
   {
      writeAttributeTypes("resource_types", ResourceField.values());

      m_writer.writeStartList("resources");
      for (Resource resource : m_projectFile.getResources())
      {
         writeFields(null, resource, ResourceField.values());
      }
      m_writer.writeEndList();
   }
521465
private void configureClientProperties() throws IOException {
        Map<String, String> serviceRefProps = wsrInfo.getProperties();
        Iterator<QName> iterator = this.getPorts();//wsrInfo.getBindingPortComponentRefInfoList();

        while (null != iterator && iterator.hasNext()) {
            QName portQName = iterator.next();
            PortComponentRefInfo portInfo = wsrInfo.getPortComponentRefInfo(portQName);
            Map<String, String> portProps = (null != portInfo) ? portInfo.getProperties() : null;

            if ((null != serviceRefProps || null != portProps)) {
                prepareProperties(portQName, serviceRefProps, portProps);
            }
        }
    }
723797
public Response getResource() throws IOException {
		buildQueryString();
		buildHeaders();

		connection.setDoOutput(true);
		connection.setRequestMethod("GET");

		return readResponse();
	}
719987
private void initialize() {

		domainIds.addAll(getResourceIds("rdfs:domain"));
		rangeIds.addAll(getResourceIds("rdfs:range"));

		allowsInstances     = "true".equals(getValue(getFirstElement(getElement(), "krdf:allowsInstances")));
		multipleOccurrences = "true".equals(getValue(getFirstElement(getElement(), "krdf:multipleOccurrences")));
		isMixedIn           = "true".equals(getValue(getFirstElement(getElement(), "krdf:isMixedIn")));
		oneWay              = "true".equals(getValue(getFirstElement(getElement(), "krdf:oneWay")));
		icon                = getValue(getFirstElement(getElement(), "krdf:icon"));

		final Object isPrimaryValue = getValue(getFirstElement(getElement(), "krdf:primary"));
		if (isPrimaryValue == null || "true".equals(isPrimaryValue)) {

			primary = true;
		}


		final Node node = getFirstElement(getElement(), "owl:inverseOf");
		if (node != null) {

			final String inverse = getResourceId(node);
			if (inverse != null) {

				this.inverseId = URI.create(inverse);
			}
		}

	}
465891
public void loadProperties(Properties properties) throws IOException {
        userSettings.putAll(properties);
        loadDataSource(obdaModel, userSettings);
    }
1164163
public void build() throws IOException {
        if (! serialClassFoundToDocument(configuration.root.classes())) {
            //Nothing to document.
            return;
        }
        try {
            writer = configuration.getWriterFactory().getSerializedFormWriter();
            if (writer == null) {
                //Doclet does not support this output.
                return;
            }
        } catch (Exception e) {
            throw new DocletAbortException(e);
        }
        build(layoutParser.parseXML(NAME), contentTree);
        writer.close();
    }
1146207
public void startRTS() throws IOException {
    List<HubDataSource> dataSources = hubDataStore.getHubDataSources();
    List<String> com = Lists.newArrayList();
    com.add(getHostPort(hubDataStore.getHubAddress()));
    com.add(hubDataStore.getInstanceName());
    for (HubDataSource source : dataSources) {
      com.add(source.getName());
    }
    ExternalProgramExecutor executorService = new ExternalProgramExecutor(
      "RTS", new File(binLocation, "rts"), com.toArray(new String[com.size()]));
    rtsExecutor.add(executorService);
    LOG.info("Starting RTS : {}", executorService);
    executorService.startAndWait();
  }
1158474
private void init(ResourceLoader resourceLoader) throws IOException {
    if (config == null && configs == null) {
      if (resourceLoader == null) {
        return;
      } else if (configFileArgument == null && configArgument == null && analyzerArgument==null) {
        throw new IOException("no configuration");
      } else {
        if (configFileArgument != null) {
          try {
            config = MtasConfiguration.readConfiguration(
                resourceLoader.openResource(configFileArgument));
          } catch (IOException e) {
            throw new IOException(
                "Problem loading configuration from " + configFileArgument, e);
          }
        }
        if (configArgument != null) {
          try {
            configs = MtasConfiguration.readMtasTokenizerConfigurations(
                resourceLoader, configArgument);
          } catch (IOException e) {
            throw new IOException(
                "Problem loading configurations from " + configArgument, e);
          }
        }
        if (analyzerArgument != null) {
          configs = null;
          config = new MtasConfiguration();
          MtasConfiguration subConfig = new MtasConfiguration();
          subConfig.name = "parser";
          subConfig.attributes.put("name", analyzerArgument);
          subConfig.attributes.put(ARGUMENT_PARSER_ARGS, analyzerArgumentParserArgs);
          config.children.add(subConfig);
        }
      }
    }
  }