/*
Given the sourceList in 'config' form, return the sourceID
Proper sourceID format is <source> | <location>
6749
protected List<String> convertToSourceIDList(List<String> sourceList) {
        List<String> sourceIDList = new ArrayList<String>();
        for (String source : sourceList) {
            String sourceName = getSourceName(source);
            if (!sourceName.equals("")) {
                if (!sourceName.contains("audit")) {
                    sourceIDList.add(getSourceName(source) + "|" + CollectorConstants.MEMORY);
                } else {
                    sourceIDList.add(getSourceName(source) + "|" + CollectorConstants.SERVER);
                }
            }
        }
        return sourceIDList;
    }
431090
def wf_source_id?(source)
      if source.is_a?(String) && source.match(/^[\w\.\-]+$/) &&
         source.size < 1024
        return true
      end

      raise Wavefront::Exception::InvalidSourceId
    end
1030147
function getNodeFromFiles(scriptFile, mapFile) {
    if (fs.existsSync(scriptFile) && fs.existsSync(mapFile)) {
        try {
            return SourceNode.fromStringWithSourceMap(
                getScriptFromFile(scriptFile),
                new SourceMapConsumer(getMapFromMapFile(mapFile))
            );
        } catch (error) {
            console.error('getNodeFromFiles() error: ' + error);
            return new SourceNode();
        }
    } else {
        return new SourceNode();
    }
}
801072
public static DataSource createDataSource(String source){
		String typeAndConfig = configuration.getProperty(source);
		if (typeAndConfig == null){
			log.error("No configuration for data source: " + source);
			return null;
		}
		String[] typeAndConfigArray = typeAndConfig.split(DELIMITORS, 2);
		if (typeAndConfigArray.length < 2){
			log.error("Wrong configuration format for data source '" + source + "': " + typeAndConfig);
			return null;
		}
		String type = typeAndConfigArray[0];
		String config = typeAndConfigArray[1];
		return createDataSource(source, type, config);
	}
1186907
function idToPath(id, config) {
    var alias = config.alias || {};
    return alias.hasOwnProperty(id) ?
        path.resolve(alias[id]) :
        path.resolve(config.base, id) + '.js';
}
235210
function getSource(skyAppConfig) {
  const cssFilePaths = get(skyAppConfig, 'skyux.app.styles', []);
  const numFiles = cssFilePaths.length;

  let styles = '';
  if (numFiles > 0) {

    let hasExternal = false;
    for (let i = 0; i < numFiles; i++) {

      const filePath = cssFilePaths[i];
      if (/^http/.test(filePath)) {
        hasExternal = true;
      } else {
        styles += `require('style-loader!${filePath}');\n`;
      }
    }

    if (hasExternal) {
      logger.warn([
        '[skyuxconfig.json] External style sheets are not permitted in the `app.styles` array.',
        'Consider using `app.externals`:\n',
        'https://developer.blackbaud.com/skyux/learn/reference/configuration'
      ].join(' '));
    }
  }

  // Generate these first so we can check for 404 route
  const components = componentGenerator.getComponents(skyAppConfig);
  const componentNames = components.names;

  // Should we add the 404 route
  if (componentNames.indexOf('NotFoundComponent') === -1) {
    skyAppConfig.runtime.handle404 = true;
  }

  // Any custom runtime components/directives to concat with user defined
  // These should also be defined in runtimeImports
  const runtimeComponents = [];

  const routes = routeGenerator.getRoutes(skyAppConfig);
  const names = componentNames.concat(routes.names, runtimeComponents);

  skyAppConfig.runtime.routes = routes.routesForConfig;
  const skyAppConfigAsString = JSON.stringify(skyAppConfig);

  let runtimeImports = [
    'SkyAppBootstrapper',
    'SkyAppConfig',
    'SkyAppRuntimeConfigParams',
    'SkyAppWindowRef',
    'SkyAuthTokenProvider',
    'SkyAppStyleLoader',
    'SkyAppViewportService'
  ];

  let runtimeProviders = [
    'SkyAppWindowRef',
    'SkyAppStyleLoader',
    `{
      provide: SkyAppConfig,
      deps: [
        SkyAppWindowRef
      ],
      useFactory: SkyAppConfigFactory
    }`,
    `{
      provide: SkyAppAssetsService,
      useClass: ${assetsGenerator.getClassName()}
    }`,
    `{
      provide: SkyAppLocaleProvider,
      useClass: SkyAppHostLocaleProvider
    }`,
    'SkyAppViewportService'
  ];

  let nodeModuleImports = [
    `import { Component, NgModule, OnDestroy, OnInit } from '@angular/core';`,
    `import { CommonModule } from '@angular/common';`,
    `import { HttpModule } from '@angular/http';`,
    `import { FormsModule, ReactiveFormsModule } from '@angular/forms';`,
    `import { ActivatedRoute, RouterModule, Routes } from '@angular/router';`,
    `import { SkyAppLocaleProvider } from '@skyux/i18n';`,
    `import { Subscription } from 'rxjs/Subscription';`
  ];

  let runtimeModuleExports = [
    ...names,
    'SkyAppRuntimeModule'
  ];

  let skyuxModules = skyAppConfig.skyux.skyuxModules || [];

  let runtimeModuleImports = [
    'CommonModule',
    'HttpModule',
    'FormsModule',
    'ReactiveFormsModule',
    ...skyuxModules,
    'AppExtrasModule',
    'SkyAppRuntimeModule'
  ];

  let authTokenProvider = 'SkyAuthTokenProvider';

  if (skyAppConfig.runtime.command === 'pact') {
    nodeModuleImports.push(
      `import { SkyPactAuthTokenProvider, SkyPactService } from '@skyux-sdk/pact';`
    );
    runtimeProviders
      .push(`{
        provide: SkyPactService,
        useClass: SkyPactService,
        deps: [SkyAppConfig]
      }`);
    runtimeImports.push('SkyPactAuthTokenProvider');
    runtimeImports.push('SkyPactService');
    authTokenProvider = `{
      provide: SkyAuthTokenProvider,
      useClass: SkyPactAuthTokenProvider
    }`;
  }

  runtimeProviders.push(authTokenProvider);

  if (skyAppConfig.skyux.auth) {
    nodeModuleImports.push(`import { XHRBackend, RequestOptions } from '@angular/http';`);
    nodeModuleImports.push(`import { SkyAuthHttp } from '@skyux/http';`);
    runtimeProviders.push(`{
      provide: SkyAuthHttp,
      useClass: SkyAuthHttp,
      deps: [XHRBackend, RequestOptions, SkyAuthTokenProvider, SkyAppConfig]
    }`);
  }

  if (skyAppConfig.skyux.help) {
    nodeModuleImports.push(`import { BBHelpModule } from '@blackbaud/skyux-lib-help';`);
    runtimeModuleImports.push('BBHelpModule');
    runtimeModuleExports.push('BBHelpModule');
  }

  if (skyAppConfig.runtime.includeRouteModule) {
    runtimeModuleImports.push('routing');
    runtimeProviders.push('appRoutingProviders');
  } else {
    /*
      Import the regular RouterModule so that tested components can reference things
      like routerLink
    */
    runtimeModuleImports.push('RouterModule');
  }

  let enableProdMode = ``;
  let useMockAuth = ``;

  switch (skyAppConfig.runtime.command) {
    case 'build':
      enableProdMode =
        `import { enableProdMode } from '@angular/core';
enableProdMode();`;
      break;

    case 'e2e':
      useMockAuth =
        `import { BBAuth } from '@blackbaud/auth-client';
BBAuth.mock = true;
`;
      break;
  }

  let useHashRouting = skyAppConfig.skyux.useHashRouting === true;

  let moduleSource =
    `${useMockAuth}

${nodeModuleImports.join('\n')}

import '${skyAppConfig.runtime.skyPagesOutAlias}/src/main';
import {
  ${skyuxModules.join(',\n' + codegen.indent(1))}
} from '${skyAppConfig.runtime.skyuxPathAlias}/core';
import {
  AppExtrasModule
} from '${skyAppConfig.runtime.skyPagesOutAlias}/src/app/app-extras.module';
import { ${runtimeImports.join(', ')} } from '${skyAppConfig.runtime.runtimeAlias}';
import { SkyAppRuntimeModule } from '${skyAppConfig.runtime.runtimeAlias}/runtime.module';
import { SkyAppAssetsService } from '${skyAppConfig.runtime.runtimeAlias}/assets.service';
import { SkyAppHostLocaleProvider } from '${skyAppConfig.runtime.runtimeAlias}/i18n';

${assetsGenerator.getSource()}

${routes.imports.join('\n')}

export function SkyAppConfigFactory(windowRef: SkyAppWindowRef): any {
  const config: any = ${skyAppConfigAsString};
  config.runtime.params = new SkyAppRuntimeConfigParams(
    windowRef.nativeWindow.location.toString(),
    ${JSON.stringify(skyAppConfig.skyux.params)}
  );
  return config;
}

// Setting skyux config as static property exclusively for Bootstrapper
SkyAppBootstrapper.config = ${JSON.stringify(skyAppConfig.skyux)};

${components.imports}
${routes.definitions}

// Routes need to be defined after their corresponding components
const appRoutingProviders: any[] = [${routes.providers}];
const routes: Routes = ${routes.declarations};
const routing = RouterModule.forRoot(routes, { useHash: ${useHashRouting} });

${enableProdMode}

${styles}

@NgModule({
  declarations: [
    ${names.join(',\n' + codegen.indent(2))}
  ],
  imports: [
    ${runtimeModuleImports.join(',\n' + codegen.indent(2))}
  ],
  exports: [
    ${runtimeModuleExports.join(',\n' + codegen.indent(2))}
  ],
  providers: [
    ${runtimeProviders.join(',\n' + codegen.indent(2))}
  ]
}) export class SkyPagesModule { }`;

  return moduleSource;
}
1063695
def get_src_ids(sources):
    
    src_ids = []
    for src in sources:
        long_src_id = src.source_id
        try:
            src_id, ext = long_src_id.rsplit(':', 1)
        except ValueError:
            src_id = long_src_id
        src_ids.append(src_id)
    return ' '.join(set(src_ids))
670728
function getOriginalPositionDetailsFor(
  lineNumber,
  columnNumber,
  moduleIds,
  context,
) {
  var moduleLineOffset = 0;
  var metadata = context.segments[moduleIds.segmentId];
  const {localId} = moduleIds;
  if (localId != null) {
    const {moduleOffsets} = metadata;
    if (!moduleOffsets) {
      throw new Error(
        'Module ID given for a source map that does not have ' +
          'an x_facebook_offsets field',
      );
    }
    if (moduleOffsets[localId] == null) {
      throw new Error('Unknown module ID: ' + localId);
    }
    moduleLineOffset = moduleOffsets[localId];
  }
  const original = metadata.consumer.originalPositionFor({
    line: Number(lineNumber) + moduleLineOffset,
    column: Number(columnNumber),
  });
  if (metadata.sourceFunctionsConsumer) {
    original.functionName =
      metadata.sourceFunctionsConsumer.functionNameFor(original) || null;
  } else {
    original.functionName = null;
  }
  return original;
}
879297
function getLocalConfig(thisConfig, directory) {
  var found,
    i,
    localConfig,
    localConfigFile,
    config = {},
    localConfigFiles = thisConfig.findLocalConfigFiles(directory),
    numFiles = localConfigFiles.length,
    rootPath,
    projectConfigPath = path.join(process.cwd(), LOCAL_CONFIG_FILENAME);

  for (i = 0; i < numFiles; i++) {

    localConfigFile = localConfigFiles[i];

        // Don't consider the personal config file in the home directory,
        // except if the home directory is the same as the current working directory
    if (localConfigFile === PERSONAL_CONFIG_PATH && localConfigFile !== projectConfigPath) {
      continue;
    }

        // If root flag is set, don't consider file if it is above root
    if (rootPath && !pathIsInside(path.dirname(localConfigFile), rootPath)) {
      continue;
    }

    localConfig = loadConfig(localConfigFile);

        // Don't consider a local config file found if the config is empty.
    if (!Object.keys(localConfig).length) {
      continue;
    }

        // Check for root flag
    if (localConfig.root === true) {
      rootPath = path.dirname(localConfigFile);
    }

    found = true;
    config = util.mergeConfigs(localConfig, config);
  }

    // Use the personal config file if there are no other local config files found.
  return found ? config : util.mergeConfigs(config, getPersonalConfig());
}
938294
function sourceDataURI(conf) {
    if (conf.uri) {
        return conf.uri;
    } else if (conf.blob) {
        return 'file:' + conf.blob.name;
    } else if (conf.bwgBlob) {
        return 'file:' + conf.bwgBlob.name;
    } else if (conf.bamBlob) {
        return 'file:' + conf.bamBlob.name;
    } else if (conf.twoBitBlob) {
        return 'file:' + conf.twoBitBlob.name;
    }

    return conf.bwgURI || conf.bamURI || conf.jbURI || conf.twoBitURI || 'https://www.biodalliance.org/magic/no_uri';
}
1304612
protected void getPropertySource(final SourceFile src) {

		final String sourceUuid = source.getUuid();

		final SourceLine line = src.line(source, "public static final");

		line.append(" Property<");
		line.append(getValueType());
		line.append("> ");
		line.append(SchemaHelper.cleanPropertyName(source.getPropertyName()));
		line.append("Property");
		line.append(" = new ");
		line.append(getPropertyType());
		line.append("(");
		line.quoted(source.getPropertyName());

		if (StringUtils.isNotBlank(source.getDbName())) {
			line.append(", ");
			line.quoted(source.getDbName());
		}

		if (getPropertyParameters() != null) {
			line.append(getPropertyParameters());
		}

		line.append(")");

		if (StringUtils.isNotBlank(source.getContentType())) {
			line.append(".contentType(").quoted(source.getContentType()).append(")");
		}

		if (StringUtils.isNotBlank(source.getDefaultValue())) {
			line.append(".defaultValue(").append(getDefaultValue()).append(")");
		}

		if (StringUtils.isNotBlank(source.getFormat())) {
			line.append(".format(").quoted(StringEscapeUtils.escapeJava(source.getFormat())).append(")");
		}

		if (StringUtils.isNotBlank(sourceUuid)) {

			line.append(".setSourceUuid(").quoted(sourceUuid).append(")");

		} else {

			if (StringUtils.isNotBlank(source.getReadFunction())) {
				line.append(".readFunction(").quoted(StringEscapeUtils.escapeJava(source.getReadFunction())).append(")");
			}

			if (StringUtils.isNotBlank(source.getWriteFunction())) {
				line.append(".writeFunction(").quoted(StringEscapeUtils.escapeJava(source.getWriteFunction())).append(")");
			}
		}

		if (StringUtils.isNotBlank(source.getTypeHint())) {
			line.append(".typeHint(").quoted(StringEscapeUtils.escapeJava(source.getTypeHint())).append(")");
		}

		if (source.isUnique()) {
			line.append(".unique()");
		}

		if (source.isCompound()) {
			line.append(".compound()");
		}

		if (source.isNotNull()) {
			line.append(".notNull()");
		}

		if (source.isCachingEnabled()) {
			line.append(".cachingEnabled(true)");
		}

		if (source.isIndexed()) {

			if (StringUtils.isNotBlank(source.getDefaultValue())) {

				line.append(".indexedWhenEmpty()");

			} else {

				line.append(".indexed()");
			}
		}

		if (source.isReadOnly()) {

			line.append(".readOnly()");
		}

		final String[] transformators = source.getTransformators();
		if (transformators != null && transformators.length > 0) {

			line.append(".transformators(");
			line.quoted(StringUtils.join(transformators, "\", \""));
			line.append(")");
		}

		if (source.isPartOfBuiltInSchema()) {
			line.append(".partOfBuiltInSchema()");
		}

		line.append(".dynamic()");

		if (StringUtils.isNotBlank(source.getHint())) {
			line.append(".hint(").quoted(StringEscapeUtils.escapeJava(source.getHint())).append(")");
		}

		if (StringUtils.isNotBlank(source.getCategory())) {
			line.append(".category(").quoted(StringEscapeUtils.escapeJava(source.getCategory())).append(")");
		}

		line.append(";");
	}
982918
public static String getDataSourceIdentifier(WSJdbcWrapper jdbcWrapper) {
        DSConfig config = jdbcWrapper.dsConfig.get();
        return config.jndiName == null ? config.id : config.jndiName;
    }
615900
private int getDatanodeHttpPort(Configuration conf) {
    String address = conf.get("dfs.datanode.http.address", "");
    if (address.equals("")) {
      return -1;
    }
    return Integer.parseInt(address.split(":")[1]);
  }
1229720
private static List<String> getElementsId(List<Element> elementList) {
        List<String> result = new ArrayList<String>();

        for (Element element : elementList) {
            result.add(element.getAttribute("id"));
        }

        return result;
    }
786230
private static String reduceToResourceNameAndId(String url) {
		String[] splitUrl = SLASH.split(url);
		String slash = "/";
		return slash + splitUrl[splitUrl.length - 2] + slash + splitUrl[splitUrl.length - 1];
	}
234092
function convertSource(key, inObj) {
	let source = inObj; // body, query : keep it as is
	
	if (inObj === 'header') {
		source = "headers";
	}
	if (inObj === 'formData') {
		source = "body";
	}
	if (inObj === 'path') {
		source = "params";
	}
	
	return [`${source}.${key}`];
}
750206
@SuppressWarnings("static-method")
	protected String getDefaultMavenGroupId() {
		final String userdomain = System.getenv("userdomain"); //$NON-NLS-1$
		if (Strings.isNullOrEmpty(userdomain)) {
			return "com.foo"; //$NON-NLS-1$
		}
		final String[] elements = userdomain.split(Pattern.quote(".")); //$NON-NLS-1$
		final StringBuilder groupId = new StringBuilder();
		for (int i = elements.length - 1; i >= 0; --i) {
			if (groupId.length() > 0) {
				groupId.append("."); //$NON-NLS-1$
			}
			groupId.append(elements[i]);
		}
		return groupId.toString();
	}