Codota Logo
JSAgentBuilder
Code IndexAdd Codota to your IDE (free)

How to use
JSAgentBuilder
in
rocks.inspectit.agent.java.eum.instrumentation

Best Java code snippets using rocks.inspectit.agent.java.eum.instrumentation.JSAgentBuilder (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: inspectIT/inspectIT

/**
 * Builds the JS agent from single char arguments.
 *
 * @param arguments
 *            all arguments together as a string.
 * @return the generated stream which builds the agent.
 */
public String buildJsFile(String arguments) {
  StringBuilder script = new StringBuilder();
  script.append(JS_AGENT_PREAMBLE);
  script.append("window.inspectIT_settings.activeAgentModules = \"").append(arguments).append("\";");
  script.append(getAgentCoreSource());
  // prevent duplicates of the modules added
  Set<JSAgentModule> alreadyAddedModules = new HashSet<JSAgentModule>();
  // add the modules source code
  for (char moduleIdentifier : arguments.toCharArray()) {
    if (JSAgentModule.IDENTIFIER_MAP.containsKey(moduleIdentifier)) {
      JSAgentModule module = JSAgentModule.IDENTIFIER_MAP.get(moduleIdentifier);
      if (!alreadyAddedModules.contains(module)) {
        script.append(getAgentModuleSource(module));
        alreadyAddedModules.add(module);
      }
    }
  }
  script.append(JS_AGENT_EPILOGUE);
  return script.toString();
}
origin: inspectIT/inspectIT

/**
 * @return the core agent source code, either laoded from the resources or directly fetched form
 *         the cache.
 */
@SuppressWarnings({ "PMD" })
private String getAgentCoreSource() {
  if (agentCoreSource == null) {
    synchronized (JSAgentBuilder.class) {
      if (agentCoreSource == null) {
        try {
          agentCoreSource = readResourceFile(JSBASE_RESOURCE);
        } catch (Exception e) {
          LOG.error("unable to read JS Agent core");
          return "";
        }
      }
    }
  }
  return agentCoreSource;
}
origin: inspectIT/inspectIT

/**
 * Sends the script using the given response object.
 *
 * @param res
 *            the response to write
 * @param activeModules
 *            a String listing the identifiers of the active modules.
 */
private void sendScript(WHttpServletResponse res, String activeModules) {
  // we respond with the script code
  res.setStatus(200);
  res.setContentType("application/javascript");
  res.addHeader("Cache-Control", "public, max-age=" + JSAgentBuilder.JS_AGENT_CACHE_MAX_AGE_SECONDS);
  PrintWriter writer = res.getWriter();
  writer.write(agentBuilder.buildJsFile(activeModules));
  writer.flush();
}
origin: inspectIT/inspectIT

@BeforeMethod
public void initMocks() throws IOException, StorageException {
  eumConfig.setActiveModules("a12");
  eumConfig.setEnabled(true);
  eumConfig.setScriptBaseUrl("/baseUrl/");
  when(dummyRequest.getRequestURI()).thenReturn("/mycool/url/here");
  when(config.getEndUserMonitoringConfig()).thenReturn(eumConfig);
  when(dummyResponse.getWriter()).thenReturn(Mockito.mock(PrintWriter.class));
  when(dummyResponse.getOutputStream()).thenReturn(Mockito.mock(ServletOutputStream.class));
  when(agentBuilder.buildJsFile(any(String.class))).thenReturn(AGENT_CODE);
}
origin: inspectIT/inspectIT

/**
 * @param module
 *            the module of which the source code shall be returned
 * @return @return the modules source code, either loaded from the resources or directly fetched
 *         form the cache.
 */
private String getAgentModuleSource(JSAgentModule module) {
  if (!moduleSourceCache.containsKey(module)) {
    try {
      String src = readResourceFile(module.getModuleSourceFile());
      moduleSourceCache.putIfAbsent(module, src);
      return src;
    } catch (Exception e) {
      LOG.error("unable to read JS Agent core");
      return "";
    }
  } else {
    return moduleSourceCache.get(module);
  }
}
rocks.inspectit.agent.java.eum.instrumentationJSAgentBuilder

Javadoc

Helper class for creating a javascript agent which only has some specified modules (plugins).

Most used methods

  • buildJsFile
    Builds the JS agent from single char arguments.
  • getAgentCoreSource
  • getAgentModuleSource
  • readResourceFile
    Utility method for reading resource text files.

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • notifyDataSetChanged (ArrayAdapter)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • Kernel (java.awt.image)
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • ImageIO (javax.imageio)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now