_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q162800
JmxRequestFactory.normalizePathInfo
train
private static String normalizePathInfo(String pPathInfo) { if (pPathInfo != null && pPathInfo.length() > 0) { return pPathInfo.startsWith("/") ? pPathInfo.substring(1) : pPathInfo; } else { return ""; } }
java
{ "resource": "" }
q162801
JmxRequestFactory.getCreator
train
private static RequestCreator getCreator(RequestType pType) { RequestCreator creator = CREATOR_MAP.get(pType); if (creator == null) { throw new UnsupportedOperationException("Type " + pType + " is not supported (yet)"); } return creator; }
java
{ "resource": "" }
q162802
MimeTypeUtil.isValidCallback
train
public static boolean isValidCallback(String pCallback) { Pattern validJavaScriptFunctionNamePattern = Pattern.compile("^[$A-Z_][0-9A-Z_$]*$", Pattern.CASE_INSENSITIVE); return validJavaScriptFunctionNamePattern.matcher(pCallback).matches(); }
java
{ "resource": "" }
q162803
RestrictorFactory.lookupPolicyRestrictor
train
public static PolicyRestrictor lookupPolicyRestrictor(String pLocation) throws IOException { InputStream is; if (pLocation.startsWith("classpath:")) { String path = pLocation.substring("classpath:".length()); is = ClassUtil.getResourceAsStream(path); if (is == null) {...
java
{ "resource": "" }
q162804
DataUpdater.update
train
void update(JSONObject pJSONObject, MBeanInfo pMBeanInfo, Stack<String> pPathStack) { boolean isPathEmpty = pPathStack == null || pPathStack.empty(); String filter = pPathStack != null && !pPathStack.empty() ? pPathStack.pop() : null; verifyThatPathIsEmpty(pPathStack); JSONObject attrM...
java
{ "resource": "" }
q162805
DataUpdater.verifyThatPathIsEmpty
train
protected void verifyThatPathIsEmpty(Stack<String> pPathStack) { if (pPathStack != null && pPathStack.size() > 0) { throw new IllegalArgumentException("Path contains extra elements not usable for a list request: " + pPathStack); } }
java
{ "resource": "" }
q162806
ClientCertAuthenticator.checkCertForClientUsage
train
private void checkCertForClientUsage(X509Certificate clientCert) { try { // We required that the extended key usage must be present if we are using // client cert authentication if (extendedClientCheck && (clientCert.getExtendedKeyUsage() == null || ...
java
{ "resource": "" }
q162807
DelegatingRestrictor.checkRestrictorService
train
private boolean checkRestrictorService(RestrictorCheck pCheck, Object ... args) { try { ServiceReference[] serviceRefs = bundleContext.getServiceReferences(Restrictor.class.getName(),null); if (serviceRefs != null) { boolean ret = true; boolean found = fal...
java
{ "resource": "" }
q162808
DebugStore.log
train
public void log(String pMessage, Throwable pThrowable) { add(System.currentTimeMillis() / 1000,pMessage,pThrowable); }
java
{ "resource": "" }
q162809
DebugStore.debugInfo
train
public String debugInfo() { if (!isDebug || debugEntries.size() == 0) { return ""; } StringBuffer ret = new StringBuffer(); for (int i = debugEntries.size() - 1;i >= 0;i--) { Entry entry = debugEntries.get(i); ret.append(entry.timestamp).append(": ").a...
java
{ "resource": "" }
q162810
DebugStore.add
train
private synchronized void add(long pTime,String message) { debugEntries.addFirst(new Entry(pTime,message)); trim(); }
java
{ "resource": "" }
q162811
Configuration.updateGlobalConfiguration
train
public void updateGlobalConfiguration(ConfigExtractor pExtractor) { Enumeration e = pExtractor.getNames(); while (e.hasMoreElements()) { String keyS = (String) e.nextElement(); ConfigKey key = ConfigKey.getGlobalConfigKey(keyS); if (key != null) { glob...
java
{ "resource": "" }
q162812
Configuration.updateGlobalConfiguration
train
public void updateGlobalConfiguration(Map<String, String> pConfig) { for (ConfigKey c : ConfigKey.values()) { if (c.isGlobalConfig()) { String value = pConfig.get(c.getKeyValue()); if (value != null) { globalConfig.put(c,value); } ...
java
{ "resource": "" }
q162813
Configuration.get
train
public String get(ConfigKey pKey) { String value = globalConfig.get(pKey); if (value == null) { value = pKey.getDefaultValue(); } return value; }
java
{ "resource": "" }
q162814
Configuration.getAsInt
train
public int getAsInt(ConfigKey pKey) { int ret; try { ret = Integer.parseInt(get(pKey)); } catch (NumberFormatException exp) { ret = Integer.parseInt(pKey.getDefaultValue()); } return ret; }
java
{ "resource": "" }
q162815
Configuration.getProcessingParameters
train
public ProcessingParameters getProcessingParameters(Map<String,String> pParams) { Map<ConfigKey,String> procParams = ProcessingParameters.convertToConfigMap(pParams); for (Map.Entry<ConfigKey,String> entry : globalConfig.entrySet()) { ConfigKey key = entry.getKey(); if (key.isReq...
java
{ "resource": "" }
q162816
CleanupThread.enumerateThreads
train
private Thread[] enumerateThreads() { boolean fits = false; int inc = 50; Thread[] threads = null; int nrThreads = 0; while (!fits) { try { threads = new Thread[Thread.activeCount()+inc]; nrThreads = Thread.enumerate(threads); ...
java
{ "resource": "" }
q162817
CleanupThread.joinThreads
train
private boolean joinThreads(Thread pThreads[]) { for (int i=0;i< pThreads.length;i++) { final Thread t = pThreads[i]; if (t.isDaemon() || t.getThreadGroup() == null || // has died on us t.getThreadGroup().equals(threadGroup) || ...
java
{ "resource": "" }
q162818
JolokiaActivator.getHttpContext
train
public synchronized HttpContext getHttpContext() { if (jolokiaHttpContext == null) { final String user = getConfiguration(USER); final String authMode = getConfiguration(AUTH_MODE); if (user == null) { if (ServiceAuthenticationHttpContext.shouldBeUsed(authMode...
java
{ "resource": "" }
q162819
JolokiaActivator.getConfiguration
train
private Dictionary<String,String> getConfiguration() { Dictionary<String,String> config = new Hashtable<String,String>(); for (ConfigKey key : ConfigKey.values()) { String value = getConfiguration(key); if (value != null) { config.put(key.getKeyValue(),value); ...
java
{ "resource": "" }
q162820
ObjectSerializationContext.push
train
void push(Object object) { callStack.push(object); if (object != null && !SIMPLE_TYPES.contains(object.getClass())) { objectsInCallStack.add(object); } objectCount++; }
java
{ "resource": "" }
q162821
ObjectSerializationContext.pop
train
Object pop() { Object ret = callStack.pop(); if (ret != null && !SIMPLE_TYPES.contains(ret.getClass())) { objectsInCallStack.remove(ret); } return ret; }
java
{ "resource": "" }
q162822
MBeanAccessChecker.extractMbeanConfiguration
train
private void extractMbeanConfiguration(NodeList pNodes,MBeanPolicyConfig pConfig) throws MalformedObjectNameException { for (int i = 0;i< pNodes.getLength();i++) { Node node = pNodes.item(i); if (node.getNodeType() != Node.ELEMENT_NODE) { continue; } ...
java
{ "resource": "" }
q162823
MBeanAccessChecker.wildcardMatch
train
private boolean wildcardMatch(Set<String> pValues, String pValue) { for (String pattern : pValues) { if (pattern.contains("*") && pValue.matches(pattern.replaceAll("\\*",".*"))) { return true; } } return false; }
java
{ "resource": "" }
q162824
GlassfishDetector.extractVersionFromFullVersion
train
private String extractVersionFromFullVersion(String pFullVersion) { if (pFullVersion != null) { Matcher matcher = GLASSFISH_VERSION.matcher(pFullVersion); if (matcher.matches()) { serverName = GLASSFISH_NAME; vendorName = GLASSFISH_VENDOR_NAME; ...
java
{ "resource": "" }
q162825
GlassfishDetector.bootAmx
train
private synchronized boolean bootAmx(MBeanServerExecutor pServers, final LogHandler pLoghandler) { ObjectName bootMBean = null; try { bootMBean = new ObjectName("amx-support:type=boot-amx"); } catch (MalformedObjectNameException e) { // Cannot happen .... } ...
java
{ "resource": "" }
q162826
SimplifierExtractor.addExtractor
train
protected final void addExtractor(String pName, AttributeExtractor<T> pExtractor) { extractorMap.put(pName,pExtractor); }
java
{ "resource": "" }
q162827
HistoryStore.setGlobalMaxEntries
train
public synchronized void setGlobalMaxEntries(int pGlobalMaxEntries) { globalMaxEntries = pGlobalMaxEntries; // Refresh all entries for (HistoryEntry entry : historyStore.values()) { entry.setMaxEntries(globalMaxEntries); } }
java
{ "resource": "" }
q162828
HistoryStore.configure
train
public synchronized void configure(HistoryKey pKey, HistoryLimit pHistoryLimit) { // Remove entries if set to null if (pHistoryLimit == null) { removeEntries(pKey); return; } HistoryLimit limit = pHistoryLimit.respectGlobalMaxEntries(globalMaxEntries); if...
java
{ "resource": "" }
q162829
HistoryStore.updateAndAdd
train
public synchronized void updateAndAdd(JmxRequest pJmxReq, JSONObject pJson) { long timestamp = System.currentTimeMillis() / 1000; pJson.put(KEY_TIMESTAMP,timestamp); RequestType type = pJmxReq.getType(); HistoryUpdater updater = historyUpdaters.get(type); if (updater != null) {...
java
{ "resource": "" }
q162830
HistoryStore.getSize
train
public synchronized int getSize() { try { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ObjectOutputStream oOut = new ObjectOutputStream(bOut); oOut.writeObject(historyStore); bOut.close(); return bOut.size(); } catch (IOException e...
java
{ "resource": "" }
q162831
HistoryStore.initHistoryUpdaters
train
private void initHistoryUpdaters() { historyUpdaters.put(RequestType.EXEC, new HistoryUpdater<JmxExecRequest>() { /** {@inheritDoc} */ public void updateHistory(JSONObject pJson,JmxExecRequest request, long pTimestamp) {...
java
{ "resource": "" }
q162832
HistoryStore.updateReadHistory
train
private void updateReadHistory(JmxReadRequest pJmxReq, JSONObject pJson, long pTimestamp) { ObjectName name = pJmxReq.getObjectName(); if (name.isPattern()) { // We have a pattern and hence a value structure // of bean -> attribute_key -> attribute_value Map<String,O...
java
{ "resource": "" }
q162833
HistoryStore.addAttributeFromSingleValue
train
private JSONObject addAttributeFromSingleValue(HistoryKey pKey, String pAttrName, Object pValue, long pTimestamp) { HistoryEntry entry = getEntry(pKey,pValue,pTimestamp); return entry != null ? addToHistoryEntryAndGetCurrentHistory(new JSONObject(), entry, pAttrName, pValue, pTimestamp) ...
java
{ "resource": "" }
q162834
J4pClient.extractResponses
train
private <R extends J4pResponse<T>, T extends J4pRequest> List<R> extractResponses(JSONAware pJsonResponse, List<T> pRequests, J4pResponseExtractor p...
java
{ "resource": "" }
q162835
J4pClient.mapException
train
private J4pException mapException(Exception pException) throws J4pException { if (pException instanceof ConnectException) { return new J4pConnectException( "Cannot connect to " + requestHandler.getJ4pServerUrl() + ": " + pException.getMessage(), (ConnectExcept...
java
{ "resource": "" }
q162836
J4pClient.verifyBulkJsonResponse
train
private void verifyBulkJsonResponse(JSONAware pJsonResponse) throws J4pException { if (!(pJsonResponse instanceof JSONArray)) { if (pJsonResponse instanceof JSONObject) { JSONObject errorObject = (JSONObject) pJsonResponse; if (!errorObject.containsKey("status") || (...
java
{ "resource": "" }
q162837
BackendManager.handleRequest
train
public JSONObject handleRequest(JmxRequest pJmxReq) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException { lazyInitIfNeeded(); boolean debug = isDebug(); long time = 0; if (debug) { time = System.currentT...
java
{ "resource": "" }
q162838
BackendManager.convertExceptionToJson
train
public Object convertExceptionToJson(Throwable pExp, JmxRequest pJmxReq) { JsonConvertOptions opts = getJsonConvertOptions(pJmxReq); try { JSONObject expObj = (JSONObject) converters.getToJsonConverter().convertToJson(pExp,null,opts); return expObj; ...
java
{ "resource": "" }
q162839
BackendManager.isRemoteAccessAllowed
train
public boolean isRemoteAccessAllowed(String pRemoteHost, String pRemoteAddr) { return restrictor.isRemoteAccessAllowed(pRemoteHost != null ? new String[] { pRemoteHost, pRemoteAddr } : new String[] { ...
java
{ "resource": "" }
q162840
BackendManager.info
train
public void info(String msg) { logHandler.info(msg); if (debugStore != null) { debugStore.log(msg); } }
java
{ "resource": "" }
q162841
BackendManager.debug
train
public void debug(String msg) { logHandler.debug(msg); if (debugStore != null) { debugStore.log(msg); } }
java
{ "resource": "" }
q162842
BackendManager.init
train
private void init(Configuration pConfig) { // Central objects converters = new Converters(); initLimits(pConfig); // Create and remember request dispatchers localDispatcher = new LocalRequestDispatcher(converters, restrictor, ...
java
{ "resource": "" }
q162843
BackendManager.createRequestDispatchers
train
private List<RequestDispatcher> createRequestDispatchers(Configuration pConfig, Converters pConverters, ServerHandle pServerHandle, Restr...
java
{ "resource": "" }
q162844
BackendManager.createDispatcher
train
private RequestDispatcher createDispatcher(String pDispatcherClass, Converters pConverters, ServerHandle pServerHandle, Restrictor pRestrictor, ...
java
{ "resource": "" }
q162845
BackendManager.callRequestDispatcher
train
private JSONObject callRequestDispatcher(JmxRequest pJmxReq) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException { Object retValue = null; boolean useValueWithPath = false; boolean found = false; ...
java
{ "resource": "" }
q162846
BackendManager.initMBeans
train
private void initMBeans(Configuration pConfig) { int maxEntries = pConfig.getAsInt(HISTORY_MAX_ENTRIES); int maxDebugEntries = pConfig.getAsInt(DEBUG_MAX_ENTRIES); historyStore = new HistoryStore(maxEntries); debugStore = new DebugStore(maxDebugEntries, pConfig.getAsBoolean(DEBUG)); ...
java
{ "resource": "" }
q162847
BackendManager.intError
train
private void intError(String message,Throwable t) { logHandler.error(message, t); debugStore.log(message, t); }
java
{ "resource": "" }
q162848
OptionsAndArgs.lookupJarFile
train
public static File lookupJarFile() { try { return new File(OptionsAndArgs.class .getProtectionDomain() .getCodeSource() .getLocation() .toURI()); } ...
java
{ "resource": "" }
q162849
OptionsAndArgs.getNextListIndexSuffix
train
private String getNextListIndexSuffix(Map<String, String> options, String key) { if (!options.containsKey(key)) { return ""; } else { int i = 1; while (options.containsKey(key + "." + i)) { i++; } return "." + i; } }
java
{ "resource": "" }
q162850
OptionsAndArgs.init
train
private void init(Set<String> pCommands, String ... pArgs) { quiet = options.containsKey("quiet"); verbose = options.containsKey("verbose"); jarFile = lookupJarFile(); // Special cases first extraArgs = checkCommandAndArgs(pCommands, pArgs); }
java
{ "resource": "" }
q162851
CommandDispatcher.dispatchCommand
train
public int dispatchCommand(Object pVm,VirtualMachineHandler pHandler) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { String commandName = options.getCommand(); AbstractBaseCommand command = COMMANDS.get(commandName); if (command == null) { throw new...
java
{ "resource": "" }
q162852
MBeanServerExecutorLocal.handleRequest
train
public <R extends JmxRequest> Object handleRequest(JsonRequestHandler<R> pRequestHandler, R pJmxReq) throws MBeanException, ReflectionException, AttributeNotFoundException, InstanceNotFoundException, NotChangedException { AttributeNotFoundException attrException = null; InstanceNotFoundExcep...
java
{ "resource": "" }
q162853
JolokiaCipher.encrypt
train
public String encrypt(final String pText) throws GeneralSecurityException { byte[] clearBytes = pText.getBytes(Charset.forName("UTF-8")); byte[] salt = getSalt(SALT_SIZE); Cipher cipher = createCipher(salt, Cipher.ENCRYPT_MODE); byte[] encryptedBytes = cipher.doFinal(clearBytes); ...
java
{ "resource": "" }
q162854
ParsedUri.getParameter
train
public String getParameter(String name) { String[] values = parameters.get(name); if (values == null) { return null; } if (values.length == 0) { return ""; } return values[0]; }
java
{ "resource": "" }
q162855
ParsedUri.parseQuery
train
private Map<String, String[]> parseQuery(String qs) { Map<String, String[]> ret = new TreeMap<String, String[]>(); try { String pairs[] = qs.split("&"); for (String pair : pairs) { String name; String value; int pos = pair.indexOf(...
java
{ "resource": "" }
q162856
AbstractBaseCommand.getProcessDescription
train
protected String getProcessDescription(OptionsAndArgs pOpts, VirtualMachineHandler pHandler) { if (pOpts.getPid() != null) { return "PID " + pOpts.getPid(); } else if (pOpts.getProcessPattern() != null) { StringBuffer desc = new StringBuffer("process matching \"") ...
java
{ "resource": "" }
q162857
JolokiaServer.start
train
public void start() { // URL as configured takes precedence String configUrl = NetworkUtil.replaceExpression(config.getJolokiaConfig().get(ConfigKey.DISCOVERY_AGENT_URL)); jolokiaHttpHandler.start(lazy,configUrl != null ? configUrl : url, config.getAuthenticator() != null); if (httpServ...
java
{ "resource": "" }
q162858
JolokiaServer.init
train
protected final void init(JolokiaServerConfig pConfig, boolean pLazy) throws IOException { // We manage it on our own httpServer = createHttpServer(pConfig); init(httpServer, pConfig, pLazy); }
java
{ "resource": "" }
q162859
JolokiaServer.createHttpServer
train
private HttpServer createHttpServer(JolokiaServerConfig pConfig) throws IOException { int port = pConfig.getPort(); InetAddress address = pConfig.getAddress(); InetSocketAddress socketAddress = new InetSocketAddress(address,port); HttpServer server = pConfig.useHttps() ? ...
java
{ "resource": "" }
q162860
MBeanInfoData.addException
train
private void addException(ObjectName pName, Exception pExp) { JSONObject mBeansMap = getOrCreateJSONObject(infoMap, pName.getDomain()); JSONObject mBeanMap = getOrCreateJSONObject(mBeansMap, getKeyPropertyString(pName)); mBeanMap.put(DataKeys.ERROR.getKey(), pExp.toString()); }
java
{ "resource": "" }
q162861
MBeanInfoData.truncatePathStack
train
private Stack<String> truncatePathStack(int pLevel) { if (pathStack.size() < pLevel) { return new Stack<String>(); } else { // Trim of domain and MBean properties // pathStack gets cloned here since the processing will eat it up Stack<String> ret = (Stack<...
java
{ "resource": "" }
q162862
MBeanInfoData.navigatePath
train
private Object navigatePath() { int size = pathStack.size(); JSONObject innerMap = infoMap; while (size > 0) { Collection vals = innerMap.values(); if (vals.size() == 0) { return innerMap; } else if (vals.size() != 1) { throw n...
java
{ "resource": "" }
q162863
EclipseMuleAgentHttpServer.getServer
train
protected Server getServer(MuleAgentConfig pConfig) { Server newServer = new Server(); Connector connector = createConnector(newServer); if (pConfig.getHost() != null) { ClassUtil.applyMethod(connector, "setHost", pConfig.getHost()); } ClassUtil.applyMethod(connector...
java
{ "resource": "" }
q162864
AgentDetails.setServerInfo
train
public void setServerInfo(String pVendor, String pProduct, String pVersion) { checkSeal(); serverVendor = pVendor; serverProduct = pProduct; serverVersion = pVersion; }
java
{ "resource": "" }
q162865
AgentDetails.toJSONObject
train
public JSONObject toJSONObject() { JSONObject resp = new JSONObject(); add(resp, URL,url); if (secured != null) { add(resp, SECURED, secured); } add(resp, SERVER_VENDOR, serverVendor); add(resp, SERVER_PRODUCT, serverProduct); add(resp, SERVER_VERSION,...
java
{ "resource": "" }
q162866
MultiAuthenticator.authenticate
train
@Override public Result authenticate(HttpExchange httpExchange) { Result result = null; for (Authenticator a : authenticators) { result = a.authenticate(httpExchange); if ((result instanceof Success && mode == Mode.ANY) || (!(result instanceof Success) && mode...
java
{ "resource": "" }
q162867
J4pRequestHandler.getHttpRequest
train
public HttpUriRequest getHttpRequest(J4pRequest pRequest, String pPreferredMethod, Map<J4pQueryParameter, String> pProcessingOptions) throws UnsupportedEncodingException, URISyntaxException { String method = pPreferredMethod; if (method == null) { met...
java
{ "resource": "" }
q162868
J4pRequestHandler.getHttpRequest
train
public <T extends J4pRequest> HttpUriRequest getHttpRequest(List<T> pRequests,Map<J4pQueryParameter,String> pProcessingOptions) throws UnsupportedEncodingException, URISyntaxException { JSONArray bulkRequest = new JSONArray(); String queryParams = prepareQueryParameters(pProcessingOptions); ...
java
{ "resource": "" }
q162869
J4pRequestHandler.extractJsonResponse
train
@SuppressWarnings("PMD.PreserveStackTrace") public JSONAware extractJsonResponse(HttpResponse pHttpResponse) throws IOException, ParseException { HttpEntity entity = pHttpResponse.getEntity(); try { JSONParser parser = new JSONParser(); Header contentEncoding = entity.getCont...
java
{ "resource": "" }
q162870
J4pRequestHandler.createRequestURI
train
private URI createRequestURI(String path,String queryParams) throws URISyntaxException { return new URI(j4pServerUrl.getScheme(), j4pServerUrl.getUserInfo(), j4pServerUrl.getHost(), j4pServerUrl.getPort(), ...
java
{ "resource": "" }
q162871
J4pRequestHandler.prepareQueryParameters
train
private String prepareQueryParameters(Map<J4pQueryParameter, String> pProcessingOptions) { if (pProcessingOptions != null && pProcessingOptions.size() > 0) { StringBuilder queryParams = new StringBuilder(); for (Map.Entry<J4pQueryParameter,String> entry : pProcessingOptions.entrySet()) {...
java
{ "resource": "" }
q162872
JsonRequestHandler.checkHttpMethod
train
private void checkHttpMethod(R pRequest) { if (!restrictor.isHttpMethodAllowed(pRequest.getHttpMethod())) { throw new SecurityException("HTTP method " + pRequest.getHttpMethod().getMethod() + " is not allowed according to the installed security policy"); } }
java
{ "resource": "" }
q162873
JsonRequestHandler.checkForModifiedSince
train
protected void checkForModifiedSince(MBeanServerExecutor pServerManager, JmxRequest pRequest) throws NotChangedException { int ifModifiedSince = pRequest.getParameterAsInt(ConfigKey.IF_MODIFIED_SINCE); if (!pServerManager.hasMBeansListChangedSince(ifModifiedSince)) { throw new No...
java
{ "resource": "" }
q162874
MortbayMuleAgentHttpServer.getServer
train
private Server getServer(MuleAgentConfig pConfig) { Server newServer = new Server(); Connector connector = new SelectChannelConnector(); if (pConfig.getHost() != null) { connector.setHost(pConfig.getHost()); } connector.setPort(pConfig.getPort()); newServer.s...
java
{ "resource": "" }
q162875
WeblogicDetector.addMBeanServers
train
@Override public void addMBeanServers(Set<MBeanServerConnection> servers) { // Weblogic stores the MBeanServer in a JNDI context // Workaround for broken JBoss 4.2.3 which doesn't like JNDI lookups. See #123 for details. if (!isJBoss()) { InitialContext ctx; try { ...
java
{ "resource": "" }
q162876
JolokiaMuleAgent.getDescription
train
@Override public String getDescription() { String hostDescr = host; try { if (hostDescr == null) { hostDescr = NetworkUtil.getLocalAddress().getHostName(); } } catch (IOException e) { hostDescr = "localhost"; } return "Jolok...
java
{ "resource": "" }
q162877
JolokiaMBeanServerUtil.getJolokiaMBeanServer
train
public static MBeanServer getJolokiaMBeanServer() { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); MBeanServer jolokiaMBeanServer; try { jolokiaMBeanServer = (MBeanServer) server.getAttribute(createObjectName(JolokiaMBeanServerHolderMBean.OBJECT_...
java
{ "resource": "" }
q162878
JolokiaMBeanServerUtil.registerJolokiaMBeanServerHolderMBean
train
static MBeanServer registerJolokiaMBeanServerHolderMBean(MBeanServer pServer) { JolokiaMBeanServerHolder holder = new JolokiaMBeanServerHolder(); ObjectName holderName = createObjectName(JolokiaMBeanServerHolderMBean.OBJECT_NAME); MBeanServer jolokiaMBeanServer; try { pServer...
java
{ "resource": "" }
q162879
ExecHandler.verifyArguments
train
private void verifyArguments(JmxExecRequest request, OperationAndParamType pTypes, int pNrParams, List<Object> pArgs) { if ( (pNrParams > 0 && pArgs == null) || (pArgs != null && pArgs.size() != pNrParams)) { throw new IllegalArgumentException("Invalid number of operation arguments. Operation " + ...
java
{ "resource": "" }
q162880
ExecHandler.extractOperationTypes
train
private OperationAndParamType extractOperationTypes(MBeanServerConnection pServer, JmxExecRequest pRequest) throws ReflectionException, InstanceNotFoundException, IOException { if (pRequest.getOperation() == null) { throw new IllegalArgumentException("No operation given for exec Request ...
java
{ "resource": "" }
q162881
ExecHandler.extractMBeanParameterInfos
train
private List<MBeanParameterInfo[]> extractMBeanParameterInfos(MBeanServerConnection pServer, JmxExecRequest pRequest, String pOperation) throws InstanceNotFoundException, ReflectionException, IOException { try { MBeanInfo ...
java
{ "resource": "" }
q162882
ExecHandler.splitOperation
train
private List<String> splitOperation(String pOperation) { List<String> ret = new ArrayList<String>(); Pattern p = Pattern.compile("^(.*)\\((.*)\\)$"); Matcher m = p.matcher(pOperation); if (m.matches()) { ret.add(m.group(1)); if (m.group(2).length() > 0) { ...
java
{ "resource": "" }
q162883
AbstractImmutableSubstitutionImpl.composeWith
train
@Override public ImmutableSubstitution<ImmutableTerm> composeWith(ImmutableSubstitution<? extends ImmutableTerm> f) { if (isEmpty()) { return (ImmutableSubstitution<ImmutableTerm>)f; } if (f.isEmpty()) { return (ImmutableSubstitution<ImmutableTerm>)this; } ...
java
{ "resource": "" }
q162884
AbstractImmutableSubstitutionImpl.computeUnionMap
train
protected Optional<ImmutableMap<Variable, T>> computeUnionMap(ImmutableSubstitution<T> otherSubstitution) { ImmutableMap.Builder<Variable, T> mapBuilder = ImmutableMap.builder(); mapBuilder.putAll(getImmutableMap()); ImmutableMap<Variable, T> otherMap = otherSubstitution.getImmutableMap(); ...
java
{ "resource": "" }
q162885
AbstractImmutableSubstitutionImpl.applyNullNormalization
train
private Map.Entry<Variable, ImmutableTerm> applyNullNormalization( Map.Entry<Variable, ImmutableTerm> substitutionEntry) { ImmutableTerm value = substitutionEntry.getValue(); if (value instanceof ImmutableFunctionalTerm) { ImmutableTerm newValue = normalizeFunctionalTerm((Immutab...
java
{ "resource": "" }
q162886
MappingOntologyComplianceValidatorImpl.getPredicateIRI
train
private Optional<IRI> getPredicateIRI(DataRangeExpression expression) { if (expression instanceof Datatype) { return Optional.of(((Datatype) expression).getIRI()); } if (expression instanceof DataPropertyRangeExpression) { return Optional.of(((DataPropertyRangeExpression)...
java
{ "resource": "" }
q162887
LocalJDBCConnectionUtils.createConnection
train
public static Connection createConnection(OntopSQLCredentialSettings settings) throws SQLException { try { // This should work in most cases (e.g. from CLI, Protege, or Jetty) return DriverManager.getConnection(settings.getJdbcUrl(), settings.getJdbcUser(), settings.getJdbcPassword()); ...
java
{ "resource": "" }
q162888
DatabaseRelationDefinition.addAttribute
train
public Attribute addAttribute(QuotedID id, int type, String typeName, boolean canNull) { Attribute att = new Attribute(this, new QualifiedAttributeID(getID(), id), attributes.size() + 1, type, typeName, canNull, typeMapper.getTermType(type, typeName)); //check for duplicate names (put returns the previou...
java
{ "resource": "" }
q162889
DatabaseRelationDefinition.getAttribute
train
@Override public Attribute getAttribute(int index) { Attribute attribute = attributes.get(index - 1); return attribute; }
java
{ "resource": "" }
q162890
IndempotentVar2VarSubstitutionImpl.isIndempotent
train
public static boolean isIndempotent(Map<Variable, Variable> substitutionMap) { if (substitutionMap.isEmpty()) return true; Set<Variable> valueSet = new HashSet<>(substitutionMap.values()); valueSet.retainAll(substitutionMap.entrySet()); return valueSet.isEmpty(); }
java
{ "resource": "" }
q162891
SparqlAlgebraToDatalogTranslator.translate
train
public InternalSparqlQuery translate(ParsedQuery pq) throws OntopUnsupportedInputQueryException, OntopInvalidInputQueryException { if (predicateIdx != 0 || !program.getRules().isEmpty()) throw new IllegalStateException("SparqlAlgebraToDatalogTranslator.translate can only be called once."); Tuple...
java
{ "resource": "" }
q162892
QueryGroupTreeElement.removeQuery
train
public QueryTreeElement removeQuery(String query_id) { for (QueryTreeElement query : queries) { if (query.getID().equals(query_id)) { queries.remove(query); return query; } } return null; }
java
{ "resource": "" }
q162893
QueryGroupTreeElement.getQuery
train
public QueryTreeElement getQuery(String id) { for (QueryTreeElement query : queries) { if (query.getID().equals(id)) { return query; } } return null; }
java
{ "resource": "" }
q162894
DefaultTree.getParentTreeNode
train
private TreeNode getParentTreeNode(TreeNode child) { TreeNode parentTreeNode = parentIndex.get(child); if (parentTreeNode == null) return null; // Makes sure the parent node is still present in the tree else if (contains(parentTreeNode.getQueryNode())) return pa...
java
{ "resource": "" }
q162895
AbstractOntopQuery.getQueryString
train
protected String getQueryString() { if (bindings.size() == 0) return queryString; String qry = queryString; int b = qry.indexOf('{'); String select = qry.substring(0, b); String where = qry.substring(b); for (String name : bindings.getBindingNames()) { ...
java
{ "resource": "" }
q162896
OneShotSQLGeneratorEngine.getBooleanConditions
train
private Set<String> getBooleanConditions(List<Function> atoms, AliasIndex index) { Set<String> conditions = new LinkedHashSet<>(); for (Function atom : atoms) { if (atom.isOperation()) { // Boolean expression if (atom.getFunctionSymbol() == ExpressionOperation.AND) { // flatten ANDs for (Term t : ...
java
{ "resource": "" }
q162897
OneShotSQLGeneratorEngine.getTableDefinitions
train
private String getTableDefinitions(List<Function> atoms, AliasIndex index, String JOIN_KEYWORD, boolean parenthesis, String indent) { List<String> tables = getTableDefs(atoms, index, INDENT + indent); switch (tables.size()) { case 0: throw new RuntimeException...
java
{ "resource": "" }
q162898
OneShotSQLGeneratorEngine.getTableDefinition
train
private String getTableDefinition(Function atom, AliasIndex index, String indent) { if (atom.isAlgebraFunction()) { Predicate functionSymbol = atom.getFunctionSymbol(); ImmutableList<Function> joinAtoms = convert(atom.getTerms()); if (functionSymbol.equals(datalogFactory.getSparqlJoinPredicate())) { // ...
java
{ "resource": "" }
q162899
OneShotSQLGeneratorEngine.getDataType
train
private int getDataType(Term term) { /* * TODO: refactor! */ if (term instanceof Function){ Function f = (Function) term; Predicate p = f.getFunctionSymbol(); if (p instanceof DatatypePredicate) { RDFDatatype type = ((DatatypePredicate) p).getReturnedType(); return jdbcTypeMapper.getSQLType...
java
{ "resource": "" }