proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/LazyEscapingCharSequence.java | LazyEscapingCharSequence | produceEscapedOutput | class LazyEscapingCharSequence extends AbstractLazyCharSequence {
private final IEngineConfiguration configuration;
private final TemplateMode templateMode;
private final Object input;
public LazyEscapingCharSequence(final IEngineConfiguration configuration, final TemplateMode templateMode, final Obj... |
/*
* Producing ESCAPED output is somewhat simple in HTML or XML modes, as it simply consists of converting
* input into a String and HTML-or-XML-escaping it.
*
* But for JavaScript or CSS, it becomes a bit more complicated than that. JavaScript will output a complete
... | 288 | 552 | 840 | <methods>public final char charAt(int) ,public final boolean equals(java.lang.Object) ,public final int hashCode() ,public final int length() ,public final java.lang.CharSequence subSequence(int, int) ,public final java.lang.String toString() ,public final void write(java.io.Writer) throws java.io.IOException<variables... |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/LazyProcessingCharSequence.java | LazyProcessingCharSequence | resolveText | class LazyProcessingCharSequence extends AbstractLazyCharSequence {
private final ITemplateContext context;
private final TemplateModel templateModel;
public LazyProcessingCharSequence(final ITemplateContext context, final TemplateModel templateModel) {
super();
if (context == null) {
... |
final Writer stringWriter = new FastStringWriter();
this.context.getConfiguration().getTemplateManager().process(this.templateModel, this.context, stringWriter);
return stringWriter.toString();
| 231 | 51 | 282 | <methods>public final char charAt(int) ,public final boolean equals(java.lang.Object) ,public final int hashCode() ,public final int length() ,public final java.lang.CharSequence subSequence(int, int) ,public final java.lang.String toString() ,public final void write(java.io.Writer) throws java.io.IOException<variables... |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/ListUtils.java | ListUtils | sort | class ListUtils {
public static List<?> toList(final Object target) {
Validate.notNull(target, "Cannot convert null to list");
if (target instanceof List<?>) {
return (List<?>) target;
}
if (target.getClass().isArray()) {
... |
Validate.notNull(list, "Cannot execute list sort: list is null");
final Object[] a = list.toArray();
Arrays.sort(a, (Comparator) c);
return fillNewList(a, list.getClass());
| 1,054 | 67 | 1,121 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/LoggingUtils.java | LoggingUtils | loggifyTemplateName | class LoggingUtils {
public static String loggifyTemplateName(final String template) {<FILL_FUNCTION_BODY>}
private LoggingUtils() {
super();
}
} |
if (template == null) {
return null;
}
if (template.length() <= 120) {
return template.replace('\n', ' ');
}
final StringBuilder strBuilder = new StringBuilder();
strBuilder.append(template.substring(0, 35).replace('\n', ' '));
strBuilder.... | 64 | 135 | 199 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/MapUtils.java | MapUtils | containsAllKeys | class MapUtils {
public static int size(final Map<?,?> target) {
Validate.notNull(target, "Cannot get map size of null");
return target.size();
}
public static boolean isEmpty(final Map<?,?> target) {
return target == null || target.isEmpty();
}
pub... |
Validate.notNull(target, "Cannot execute map containsAllKeys: target is null");
Validate.notNull(keys, "Cannot execute map containsAllKeys: keys is null");
return target.keySet().containsAll(keys);
| 569 | 61 | 630 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/PatternSpec.java | PatternSpec | matches | class PatternSpec {
private static final int DEFAULT_PATTERN_SET_SIZE = 3;
private LinkedHashSet<String> patternStrs;
private LinkedHashSet<Pattern> patterns;
public PatternSpec() {
super();
}
public boolean isEmpty() {
return this.patt... |
if (this.patterns == null) {
return false;
}
for (final Pattern p : this.patterns) {
if (p.matcher(templateName).matches()) {
return true;
}
}
return false;
| 613 | 70 | 683 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/PatternUtils.java | PatternUtils | strPatternToPattern | class PatternUtils {
public static Pattern strPatternToPattern(final String pattern) {<FILL_FUNCTION_BODY>}
private PatternUtils() {
super();
}
} |
final String pat =
pattern.replace(".", "\\.").replace("(", "\\(").replace(")", "\\)").
replace("[","\\[").replace("]","\\]").replace("?","\\?").replace("$","\\$").replace("+","\\+").
replace("*","(?:.*?)");
return Pattern.compile('^' + pat + '$');
| 64 | 99 | 163 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/ProcessorComparators.java | PreProcessorPrecedenceComparator | compare | class PreProcessorPrecedenceComparator implements Comparator<IPreProcessor> {
PreProcessorPrecedenceComparator() {
super();
}
public int compare(final IPreProcessor o1, final IPreProcessor o2) {<FILL_FUNCTION_BODY>}
/*
* Processors are wrapped and therefore we ... |
if (o1 == o2) {
// This is the only case in which the comparison of two processors will return 0
return 0;
}
if (o1 instanceof ProcessorConfigurationUtils.PreProcessorWrapper && o2 instanceof ProcessorConfigurationUtils.PreProcessorWrapper) {
... | 432 | 240 | 672 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/SetUtils.java | SetUtils | toSet | class SetUtils {
public static Set<?> toSet(final Object target) {<FILL_FUNCTION_BODY>}
public static int size(final Set<?> target) {
Validate.notNull(target, "Cannot get set size of null");
return target.size();
}
public static boolean isEmpty(final Set<?... |
Validate.notNull(target, "Cannot convert null to set");
if (target instanceof Set<?>) {
return (Set<?>) target;
}
if (target.getClass().isArray()) {
return new LinkedHashSet<Object>(Arrays.asList((Object[])target));
}
... | 438 | 195 | 633 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/Validate.java | Validate | notEmpty | class Validate {
public static void notNull(final Object object, final String message) {
if (object == null) {
throw new IllegalArgumentException(message);
}
}
public static void notEmpty(final String object, final String message) {
if (StringUtils.isEmptyOrWhi... |
if (object == null || object.size() == 0) {
throw new IllegalArgumentException(message);
}
| 397 | 31 | 428 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/temporal/TemporalArrayUtils.java | TemporalArrayUtils | arrayFormat | class TemporalArrayUtils {
private final TemporalFormattingUtils temporalFormattingUtils;
public TemporalArrayUtils(final Locale locale, final ZoneId defaultZoneId) {
super();
Validate.notNull(locale, "Locale cannot be null");
Validate.notNull(defaultZoneId, "ZoneId cannot be null"... |
Validate.notNull(target, "Target cannot be null");
return Stream.of(target)
.map(time -> mapFunction.apply(time))
.toArray(length -> (R[]) Array.newInstance(returnType, length));
| 876 | 66 | 942 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/temporal/TemporalCreationUtils.java | TemporalCreationUtils | zoneId | class TemporalCreationUtils {
public TemporalCreationUtils() {
super();
}
/**
*
* @return a instance of java.time.LocalDate
* @since 2.1.0
*/
public Temporal create(final Object year, final Object month, final Object day) {
return LocalDate.of(integer(year), int... |
Validate.notNull(zoneId, "ZoneId cannot be null");
if (zoneId instanceof ZoneId) {
return (ZoneId) zoneId;
} else if (zoneId instanceof TimeZone) {
TimeZone timeZone = (TimeZone) zoneId;
return timeZone.toZoneId();
} else {
return ZoneId.o... | 1,088 | 100 | 1,188 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/temporal/TemporalFormattingUtils.java | TemporalFormattingUtils | formatDate | class TemporalFormattingUtils {
// Even though Java comes with several patterns for ISO8601, we use the same pattern of Thymeleaf #dates utility.
private static final DateTimeFormatter ISO8601_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZZZ");
private final Locale local... |
if (target == null) {
return null;
}
Locale formattingLocale = localeOverride != null ? localeOverride : this.locale;
try {
DateTimeFormatter formatter;
if (StringUtils.isEmptyOrWhitespace(pattern)) {
formatter = TemporalObjects.format... | 1,627 | 207 | 1,834 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/temporal/TemporalListUtils.java | TemporalListUtils | listFormat | class TemporalListUtils {
private final TemporalFormattingUtils temporalFormattingUtils;
public TemporalListUtils(final Locale locale, final ZoneId defaultZoneId) {
super();
Validate.notNull(locale, "Locale cannot be null");
Validate.notNull(defaultZoneId, "ZoneId cannot be nul... |
Validate.notNull(target, "Target cannot be null");
return target.stream()
.map(time -> mapFunction.apply(time))
.collect(toList());
| 961 | 49 | 1,010 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/temporal/TemporalObjects.java | TemporalObjects | formatterFor | class TemporalObjects {
public TemporalObjects() {
super();
}
public static DateTimeFormatter formatterFor(final Object target, final Locale locale) {<FILL_FUNCTION_BODY>}
/**
* Creates a Temporal object filling the missing fields of the provided time with default values.
* @par... |
Validate.notNull(target, "Target cannot be null");
Validate.notNull(locale, "Locale cannot be null");
if (target instanceof Instant) {
return new DateTimeFormatterBuilder().appendInstant().toFormatter();
} else if (target instanceof LocalDate) {
return DateTimeFo... | 1,032 | 521 | 1,553 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/util/temporal/TemporalSetUtils.java | TemporalSetUtils | setFormat | class TemporalSetUtils {
private final TemporalFormattingUtils temporalFormattingUtils;
public TemporalSetUtils(final Locale locale, final ZoneId defaultZoneId) {
super();
Validate.notNull(locale, "Locale cannot be null");
Validate.notNull(defaultZoneId, "ZoneId cannot be null");
... |
Validate.notNull(target, "Target cannot be null");
return target.stream()
.map(time -> mapFunction.apply(time))
.collect(toSet());
| 959 | 49 | 1,008 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/web/servlet/JakartaServletWebApplication.java | JakartaServletWebApplication | buildExchange | class JakartaServletWebApplication implements IServletWebApplication {
// This class is made NOT final so that it can be proxied by Dependency Injection frameworks
private final ServletContext servletContext;
JakartaServletWebApplication(final ServletContext servletContext) {
super();
Validat... |
Validate.notNull(httpServletRequest, "Request cannot be null");
Validate.notNull(httpServletResponse, "Response cannot be null");
Validate.isTrue(servletContextMatches(httpServletRequest),
"Cannot build an application for a request which servlet context does not match with " +
... | 588 | 166 | 754 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/web/servlet/JakartaServletWebRequest.java | JakartaServletWebRequest | getCookieMap | class JakartaServletWebRequest implements IServletWebRequest {
private final HttpServletRequest request;
JakartaServletWebRequest(final HttpServletRequest request) {
super();
Validate.notNull(request, "Request cannot be null");
this.request = request;
}
@Override
public ... |
final Cookie[] cookies = this.request.getCookies();
if (cookies == null) {
return Collections.emptyMap();
}
final Map<String,String[]> cookieMap = new LinkedHashMap<String,String[]>(3);
for (int i = 0; i < cookies.length; i++) {
final String cookieName = ... | 1,189 | 255 | 1,444 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/web/servlet/JakartaServletWebSession.java | JakartaServletWebSession | getAttributeValue | class JakartaServletWebSession implements IServletWebSession {
private final HttpServletRequest request;
private HttpSession session;
JakartaServletWebSession(final HttpServletRequest request) {
super();
Validate.notNull(request, "Request cannot be null");
this.request = request;
... |
Validate.notNull(name, "Name cannot be null");
if (this.session == null) {
return null;
}
return this.session.getAttribute(name);
| 343 | 50 | 393 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/web/servlet/JavaxServletWebApplication.java | JavaxServletWebApplication | buildExchange | class JavaxServletWebApplication implements IServletWebApplication {
// This class is made NOT final so that it can be proxied by Dependency Injection frameworks
private final ServletContext servletContext;
JavaxServletWebApplication(final ServletContext servletContext) {
super();
Validate.no... |
Validate.notNull(httpServletRequest, "Request cannot be null");
Validate.notNull(httpServletResponse, "Response cannot be null");
Validate.isTrue(servletContextMatches(httpServletRequest),
"Cannot build an application for a request which servlet context does not match with " +
... | 584 | 161 | 745 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/web/servlet/JavaxServletWebRequest.java | JavaxServletWebRequest | getCookieValues | class JavaxServletWebRequest implements IServletWebRequest {
private final HttpServletRequest request;
JavaxServletWebRequest(final HttpServletRequest request) {
super();
Validate.notNull(request, "Request cannot be null");
this.request = request;
}
@Override
public Stri... |
Validate.notNull(name, "Name cannot be null");
final Cookie[] cookies = this.request.getCookies();
if (cookies == null) {
return null;
}
String[] cookieValues = null;
for (int i = 0; i < cookies.length; i++) {
final String cookieName = cookies[i].... | 1,224 | 218 | 1,442 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/lib/thymeleaf/src/main/java/org/thymeleaf/web/servlet/JavaxServletWebSession.java | JavaxServletWebSession | getAttributeValue | class JavaxServletWebSession implements IServletWebSession {
private final HttpServletRequest request;
private HttpSession session;
JavaxServletWebSession(final HttpServletRequest request) {
super();
Validate.notNull(request, "Request cannot be null");
this.request = request;
... |
Validate.notNull(name, "Name cannot be null");
if (this.session == null) {
return null;
}
return this.session.getAttribute(name);
| 341 | 50 | 391 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/WdmAgent.java | DefineTransformer | transform | class DefineTransformer implements ClassFileTransformer {
@Override
public byte[] transform(ClassLoader loader, String className,
Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
byte[] classfileBuffer) throws IllegalClassFormatException {<FILL_FUNCTION_BO... |
DriverManagerType driverManagerType = null;
switch (className) {
case "org/openqa/selenium/chrome/ChromeDriver":
driverManagerType = CHROME;
break;
case "org/openqa/selenium/firefox/FirefoxDriver":
driverManagerType = FIRE... | 75 | 273 | 348 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/cache/CacheHandler.java | CacheHandler | getFilesInCache | class CacheHandler {
final Logger log = getLogger(lookup().lookupClass());
private Config config;
public CacheHandler(Config config) {
this.config = config;
}
public List<File> filterCacheBy(List<File> input, String key,
boolean isVersion) {
String pathSeparator = isV... |
List<File> listFiles = (List<File>) listFiles(config.getCacheFolder(),
null, true);
sort(listFiles);
return listFiles;
| 651 | 46 | 697 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/cache/ResolutionCache.java | ResolutionCache | getExpirationDateFromResolutionCache | class ResolutionCache {
final Logger log = getLogger(lookup().lookupClass());
static final String TTL = "-ttl";
static final String RESOLUTION_CACHE_INFO = "WebDriverManager Resolution Cache";
Properties props = new Properties() {
private static final long serialVersionUID = 37349503296570852... |
Date result = new Date(0);
try {
result = dateFormat.parse(props.getProperty(getExpirationKey(key)));
return result;
} catch (Exception e) {
log.warn("Exception parsing date ({}) from resolution cache {}",
key, e.getMessage());
}
... | 1,264 | 86 | 1,350 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/docker/DockerHost.java | DockerHost | endpointFromEnv | class DockerHost {
static final Logger log = getLogger(lookup().lookupClass());
public static final String DEFAULT_ADDRESS = "localhost";
private static final int DEFAULT_PORT = 2375;
private static final String DEFAULT_UNIX_ENDPOINT = "unix:///var/run/docker.sock";
private static final String DEF... |
String dockerHost = System.getenv("DOCKER_HOST");
if (dockerHost == null) {
dockerHost = defaultDockerEndpoint();
}
return dockerHost;
| 1,110 | 50 | 1,160 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/docker/DockerHubService.java | DockerHubService | listTags | class DockerHubService {
final Logger log = getLogger(lookup().lookupClass());
static final String GET_IMAGE_TAGS_PATH_FORMAT = "%sv2/repositories/%s/tags?page=%s&page_size=1024";
private Config config;
private HttpClient client;
public DockerHubService(Config config, HttpClient client) {
... |
log.debug("Getting browser image list from Docker Hub");
List<DockerHubTag> results = new ArrayList<>();
String dockerHubUrl = config.getDockerHubUrl();
String repo = dockerImageFormat.substring(0,
dockerImageFormat.indexOf(":"));
Object url = String.format(GET... | 155 | 318 | 473 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/managers/ChromeDriverManager.java | ChromeDriverManager | getCapabilities | class ChromeDriverManager extends WebDriverManager {
private static final String CHROMEDRIVER_DOWNLOAD_OLD_PATTERN = "https://chromedriver.storage.googleapis.com/%s/chromedriver_%s%s.zip";
@Override
public DriverManagerType getDriverManagerType() {
return CHROME;
}
@Override
... |
Capabilities options = new ChromeOptions();
try {
addDefaultArgumentsForDocker(options);
} catch (Exception e) {
log.error(
"Exception adding default arguments for Docker, retyring with custom class");
options = new OptionsWithArgum... | 1,429 | 142 | 1,571 | <methods>public io.github.bonigarcia.wdm.WebDriverManager arch32() ,public io.github.bonigarcia.wdm.WebDriverManager arch64() ,public io.github.bonigarcia.wdm.WebDriverManager architecture(io.github.bonigarcia.wdm.config.Architecture) ,public io.github.bonigarcia.wdm.WebDriverManager arm64() ,public io.github.bonigarci... |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/managers/ChromiumDriverManager.java | ChromiumDriverManager | getCapabilities | class ChromiumDriverManager extends ChromeDriverManager {
@Override
public DriverManagerType getDriverManagerType() {
return CHROMIUM;
}
@Override
protected String getDriverVersion() {
return config().getChromiumDriverVersion();
}
@Override
protected Strin... |
ChromeOptions options = new ChromeOptions();
Optional<Path> browserPath = getBrowserPath();
if (browserPath.isPresent()) {
options.setBinary(browserPath.get().toFile());
}
return options;
| 221 | 67 | 288 | <methods>public non-sealed void <init>() ,public io.github.bonigarcia.wdm.WebDriverManager browserInDockerAndroid() ,public io.github.bonigarcia.wdm.WebDriverManager exportParameter(java.lang.String) ,public io.github.bonigarcia.wdm.config.DriverManagerType getDriverManagerType() <variables>private static final java.la... |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/managers/EdgeDriverManager.java | EdgeDriverManager | buildUrl | class EdgeDriverManager extends WebDriverManager {
protected static final String LATEST_STABLE = "LATEST_STABLE";
@Override
public DriverManagerType getDriverManagerType() {
return EDGE;
}
@Override
protected String getDriverName() {
return "msedgedriver";
}
... |
Optional<URL> optionalUrl = empty();
if (!config.isUseMirror()) {
String downloadUrlPattern = config.getEdgeDownloadUrlPattern();
OperatingSystem os = config.getOperatingSystem();
Architecture arch = config.getArchitecture();
String archLabel = os.i... | 1,276 | 282 | 1,558 | <methods>public io.github.bonigarcia.wdm.WebDriverManager arch32() ,public io.github.bonigarcia.wdm.WebDriverManager arch64() ,public io.github.bonigarcia.wdm.WebDriverManager architecture(io.github.bonigarcia.wdm.config.Architecture) ,public io.github.bonigarcia.wdm.WebDriverManager arm64() ,public io.github.bonigarci... |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/managers/FirefoxDriverManager.java | FirefoxDriverManager | getDriverUrls | class FirefoxDriverManager extends WebDriverManager {
@Override
public DriverManagerType getDriverManagerType() {
return FIREFOX;
}
@Override
protected String getDriverName() {
return "geckodriver";
}
@Override
protected String getDriverVersion() {
... |
if (isUseMirror()) {
String versionPath = driverVersion;
if (!driverVersion.isEmpty() && !driverVersion.equals("0.3.0")) {
versionPath = "v" + versionPath;
}
return getDriversFromMirror(getMirrorUrl().get(), versionPath);
} else {
... | 1,222 | 115 | 1,337 | <methods>public io.github.bonigarcia.wdm.WebDriverManager arch32() ,public io.github.bonigarcia.wdm.WebDriverManager arch64() ,public io.github.bonigarcia.wdm.WebDriverManager architecture(io.github.bonigarcia.wdm.config.Architecture) ,public io.github.bonigarcia.wdm.WebDriverManager arm64() ,public io.github.bonigarci... |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/managers/InternetExplorerDriverManager.java | InternetExplorerDriverManager | getCurrentVersion | class InternetExplorerDriverManager extends WebDriverManager {
@Override
public DriverManagerType getDriverManagerType() {
return IEXPLORER;
}
protected String getDriverName() {
return "IEDriverServer";
}
@Override
protected String getDriverVersion() {
... |
String currentVersion = super.getCurrentVersion(url);
String versionRegex = config().getBrowserVersionDetectionRegex();
return currentVersion.replaceAll(versionRegex, "");
| 731 | 53 | 784 | <methods>public io.github.bonigarcia.wdm.WebDriverManager arch32() ,public io.github.bonigarcia.wdm.WebDriverManager arch64() ,public io.github.bonigarcia.wdm.WebDriverManager architecture(io.github.bonigarcia.wdm.config.Architecture) ,public io.github.bonigarcia.wdm.WebDriverManager arm64() ,public io.github.bonigarci... |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/managers/OperaDriverManager.java | OperaDriverManager | getCapabilities | class OperaDriverManager extends WebDriverManager {
protected static final String TAG_NAME_PREFIX = "v.";
// This value is calculated since the Opera major versions are 14 below the
// corresponding operadriver version. For example: Opera 107 -> operadriver
// 121.0.6167.140, Opera 106 -> operad... |
ChromeOptions options = new ChromeOptions();
if (!isUsingDocker()) {
Optional<Path> browserPath = getBrowserPath();
if (browserPath.isPresent()) {
options.setBinary(browserPath.get().toFile());
}
}
return options;
| 1,777 | 82 | 1,859 | <methods>public io.github.bonigarcia.wdm.WebDriverManager arch32() ,public io.github.bonigarcia.wdm.WebDriverManager arch64() ,public io.github.bonigarcia.wdm.WebDriverManager architecture(io.github.bonigarcia.wdm.config.Architecture) ,public io.github.bonigarcia.wdm.WebDriverManager arm64() ,public io.github.bonigarci... |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/managers/SafariDriverManager.java | SafariDriverManager | manage | class SafariDriverManager extends VoidDriverManager {
protected static final Logger log = getLogger(lookup().lookupClass());
@Override
public DriverManagerType getDriverManagerType() {
return SAFARI;
}
@Override
protected String getDriverName() {
return "safaridrive... |
log.warn(
"There is no need to manage the driver for the Safari browser (i.e., safaridriver) since it is built-in in Mac OS");
| 236 | 47 | 283 | <methods>public non-sealed void <init>() ,public io.github.bonigarcia.wdm.WebDriverManager exportParameter(java.lang.String) ,public io.github.bonigarcia.wdm.config.DriverManagerType getDriverManagerType() <variables> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/online/Parser.java | Parser | parseJson | class Parser {
static final Logger log = getLogger(lookup().lookupClass());
private Parser() {
throw new IllegalStateException("Utility class");
}
public static <T> T parseJson(HttpClient client, String url, Class<T> klass)
throws IOException {<FILL_FUNCTION_BODY>}
} |
HttpGet get = client.createHttpGet(new URL(url));
InputStream content = client.execute(get).getEntity().getContent();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(content))) {
String lines = reader.lines().collect(Collectors.joining());
... | 93 | 158 | 251 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/online/S3NamespaceContext.java | S3NamespaceContext | getPrefix | class S3NamespaceContext implements NamespaceContext {
private static final String S3_BUCKET_LIST_NS = "http://doc.s3.amazonaws.com/2006-03-01";
private static final String S3_PREFIX = "s3";
@Override
public String getNamespaceURI(String prefix) {
if (S3_PREFIX.equals(prefix)) {
r... |
if (S3_BUCKET_LIST_NS.equals(namespaceURI)) {
return S3_PREFIX;
}
throw new IllegalArgumentException("Unsupported namespace URI");
| 240 | 48 | 288 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/versions/Shell.java | Shell | runAndWaitArray | class Shell {
static final Logger log = getLogger(lookup().lookupClass());
private Shell() {
throw new IllegalStateException("Utility class");
}
public static String runAndWait(String... command) {
return runAndWait(true, command);
}
public static String runAndWait(File folde... |
String commandStr = Arrays.toString(command);
if (logCommand) {
log.debug("Running command on the shell: {}", commandStr);
}
String result = runAndWaitNoLog(folder, command);
if (logCommand) {
log.debug("Result: {}", result);
}
return resu... | 386 | 87 | 473 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/versions/VersionComparator.java | VersionComparator | compare | class VersionComparator implements Comparator<String> {
final Logger log = getLogger(lookup().lookupClass());
@Override
public int compare(String v1, String v2) {<FILL_FUNCTION_BODY>}
} |
String[] v1split = v1.split("\\.");
String[] v2split = v2.split("\\.");
int length = max(v1split.length, v2split.length);
for (int i = 0; i < length; i++) {
try {
int v1Part = i < v1split.length ? parseInt(v1split[i]) : 0;
int v2Part = i < v2s... | 66 | 221 | 287 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/webdriver/OptionsWithArguments.java | OptionsWithArguments | asMap | class OptionsWithArguments extends MutableCapabilities {
private static final long serialVersionUID = -5948442823984189597L;
private String capability;
private List<String> args = new ArrayList<>();
public OptionsWithArguments(String browserType, String capability) {
setCapability(Capability... |
Map<String, Object> toReturn = new TreeMap<>(super.asMap());
Map<String, Object> options = new TreeMap<>();
options.put("args", Collections.unmodifiableList(args));
toReturn.put(capability, options);
return Collections.unmodifiableMap(toReturn);
| 223 | 83 | 306 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/webdriver/WebDriverBrowser.java | WebDriverBrowser | getUrl | class WebDriverBrowser {
final Logger log = getLogger(lookup().lookupClass());
WebDriver driver;
List<DockerContainer> dockerContainerList;
String browserContainerId;
String noVncUrl;
String vncUrl;
String seleniumServerUrl;
Path recordingPath;
int identityHash;
public WebDriv... |
URL url = null;
try {
url = new URL(urlStr);
} catch (MalformedURLException e) {
log.error("Exception creating URL", e);
}
return url;
| 919 | 56 | 975 | <no_super_class> |
bonigarcia_webdrivermanager | webdrivermanager/src/main/java/io/github/bonigarcia/wdm/webdriver/WebDriverCreator.java | WebDriverCreator | createRemoteWebDriver | class WebDriverCreator {
final Logger log = getLogger(lookup().lookupClass());
static final int POLL_TIME_SEC = 1;
Config config;
public WebDriverCreator(Config config) {
this.config = config;
}
public synchronized WebDriver createLocalWebDriver(Class<?> browserClass,
Ca... |
WebDriver webdriver = null;
int waitTimeoutSec = config.getTimeout();
long timeoutMs = System.currentTimeMillis()
+ TimeUnit.SECONDS.toMillis(waitTimeoutSec);
String browserName = capabilities.getBrowserName();
log.debug("Creating WebDriver object for {} at {} w... | 308 | 420 | 728 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java | VManageBootstrap | main | class VManageBootstrap extends SpringBootServletInitializer {
private final static Logger logger = LoggerFactory.getLogger(VManageBootstrap.class);
private static String[] args;
private static ConfigurableApplicationContext context;
public static void main(String[] args) {<FILL_FUNCTION_BODY>}
// 项目重启
public st... |
VManageBootstrap.args = args;
VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args);
GitUtil gitUtil1 = SpringBeanFactory.getBean("gitUtil");
logger.info("构建版本: {}", gitUtil1.getBuildVersion());
logger.info("构建时间: {}", gitUtil1.getBuildDate());
logger.info("GIT最后提交时间: {}", gitUtil1... | 274 | 130 | 404 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/common/ApiSaveConstant.java | ApiSaveConstant | getVal | class ApiSaveConstant {
public static String getVal(String key) {<FILL_FUNCTION_BODY>}
} |
String[] keyItemArray = key.split("/");
if (keyItemArray.length <= 1 || !"api".equals(keyItemArray[1])) {
return null;
}
if (keyItemArray.length >= 4) {
switch (keyItemArray[2]) {
case "alarm":
if ("delete".equals(keyItemArray[... | 34 | 1,373 | 1,407 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/common/CivilCodePo.java | CivilCodePo | getInstance | class CivilCodePo {
private String code;
private String name;
private String parentCode;
public static CivilCodePo getInstance(String[] infoArray) {<FILL_FUNCTION_BODY>}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
... |
CivilCodePo civilCodePo = new CivilCodePo();
civilCodePo.setCode(infoArray[0]);
civilCodePo.setName(infoArray[1]);
civilCodePo.setParentCode(infoArray[2]);
return civilCodePo;
| 185 | 67 | 252 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/common/InviteInfo.java | InviteInfo | getInviteInfo | class InviteInfo {
private String deviceId;
private String channelId;
private String stream;
private SSRCInfo ssrcInfo;
private String receiveIp;
private Integer receivePort;
private String streamMode;
private InviteSessionType type;
private InviteSessionStatus status;
... |
InviteInfo inviteInfo = new InviteInfo();
inviteInfo.setDeviceId(deviceId);
inviteInfo.setChannelId(channelId);
inviteInfo.setStream(stream);
inviteInfo.setSsrcInfo(ssrcInfo);
inviteInfo.setReceiveIp(receiveIp);
inviteInfo.setReceivePort(receivePort);
inv... | 651 | 132 | 783 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/common/StreamURL.java | StreamURL | toString | class StreamURL implements Serializable,Cloneable {
@Schema(description = "协议")
private String protocol;
@Schema(description = "主机地址")
private String host;
@Schema(description = "端口")
private int port = -1;
@Schema(description = "定位位置")
private String file;
@Schema(description =... |
if (protocol != null && host != null && port != -1 ) {
return String.format("%s://%s:%s/%s", protocol, host, port, file);
}else {
return null;
}
| 412 | 63 | 475 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java | ApiAccessFilter | doFilterInternal | class ApiAccessFilter extends OncePerRequestFilter {
private final static Logger logger = LoggerFactory.getLogger(ApiAccessFilter.class);
@Autowired
private UserSetting userSetting;
@Autowired
private ILogService logService;
@Override
protected void doFilterInternal(HttpServletRequest ... |
String username = null;
if (SecurityUtils.getUserInfo() == null) {
username = servletRequest.getParameter("username");
}else {
username = SecurityUtils.getUserInfo().getUsername();
}
long start = System.currentTimeMillis(); // 请求进入时间
String uriNam... | 657 | 340 | 997 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java | CivilCodeFileConf | run | class CivilCodeFileConf implements CommandLineRunner {
private final static Logger logger = LoggerFactory.getLogger(CivilCodeFileConf.class);
@Autowired
@Lazy
private UserSetting userSetting;
@Override
public void run(String... args) throws Exception {<FILL_FUNCTION_BODY>}
} |
if (ObjectUtils.isEmpty(userSetting.getCivilCodeFile())) {
logger.warn("[行政区划] 文件未设置,可能造成目录刷新结果不完整");
return;
}
InputStream inputStream;
if (userSetting.getCivilCodeFile().startsWith("classpath:")){
String filePath = userSetting.getCivilCodeFile().sub... | 88 | 547 | 635 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java | CloudRecordTimer | execute | class CloudRecordTimer {
private final static Logger logger = LoggerFactory.getLogger(CloudRecordTimer.class);
@Autowired
private IMediaServerService mediaServerService;
@Autowired
private CloudRecordServiceMapper cloudRecordServiceMapper;
/**
* 定时查询待删除的录像文件
*/
// @Scheduled(fix... |
logger.info("[录像文件定时清理] 开始清理过期录像文件");
// 获取配置了assist的流媒体节点
List<MediaServer> mediaServerItemList = mediaServerService.getAllOnline();
if (mediaServerItemList.isEmpty()) {
return;
}
long result = 0;
for (MediaServer mediaServerItem : mediaServerItemLi... | 160 | 533 | 693 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java | DynamicTask | contains | class DynamicTask {
private final Logger logger = LoggerFactory.getLogger(DynamicTask.class);
private ThreadPoolTaskScheduler threadPoolTaskScheduler;
private final Map<String, ScheduledFuture<?>> futureMap = new ConcurrentHashMap<>();
private final Map<String, Runnable> runnableMap = new ConcurrentH... |
if(ObjectUtils.isEmpty(key)) {
return false;
}
return futureMap.get(key) != null;
| 1,314 | 37 | 1,351 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java | GlobalResponseAdvice | beforeBodyWrite | class GlobalResponseAdvice implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(@NotNull MethodParameter returnType, @NotNull Class<? extends HttpMessageConverter<?>> converterType) {
return true;
}
@Override
public Object beforeBodyWrite(Object body, @NotNull Method... |
// 排除api文档的接口,这个接口不需要统一
String[] excludePath = {"/v3/api-docs","/api/v1","/index/hook","/api/video-"};
for (String path : excludePath) {
if (request.getURI().getPath().startsWith(path)) {
return body;
}
}
if (body instanceof WVPResult) {
... | 197 | 207 | 404 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java | MybatisConfig | databaseIdProvider | class MybatisConfig {
@Autowired
private UserSetting userSetting;
@Bean
public DatabaseIdProvider databaseIdProvider() {<FILL_FUNCTION_BODY>}
@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource, DatabaseIdProvider databaseIdProvider) throws Exception {
final SqlSessi... |
VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
Properties properties = new Properties();
properties.setProperty("Oracle", "oracle");
properties.setProperty("MySQL", "mysql");
properties.setProperty("DB2", "db2");
properties.setProperty("Der... | 227 | 246 | 473 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java | RecordProxyServlet | rewriteUrlFromRequest | class RecordProxyServlet extends ProxyServlet{
@Override
protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) {
String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
MediaServer mediaInfo = getMediaIn... |
String requestURI = servletRequest.getRequestURI();
MediaServer mediaInfo = getMediaInfoByUri(requestURI);
String url = super.rewriteUrlFromRequest(servletRequest);
if (mediaInfo == null) {
logger.error("[录像服务访问代理],错误:处理url信息时未找到流媒体信息=>{}", requestURI);
... | 1,095 | 150 | 1,245 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/ServiceInfo.java | ServiceInfo | onApplicationEvent | class ServiceInfo implements ApplicationListener<WebServerInitializedEvent> {
private final Logger logger = LoggerFactory.getLogger(ServiceInfo.class);
private static int serverPort;
public static int getServerPort() {
return serverPort;
}
@Override
public void onApplicationEvent(Web... |
// 项目启动获取启动的端口号
ServiceInfo.serverPort = event.getWebServer().getPort();
logger.info("项目启动获取启动的端口号: " + ServiceInfo.serverPort);
| 128 | 56 | 184 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java | SipConfig | getShowIp | class SipConfig {
private String ip;
private String showIp;
private Integer port;
private String domain;
private String id;
private String password;
Integer ptzSpeed = 50;
Integer registerTimeInterval = 120;
private boolean alarm;
public void setIp(String ip) {
this.ip = ip;
}
public void setP... |
if (this.showIp == null) {
return this.ip;
}
return showIp;
| 449 | 33 | 482 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java | SipPlatformRunner | run | class SipPlatformRunner implements CommandLineRunner {
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private IPlatformService platformService;
@Autowired
private ISIPCommanderForPlatform sipCommanderForPlatform;
... |
// 获取所有启用的平台
List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true);
for (ParentPlatform parentPlatform : parentPlatforms) {
ParentPlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
... | 145 | 318 | 463 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java | SpringDocConfig | springShopOpenApi | class SpringDocConfig {
@Value("${doc.enabled: true}")
private boolean enable;
@Bean
public OpenAPI springShopOpenApi() {<FILL_FUNCTION_BODY>}
/**
* 添加分组
* @return
*/
@Bean
public GroupedOpenApi publicApi() {
return GroupedOpenApi.builder()
.group("1... |
Contact contact = new Contact();
contact.setName("pan");
contact.setEmail("648540858@qq.com");
return new OpenAPI()
.components(new Components()
.addSecuritySchemes(JwtUtils.HEADER, new SecurityScheme()
.type(Securi... | 501 | 186 | 687 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java | SystemInfoTimerTask | execute | class SystemInfoTimerTask {
private Logger logger = LoggerFactory.getLogger(SystemInfoTimerTask.class);
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Scheduled(fixedRate = 2000) //每1秒执行一次
public void execute(){<FILL_FUNCTION_BODY>}
} |
try {
double cpuInfo = SystemInfoUtils.getCpuInfo();
redisCatchStorage.addCpuInfo(cpuInfo);
double memInfo = SystemInfoUtils.getMemInfo();
redisCatchStorage.addMemInfo(memInfo);
Map<String, Double> networkInterfaces = SystemInfoUtils.getNetworkInterfa... | 95 | 174 | 269 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java | ThreadPoolTaskConfig | taskExecutor | class ThreadPoolTaskConfig {
public static final int cpuNum = Runtime.getRuntime().availableProcessors();
/**
* 默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
* 当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
* 当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
*/
/**
* 核心线程数(默认线... |
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setKeepAliveSeconds(keepAliveTime);
executor.setThreadNamePrefix(threadNamePre... | 380 | 176 | 556 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/VersionInfo.java | VersionInfo | getVersion | class VersionInfo {
@Autowired
GitUtil gitUtil;
public VersionPo getVersion() {<FILL_FUNCTION_BODY>}
} |
VersionPo versionPo = new VersionPo();
versionPo.setGIT_Revision(gitUtil.getGitCommitId());
versionPo.setGIT_BRANCH(gitUtil.getBranch());
versionPo.setGIT_URL(gitUtil.getGitUrl());
versionPo.setBUILD_DATE(gitUtil.getBuildDate());
versionPo.setGIT_Revision_SHORT(gitUtil.g... | 43 | 158 | 201 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java | WVPTimerTask | execute | class WVPTimerTask {
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Value("${server.port}")
private int serverPort;
@Autowired
private SipConfig sipConfig;
@Scheduled(fixedRate = 2 * 1000) //每3秒执行一次
public void execute(){<FILL_FUNCTION_BODY>}
} |
JSONObject jsonObject = new JSONObject();
jsonObject.put("ip", sipConfig.getIp());
jsonObject.put("port", serverPort);
redisCatchStorage.updateWVPInfo(jsonObject, 3);
| 112 | 62 | 174 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/exception/SsrcTransactionNotFoundException.java | SsrcTransactionNotFoundException | getMessage | class SsrcTransactionNotFoundException extends Exception{
private String deviceId;
private String channelId;
private String callId;
private String stream;
public SsrcTransactionNotFoundException(String deviceId, String channelId, String callId, String stream) {
this.deviceId = deviceId;
... |
StringBuffer msg = new StringBuffer();
msg.append(String.format("缓存事务信息未找到,device:%s channel: %s ", deviceId, channelId));
if (callId != null) {
msg.append(",callId: " + callId);
}
if (stream != null) {
msg.append(",stream: " + stream);
}
... | 207 | 110 | 317 | <methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.Throwable) ,public void <init>(java.lang.String, java.lang.Throwable) <variables>static final long serialVersionUID |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisMsgListenConfig.java | RedisMsgListenConfig | container | class RedisMsgListenConfig {
@Autowired
private RedisGpsMsgListener redisGPSMsgListener;
@Autowired
private RedisAlarmMsgListener redisAlarmMsgListener;
@Autowired
private RedisStreamMsgListener redisStreamMsgListener;
@Autowired
private RedisGbPlayMsgListener redisGbPlayMsgListener;
@Autowired
private R... |
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GPS));
container.addMessageListener(redisAlarmMsgListener, new PatternTo... | 342 | 432 | 774 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisTemplateConfig.java | RedisTemplateConfig | redisTemplate | class RedisTemplateConfig {
@Bean
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {<FILL_FUNCTION_BODY>}
} |
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
// 使用fastJson序列化
GenericFastJsonRedisSerializer fastJsonRedisSerializer = new GenericFastJsonRedisSerializer();
// value值的序列化采用fastJsonRedisSerializer
redisTemplate.setValueSerializer(fastJsonRedisSerializer);
... | 51 | 174 | 225 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java | AnonymousAuthenticationEntryPoint | commence | class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {<FILL_FUNCTION_BODY>}
} |
String jwt = request.getHeader(JwtUtils.getHeader());
JwtUser jwtUser = JwtUtils.verifyToken(jwt);
String username = jwtUser.getUserName();
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, jwtUser.getPassword() );
SecurityContextHolde... | 55 | 288 | 343 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/security/DefaultUserDetailsServiceImpl.java | DefaultUserDetailsServiceImpl | loadUserByUsername | class DefaultUserDetailsServiceImpl implements UserDetailsService {
private final static Logger logger = LoggerFactory.getLogger(DefaultUserDetailsServiceImpl.class);
@Autowired
private IUserService userService;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFo... |
if (StringUtils.isBlank(username)) {
logger.info("登录用户:{} 不存在", username);
throw new UsernameNotFoundException("登录用户:" + username + " 不存在");
}
// 查出密码
User user = userService.getUserByUsername(username);
if (user == null) {
logger.info("登录用户:... | 98 | 179 | 277 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java | JwtAuthenticationFilter | doFilterInternal | class JwtAuthenticationFilter extends OncePerRequestFilter {
@Autowired
private UserSetting userSetting;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {<FILL_FUNCTION_BODY>}
} |
// 忽略登录请求的token验证
String requestURI = request.getRequestURI();
if (requestURI.equalsIgnoreCase("/api/user/login")) {
chain.doFilter(request, response);
return;
}
if (!userSetting.isInterfaceAuthentication()) {
UsernamePasswordAuthenticationTo... | 78 | 658 | 736 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java | JwtUtils | verifyToken | class JwtUtils implements InitializingBean {
private static final Logger logger = LoggerFactory.getLogger(JwtUtils.class);
public static final String HEADER = "access-token";
public static final String API_KEY_HEADER = "api-key";
private static final String AUDIENCE = "Audience";
private static... |
JwtUser jwtUser = new JwtUser();
try {
JwtConsumer consumer = new JwtConsumerBuilder()
//.setRequireExpirationTime()
//.setMaxFutureValidityInMinutes(5256000)
.setAllowedClockSkewInSeconds(30)
.setRequireSubje... | 1,333 | 704 | 2,037 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/security/SecurityUtils.java | SecurityUtils | login | class SecurityUtils {
/**
* 描述根据账号密码进行调用security进行认证授权 主动调
* 用AuthenticationManager的authenticate方法实现
* 授权成功后将用户信息存入SecurityContext当中
* @param username 用户名
* @param password 密码
* @param authenticationManager 认证授权管理器,
* @see AuthenticationManager
* @return UserInfo 用户信息
... |
//使用security框架自带的验证token生成器 也可以自定义。
UsernamePasswordAuthenticationToken token =new UsernamePasswordAuthenticationToken(username,password);
//认证 如果失败,这里会自动异常后返回,所以这里不需要判断返回值是否为空,确定是否登录成功
Authentication authenticate = authenticationManager.authenticate(token);
LoginUser user = (L... | 475 | 132 | 607 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java | WebSecurityConfig | configure | class WebSecurityConfig extends WebSecurityConfigurerAdapter {
private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
@Autowired
private UserSetting userSetting;
@Autowired
private DefaultUserDetailsServiceImpl userDetailsService;
/**
* 登出成功的处理
*/
... |
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
// 设置不隐藏 未找到用户异常
provider.setHideUserNotFoundExceptions(true);
// 用户认证service - 查询数据库的逻辑
provider.setUserDetailsService(userDetailsService);
// 设置密码加密算法
provider.setPasswordEncoder(passwordEnco... | 1,186 | 106 | 1,292 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java | SipLayer | getUdpSipProvider | class SipLayer implements CommandLineRunner {
private final static Logger logger = LoggerFactory.getLogger(SipLayer.class);
@Autowired
private SipConfig sipConfig;
@Autowired
private ISIPProcessorObserver sipProcessorObserver;
@Autowired
private UserSetting userSetting;
private final Map<String, SipProvide... |
if (udpSipProviderMap.size() != 1) {
return null;
}
return udpSipProviderMap.values().stream().findFirst().get();
| 1,269 | 49 | 1,318 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java | DigestServerAuthenticationHelper | doAuthenticatePlainTextPassword | class DigestServerAuthenticationHelper {
private Logger logger = LoggerFactory.getLogger(DigestServerAuthenticationHelper.class);
private MessageDigest messageDigest;
public static final String DEFAULT_ALGORITHM = "MD5";
public static final String DEFAULT_SCHEME = "Digest";
/** to hex conver... |
AuthorizationHeader authHeader = (AuthorizationHeader) request.getHeader(AuthorizationHeader.NAME);
if ( authHeader == null || authHeader.getRealm() == null) {
return false;
}
String realm = authHeader.getRealm().trim();
String username = authHeader.getUsername().tri... | 1,179 | 864 | 2,043 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Gb28181Sdp.java | Gb28181Sdp | getInstance | class Gb28181Sdp {
private SessionDescription baseSdb;
private String ssrc;
private String mediaDescription;
public static Gb28181Sdp getInstance(SessionDescription baseSdb, String ssrc, String mediaDescription) {<FILL_FUNCTION_BODY>}
public SessionDescription getBaseSdb() {
return base... |
Gb28181Sdp gb28181Sdp = new Gb28181Sdp();
gb28181Sdp.setBaseSdb(baseSdb);
gb28181Sdp.setSsrc(ssrc);
gb28181Sdp.setMediaDescription(mediaDescription);
return gb28181Sdp;
| 230 | 107 | 337 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbSipDate.java | GbSipDate | encode | class GbSipDate extends SIPDate {
/**
*
*/
private static final long serialVersionUID = 1L;
private Calendar javaCal;
public GbSipDate(long timeMillis) {
this.javaCal = new GregorianCalendar(TimeZone.getDefault(), Locale.getDefault());
Date date = new Date(timeMillis);
... |
String var2;
if (this.month < 9) {
var2 = "0" + (this.month + 1);
} else {
var2 = "" + (this.month + 1);
}
String var3;
if (this.day < 10) {
var3 = "0" + this.day;
} else {
var3 = "" + this.day;
}
... | 752 | 420 | 1,172 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java | RecordItem | compareTo | class RecordItem implements Comparable<RecordItem>{
@Schema(description = "设备编号")
private String deviceId;
@Schema(description = "名称")
private String name;
@Schema(description = "文件路径名 (可选)")
private String filePath;
@Schema(description = "录像文件大小,单位:Byte(可选)")
private String fileSize;
@Schema(description... |
TemporalAccessor startTimeNow = DateUtil.formatter.parse(startTime);
TemporalAccessor startTimeParam = DateUtil.formatter.parse(recordItem.getStartTime());
Instant startTimeParamInstant = Instant.from(startTimeParam);
Instant startTimeNowInstant = Instant.from(startTimeNow);
if (startTimeNowInstant.equals(st... | 701 | 168 | 869 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java | SubscribeHolder | putCatalogSubscribe | class SubscribeHolder {
@Autowired
private DynamicTask dynamicTask;
@Autowired
private UserSetting userSetting;
private final String taskOverduePrefix = "subscribe_overdue_";
private static ConcurrentHashMap<String, SubscribeInfo> catalogMap = new ConcurrentHashMap<>();
private static Co... |
catalogMap.put(platformId, subscribeInfo);
if (subscribeInfo.getExpires() > 0) {
// 添加订阅到期
String taskOverdueKey = taskOverduePrefix + "catalog_" + platformId;
// 添加任务处理订阅过期
dynamicTask.startDelay(taskOverdueKey, () -> removeCatalogSubscribe(subscribeInf... | 981 | 118 | 1,099 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java | DefaultProperties | getProperties | class DefaultProperties {
public static Properties getProperties(String name, boolean sipLog) {<FILL_FUNCTION_BODY>}
} |
Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", name);
// properties.setProperty("javax.sip.IP_ADDRESS", ip);
// 关闭自动会话
properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
/**
* 完整配置参考 gov.nist.javax.sip.S... | 37 | 1,041 | 1,078 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java | ServerLoggerImpl | setSipStack | class ServerLoggerImpl implements ServerLogger {
private boolean showLog = true;
private SIPTransactionStack sipStack;
protected StackLogger stackLogger;
@Override
public void closeLogFile() {
}
@Override
public void logMessage(SIPMessage message, String from, String to, boolean se... |
if (!showLog) {
return;
}
if(sipStack instanceof SIPTransactionStack) {
this.sipStack = (SIPTransactionStack)sipStack;
this.stackLogger = CommonLogger.getLogger(SIPTransactionStack.class);
}
| 609 | 73 | 682 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/conf/StackLoggerImpl.java | StackLoggerImpl | log | class StackLoggerImpl implements StackLogger {
/**
* 完全限定类名(Fully Qualified Class Name),用于定位日志位置
*/
private static final String FQCN = StackLoggerImpl.class.getName();
/**
* 获取栈中类信息(以便底层日志记录系统能够提取正确的位置信息(方法名、行号))
* @return LocationAwareLogger
*/
private static LocationAwareLogger getLocationAwareLogger(... |
LocationAwareLogger locationAwareLogger = getLocationAwareLogger();
locationAwareLogger.log(null, FQCN, level, message, null, null);
| 815 | 45 | 860 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java | EventPublisher | catalogEventPublish | class EventPublisher {
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
/**
* 设备报警事件
* @param deviceAlarm
*/
public void deviceAlarmEventPublish(DeviceAlarm deviceAlarm) {
AlarmEvent alarmEvent = new AlarmEvent(this);
alarmEvent.setAlarmInfo(deviceAlarm);
applicationEventPub... |
List<DeviceChannel> deviceChannelList = new ArrayList<>();
deviceChannelList.add(deviceChannel);
catalogEventPublish(platformId, deviceChannelList, type);
| 920 | 48 | 968 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java | SipSubscribe | execute | class SipSubscribe {
private final Logger logger = LoggerFactory.getLogger(SipSubscribe.class);
private Map<String, SipSubscribe.Event> errorSubscribes = new ConcurrentHashMap<>();
private Map<String, SipSubscribe.Event> okSubscribes = new ConcurrentHashMap<>();
private Map<String, Instant> okTimeSu... |
logger.info("[定时任务] 清理过期的SIP订阅信息");
Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5));
for (String key : okTimeSubscribes.keySet()) {
if (okTimeSubscribes.get(key).isBefore(instant)){
okSubscribes.remove(key);
okTimeSubscribe... | 1,543 | 294 | 1,837 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java | AlarmEventListener | onApplicationEvent | class AlarmEventListener implements ApplicationListener<AlarmEvent> {
private static final Logger logger = LoggerFactory.getLogger(AlarmEventListener.class);
private static final Map<String, PrintWriter> SSE_CACHE = new ConcurrentHashMap<>();
public void addSseEmitter(String browserId, PrintWriter writer... |
if (logger.isDebugEnabled()) {
logger.debug("设备报警事件触发, deviceId: {}, {}", event.getAlarmInfo().getDeviceId(), event.getAlarmInfo().getAlarmDescription());
}
String msg = "<strong>设备编号:</strong> <i>" + event.getAlarmInfo().getDeviceId() + "</i>"
+ "<br><strong>通道编号:<... | 224 | 413 | 637 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/event/device/RequestTimeoutEventImpl.java | RequestTimeoutEventImpl | onApplicationEvent | class RequestTimeoutEventImpl implements ApplicationListener<RequestTimeoutEvent> {
@Autowired
private IDeviceService deviceService;
@Override
public void onApplicationEvent(RequestTimeoutEvent event) {<FILL_FUNCTION_BODY>}
} |
ClientTransaction clientTransaction = event.getTimeoutEvent().getClientTransaction();
if (clientTransaction != null) {
Request request = clientTransaction.getRequest();
if (request != null) {
String host = ((SipURI) request.getRequestURI()).getHost();
... | 65 | 152 | 217 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java | RecordEndEventListener | onApplicationEvent | class RecordEndEventListener implements ApplicationListener<RecordEndEvent> {
private final static Logger logger = LoggerFactory.getLogger(RecordEndEventListener.class);
private Map<String, RecordEndEventHandler> handlerMap = new ConcurrentHashMap<>();
public interface RecordEndEventHandler{
void ... |
String deviceId = event.getRecordInfo().getDeviceId();
String channelId = event.getRecordInfo().getChannelId();
int count = event.getRecordInfo().getCount();
int sumNum = event.getRecordInfo().getSumNum();
logger.info("录像查询完成事件触发,deviceId:{}, channelId: {}, 录像数量{}/{}条", event.ge... | 316 | 261 | 577 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEventLister.java | MobilePositionEventLister | onApplicationEvent | class MobilePositionEventLister implements ApplicationListener<MobilePositionEvent> {
private final static Logger logger = LoggerFactory.getLogger(MobilePositionEventLister.class);
@Autowired
private IVideoManagerStorage storager;
@Autowired
private SIPCommanderFroPlatform sipCommanderFroPlatform... |
// 获取所用订阅
List<String> platforms = subscribeHolder.getAllMobilePositionSubscribePlatform();
if (platforms.isEmpty()) {
return;
}
List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(event.getMobilePosition().getChannelId(), platforms);
... | 133 | 301 | 434 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/session/AudioBroadcastManager.java | AudioBroadcastManager | exit | class AudioBroadcastManager {
private final static Logger logger = LoggerFactory.getLogger(AudioBroadcastManager.class);
@Autowired
private SipConfig config;
public static Map<String, AudioBroadcastCatch> data = new ConcurrentHashMap<>();
public void update(AudioBroadcastCatch audioBroadcastCat... |
for (String key : data.keySet()) {
if (SipUtils.isFrontEnd(deviceId)) {
return key.equals(deviceId);
}else {
return key.equals(deviceId + channelId);
}
}
return false;
| 868 | 72 | 940 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java | CatalogDataCatch | timerTask | class CatalogDataCatch {
public static Map<String, CatalogData> data = new ConcurrentHashMap<>();
@Autowired
private IVideoManagerStorage storager;
public void addReady(Device device, int sn ) {
CatalogData catalogData = data.get(device.getDeviceId());
if (catalogData == null || catal... |
Set<String> keys = data.keySet();
Instant instantBefore5S = Instant.now().minusMillis(TimeUnit.SECONDS.toMillis(5));
Instant instantBefore30S = Instant.now().minusMillis(TimeUnit.SECONDS.toMillis(30));
for (String deviceId : keys) {
CatalogData catalogData = data.get(devic... | 1,026 | 523 | 1,549 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/session/CommonSessionManager.java | CommonSession | add | class CommonSession{
public String session;
public long createTime;
public int timeout;
public CommonCallback<Object> callback;
public CommonCallback<String> timeoutCallback;
}
/**
* 添加回调
* @param sessionId 唯一标识
* @param callback 回调
* @param timeout ... |
CommonSession commonSession = new CommonSession();
commonSession.session = sessionId;
commonSession.callback = callback;
commonSession.createTime = System.currentTimeMillis();
if (timeoutCallback != null) {
commonSession.timeoutCallback = timeoutCallback;
}
... | 139 | 108 | 247 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/session/RecordDataCatch.java | RecordDataCatch | put | class RecordDataCatch {
public static Map<String, RecordInfo> data = new ConcurrentHashMap<>();
@Autowired
private DeferredResultHolder deferredResultHolder;
@Autowired
private RecordEndEventListener recordEndEventListener;
public int put(String deviceId,String channelId, String sn, int sumN... |
String key = deviceId + sn;
RecordInfo recordInfo = data.get(key);
if (recordInfo == null) {
recordInfo = new RecordInfo();
recordInfo.setDeviceId(deviceId);
recordInfo.setChannelId(channelId);
recordInfo.setSn(sn.trim());
recordInfo.s... | 561 | 251 | 812 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java | SSRCFactory | initMediaServerSSRC | class SSRCFactory {
/**
* 播流最大并发个数
*/
private static final Integer MAX_STREAM_COUNT = 10000;
/**
* 播流最大并发个数
*/
private static final String SSRC_INFO_KEY = "VMP_SSRC_INFO_";
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
private SipConfig sipConfi... |
String sipDomain = sipConfig.getDomain();
String ssrcPrefix = sipDomain.length() >= 8 ? sipDomain.substring(3, 8) : sipDomain;
String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
List<String> ssrcList = new ArrayList<>();
for (int i = 1; i < MAX_ST... | 808 | 243 | 1,051 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java | VideoStreamSessionManager | getSSRC | class VideoStreamSessionManager {
@Autowired
private UserSetting userSetting;
@Autowired
private RedisTemplate<Object, Object> redisTemplate;
/**
* 添加一个点播/回放的事务信息
* 后续可以通过流Id/callID
* @param deviceId 设备ID
* @param channelId 通道ID
* @param callId 一次请求的CallID
* @param stream 流名称
* @param mediaServerI... |
SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream);
if (ssrcTransaction == null) {
return null;
}
return ssrcTransaction.getSsrc();
| 1,844 | 58 | 1,902 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java | SipRunner | run | class SipRunner implements CommandLineRunner {
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private SSRCFactory ssrcFactory;
@Autowired
private UserSetting userSetting;
@Autowired
private IDeviceService... |
List<Device> deviceList = deviceService.getAllOnlineDevice();
for (Device device : deviceList) {
if (deviceService.expire(device)){
deviceService.offline(device.getDeviceId(), "注册已过期");
}else {
deviceService.online(device, null);
}
... | 210 | 703 | 913 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/CatalogSubscribeTask.java | CatalogSubscribeTask | run | class CatalogSubscribeTask implements ISubscribeTask {
private final Logger logger = LoggerFactory.getLogger(CatalogSubscribeTask.class);
private Device device;
private final ISIPCommander sipCommander;
private SIPRequest request;
private DynamicTask dynamicTask;
private String taskKey = "cata... |
if (dynamicTask.get(taskKey) != null) {
dynamicTask.stop(taskKey);
}
SIPRequest sipRequest = null;
try {
sipRequest = sipCommander.catalogSubscribe(device, request, eventResult -> {
ResponseEvent event = (ResponseEvent) eventResult.event;
... | 622 | 365 | 987 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java | MobilePositionSubscribeTask | run | class MobilePositionSubscribeTask implements ISubscribeTask {
private final Logger logger = LoggerFactory.getLogger(MobilePositionSubscribeTask.class);
private Device device;
private ISIPCommander sipCommander;
private SIPRequest request;
private DynamicTask dynamicTask;
private String taskKey ... |
if (dynamicTask.get(taskKey) != null) {
dynamicTask.stop(taskKey);
}
SIPRequest sipRequest = null;
try {
sipRequest = sipCommander.mobilePositionSubscribe(device, request, eventResult -> {
// 成功
logger.info("[移动位置订阅]成功: {}", device... | 593 | 364 | 957 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java | SIPProcessorObserver | processResponse | class SIPProcessorObserver implements ISIPProcessorObserver {
private final static Logger logger = LoggerFactory.getLogger(SIPProcessorObserver.class);
private static Map<String, ISIPRequestProcessor> requestProcessorMap = new ConcurrentHashMap<>();
private static Map<String, ISIPResponseProcessor> respo... |
Response response = responseEvent.getResponse();
int status = response.getStatusCode();
// Success
if (((status >= Response.OK) && (status < Response.MULTIPLE_CHOICES)) || status == Response.UNAUTHORIZED) {
CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().ge... | 1,230 | 629 | 1,859 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java | SIPSender | transmitRequest | class SIPSender {
private final Logger logger = LoggerFactory.getLogger(SIPSender.class);
@Autowired
private SipLayer sipLayer;
@Autowired
private GitUtil gitUtil;
@Autowired
private SipSubscribe sipSubscribe;
public void transmitRequest(String ip, Message message) throws SipExcepti... |
ViaHeader viaHeader = (ViaHeader)message.getHeader(ViaHeader.NAME);
String transport = "UDP";
if (viaHeader == null) {
logger.warn("[消息头缺失]: ViaHeader, 使用默认的UDP方式处理数据");
}else {
transport = viaHeader.getTransport();
}
... | 487 | 652 | 1,139 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java | DeferredResultHolder | put | class DeferredResultHolder {
public static final String CALLBACK_CMD_DEVICESTATUS = "CALLBACK_DEVICESTATUS";
public static final String CALLBACK_CMD_DEVICEINFO = "CALLBACK_DEVICEINFO";
public static final String CALLBACK_CMD_DEVICECONTROL = "CALLBACK_DEVICECONTROL";
public static final String CALLBACK_CMD_D... |
Map<String, DeferredResultEx> deferredResultMap = map.get(key);
if (deferredResultMap == null) {
deferredResultMap = new ConcurrentHashMap<>();
map.put(key, deferredResultMap);
}
deferredResultMap.put(id, new DeferredResultEx(result));
| 1,359 | 90 | 1,449 | <no_super_class> |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java | AckRequestProcessor | process | class AckRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor {
private final Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class);
private final String method = "ACK";
@Autowired
private SIPProcessorObserver sipProcessorObserver;
@Override
public v... |
CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME);
dynamicTask.stop(callIdHeader.getCallId());
String fromUserId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser();
String toUserId = ((SipURI) ((HeaderAddress) evt.get... | 290 | 1,128 | 1,418 | <methods>public non-sealed void <init>() ,public HeaderFactory getHeaderFactory() ,public MessageFactory getMessageFactory() ,public Element getRootElement(RequestEvent) throws DocumentException,public Element getRootElement(RequestEvent, java.lang.String) throws DocumentException,public SIPResponse responseAck(SIPRequ... |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java | SubscribeRequestProcessor | processNotifyCatalogList | class SubscribeRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor {
private final Logger logger = LoggerFactory.getLogger(SubscribeRequestProcessor.class);
private final String method = "SUBSCRIBE";
@Autowired
private SIPProcessorObserver sipProcessorObserver;
@... |
if (request == null) {
return;
}
String platformId = SipUtils.getUserIdFromFromHeader(request);
String deviceId = XmlUtil.getText(rootElement, "DeviceID");
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
if (platform == null){
return;
}
SubscribeInfo subscribeInfo = ne... | 1,286 | 593 | 1,879 | <methods>public non-sealed void <init>() ,public HeaderFactory getHeaderFactory() ,public MessageFactory getMessageFactory() ,public Element getRootElement(RequestEvent) throws DocumentException,public Element getRootElement(RequestEvent, java.lang.String) throws DocumentException,public SIPResponse responseAck(SIPRequ... |
648540858_wvp-GB28181-pro | wvp-GB28181-pro/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java | InfoRequestProcessor | process | class InfoRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor {
private final static Logger logger = LoggerFactory.getLogger(InfoRequestProcessor.class);
private final String method = "INFO";
@Autowired
private SIPProcessorObserver sipProcessorObserver... |
logger.debug("接收到消息:" + evt.getRequest());
SIPRequest request = (SIPRequest) evt.getRequest();
String deviceId = SipUtils.getUserIdFromFromHeader(request);
CallIdHeader callIdHeader = request.getCallIdHeader();
// 先从会话内查找
SsrcTransaction ssrcTransaction = sessionManager.... | 279 | 1,074 | 1,353 | <methods>public non-sealed void <init>() ,public HeaderFactory getHeaderFactory() ,public MessageFactory getMessageFactory() ,public Element getRootElement(RequestEvent) throws DocumentException,public Element getRootElement(RequestEvent, java.lang.String) throws DocumentException,public SIPResponse responseAck(SIPRequ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.