repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertOnlyOneMethod | public static void assertOnlyOneMethod(final Collection<Method> methods, Class<? extends Annotation> annotation)
{
if (methods.size() > 1)
{
throw annotation == null ? MESSAGES.onlyOneMethodCanExist() : MESSAGES.onlyOneMethodCanExist2(annotation);
}
} | java | public static void assertOnlyOneMethod(final Collection<Method> methods, Class<? extends Annotation> annotation)
{
if (methods.size() > 1)
{
throw annotation == null ? MESSAGES.onlyOneMethodCanExist() : MESSAGES.onlyOneMethodCanExist2(annotation);
}
} | [
"public",
"static",
"void",
"assertOnlyOneMethod",
"(",
"final",
"Collection",
"<",
"Method",
">",
"methods",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"methods",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
... | Asserts only one method is annotated with annotation.
@param method collection of methods to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"only",
"one",
"method",
"is",
"annotated",
"with",
"annotation",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L330-L336 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/invocation/AbstractInvocationHandlerJSE.java | AbstractInvocationHandlerJSE.invoke | public final void invoke(final Endpoint endpoint, final Invocation invocation) throws Exception
{
try
{
// prepare for invocation
this.init(endpoint, invocation);
final Object targetBean = invocation.getInvocationContext().getTargetBean();
final Class<?> implClass = targetBean.getClass();
final Method seiMethod = invocation.getJavaMethod();
final Method implMethod = this.getImplMethod(implClass, seiMethod);
final Object[] args = invocation.getArgs();
// notify subclasses
this.onBeforeInvocation(invocation);
// invoke implementation method
final Object retObj = implMethod.invoke(targetBean, args);
// set invocation result
invocation.setReturnValue(retObj);
}
catch (Exception e)
{
Loggers.ROOT_LOGGER.methodInvocationFailed(e);
// propagate exception
this.handleInvocationException(e);
}
finally
{
// notify subclasses
this.onAfterInvocation(invocation);
}
} | java | public final void invoke(final Endpoint endpoint, final Invocation invocation) throws Exception
{
try
{
// prepare for invocation
this.init(endpoint, invocation);
final Object targetBean = invocation.getInvocationContext().getTargetBean();
final Class<?> implClass = targetBean.getClass();
final Method seiMethod = invocation.getJavaMethod();
final Method implMethod = this.getImplMethod(implClass, seiMethod);
final Object[] args = invocation.getArgs();
// notify subclasses
this.onBeforeInvocation(invocation);
// invoke implementation method
final Object retObj = implMethod.invoke(targetBean, args);
// set invocation result
invocation.setReturnValue(retObj);
}
catch (Exception e)
{
Loggers.ROOT_LOGGER.methodInvocationFailed(e);
// propagate exception
this.handleInvocationException(e);
}
finally
{
// notify subclasses
this.onAfterInvocation(invocation);
}
} | [
"public",
"final",
"void",
"invoke",
"(",
"final",
"Endpoint",
"endpoint",
",",
"final",
"Invocation",
"invocation",
")",
"throws",
"Exception",
"{",
"try",
"{",
"// prepare for invocation",
"this",
".",
"init",
"(",
"endpoint",
",",
"invocation",
")",
";",
"f... | Invokes method on endpoint implementation.
This method does the following steps:
<ul>
<li>lookups endpoint implementation method to be invoked,</li>
<li>
notifies all subclasses about endpoint method is going to be invoked<br/>
(using {@link #onBeforeInvocation(Invocation)} template method),
</li>
<li>endpoint implementation method is invoked,</li>
<li>
notifies all subclasses about endpoint method invocation was completed<br/>
(using {@link #onAfterInvocation(Invocation)} template method).
</li>
</ul>
@param endpoint which method is going to be invoked
@param invocation current invocation
@throws Exception if any error occurs | [
"Invokes",
"method",
"on",
"endpoint",
"implementation",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/invocation/AbstractInvocationHandlerJSE.java#L92-L124 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/spi/DefaultSPIProvider.java | DefaultSPIProvider.getSPI | @Override
public <T> T getSPI(Class<T> spiType, ClassLoader loader)
{
T returnType = null;
// SPIs provided by framework, defaults can be overridden
if (DeploymentModelFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultDeploymentModelFactory.class, loader);
}
else if (EndpointMetricsFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultEndpointMetricsFactory.class, loader);
}
else if (LifecycleHandlerFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultLifecycleHandlerFactory.class, loader);
}
else if (SecurityAdaptorFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultSecurityAdapterFactory.class, loader);
}
else if (JMSEndpointResolver.class.equals(spiType))
{
returnType = loadService(spiType, DefaultJMSEndpointResolver.class, loader);
}
else
{
// SPI provided by either container or stack integration that has no default implementation
returnType = (T)loadService(spiType, null, loader);
}
if (returnType == null)
throw Messages.MESSAGES.failedToProvideSPI(spiType);
return returnType;
} | java | @Override
public <T> T getSPI(Class<T> spiType, ClassLoader loader)
{
T returnType = null;
// SPIs provided by framework, defaults can be overridden
if (DeploymentModelFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultDeploymentModelFactory.class, loader);
}
else if (EndpointMetricsFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultEndpointMetricsFactory.class, loader);
}
else if (LifecycleHandlerFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultLifecycleHandlerFactory.class, loader);
}
else if (SecurityAdaptorFactory.class.equals(spiType))
{
returnType = loadService(spiType, DefaultSecurityAdapterFactory.class, loader);
}
else if (JMSEndpointResolver.class.equals(spiType))
{
returnType = loadService(spiType, DefaultJMSEndpointResolver.class, loader);
}
else
{
// SPI provided by either container or stack integration that has no default implementation
returnType = (T)loadService(spiType, null, loader);
}
if (returnType == null)
throw Messages.MESSAGES.failedToProvideSPI(spiType);
return returnType;
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"getSPI",
"(",
"Class",
"<",
"T",
">",
"spiType",
",",
"ClassLoader",
"loader",
")",
"{",
"T",
"returnType",
"=",
"null",
";",
"// SPIs provided by framework, defaults can be overridden",
"if",
"(",
"DeploymentModel... | Gets the specified SPI, using the provided classloader | [
"Gets",
"the",
"specified",
"SPI",
"using",
"the",
"provided",
"classloader"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/spi/DefaultSPIProvider.java#L47-L83 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/spi/DefaultSPIProvider.java | DefaultSPIProvider.loadService | @SuppressWarnings("unchecked")
private <T> T loadService(Class<T> spiType, Class<?> defaultImpl, ClassLoader loader)
{
final String defaultImplName = defaultImpl != null ? defaultImpl.getName() : null;
return (T)ServiceLoader.loadService(spiType.getName(), defaultImplName, loader);
} | java | @SuppressWarnings("unchecked")
private <T> T loadService(Class<T> spiType, Class<?> defaultImpl, ClassLoader loader)
{
final String defaultImplName = defaultImpl != null ? defaultImpl.getName() : null;
return (T)ServiceLoader.loadService(spiType.getName(), defaultImplName, loader);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"loadService",
"(",
"Class",
"<",
"T",
">",
"spiType",
",",
"Class",
"<",
"?",
">",
"defaultImpl",
",",
"ClassLoader",
"loader",
")",
"{",
"final",
"String",
"defaultImplNam... | Load SPI implementation through ServiceLoader | [
"Load",
"SPI",
"implementation",
"through",
"ServiceLoader"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/spi/DefaultSPIProvider.java#L86-L91 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/invocation/RecordingServerHandler.java | RecordingServerHandler.isRecording | private boolean isRecording(Endpoint endpoint)
{
List<RecordProcessor> processors = endpoint.getRecordProcessors();
if (processors == null || processors.isEmpty())
{
return false;
}
for (RecordProcessor processor : processors)
{
if (processor.isRecording())
{
return true;
}
}
return false;
} | java | private boolean isRecording(Endpoint endpoint)
{
List<RecordProcessor> processors = endpoint.getRecordProcessors();
if (processors == null || processors.isEmpty())
{
return false;
}
for (RecordProcessor processor : processors)
{
if (processor.isRecording())
{
return true;
}
}
return false;
} | [
"private",
"boolean",
"isRecording",
"(",
"Endpoint",
"endpoint",
")",
"{",
"List",
"<",
"RecordProcessor",
">",
"processors",
"=",
"endpoint",
".",
"getRecordProcessors",
"(",
")",
";",
"if",
"(",
"processors",
"==",
"null",
"||",
"processors",
".",
"isEmpty"... | Returns true if there's at least a record processor in recording mode
@param endpoint
@return | [
"Returns",
"true",
"if",
"there",
"s",
"at",
"least",
"a",
"record",
"processor",
"in",
"recording",
"mode"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/invocation/RecordingServerHandler.java#L158-L173 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/InjectionException.java | InjectionException.rethrow | public static void rethrow(final String message, final Exception reason)
{
if (reason == null)
{
throw new IllegalArgumentException();
}
Loggers.ROOT_LOGGER.error(message == null ? reason.getMessage() : message, reason);
throw new InjectionException(message, reason);
} | java | public static void rethrow(final String message, final Exception reason)
{
if (reason == null)
{
throw new IllegalArgumentException();
}
Loggers.ROOT_LOGGER.error(message == null ? reason.getMessage() : message, reason);
throw new InjectionException(message, reason);
} | [
"public",
"static",
"void",
"rethrow",
"(",
"final",
"String",
"message",
",",
"final",
"Exception",
"reason",
")",
"{",
"if",
"(",
"reason",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"Loggers",
".",
"ROOT_LOGG... | Rethrows Injection exception that will wrap passed reason.
@param message custom message
@param reason to wrap. | [
"Rethrows",
"Injection",
"exception",
"that",
"will",
"wrap",
"passed",
"reason",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/InjectionException.java#L94-L103 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java | AbstractCommonConfigResolver.resolveEndpointConfig | public EndpointConfig resolveEndpointConfig() {
final String endpointClassName = getEndpointClassName();
// 1) default values
//String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
String configName = endpointClassName;
String configFile = EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE;
boolean specifiedConfig = false;
// 2) annotation contribution
if (isEndpointClassAnnotated(org.jboss.ws.api.annotation.EndpointConfig.class))
{
final String cfgName = getEndpointConfigNameFromAnnotation();
if (cfgName != null && !cfgName.isEmpty())
{
configName = cfgName;
}
final String cfgFile = getEndpointConfigFileFromAnnotation();
if (cfgFile != null && !cfgFile.isEmpty())
{
configFile = cfgFile;
}
specifiedConfig = true;
}
// 3) descriptor overrides (jboss-webservices.xml or web.xml)
final String epCfgNameOverride = getEndpointConfigNameOverride();
if (epCfgNameOverride != null && !epCfgNameOverride.isEmpty())
{
configName = epCfgNameOverride;
specifiedConfig = true;
}
final String epCfgFileOverride = getEndpointConfigFileOverride();
if (epCfgFileOverride != null && !epCfgFileOverride.isEmpty())
{
configFile = epCfgFileOverride;
}
// 4) setup of configuration
if (configFile != EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE) {
//look for provided endpoint config file
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(getConfigFile(configFile));
EndpointConfig config = configRoot.getEndpointConfigByName(configName);
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
if (config != null) {
return config;
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
}
}
else
{
EndpointConfig config = null;
URL url = getDefaultConfigFile(configFile);
if (url != null) {
//the default file exists
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(url);
config = configRoot.getEndpointConfigByName(configName);
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
}
}
if (config == null) {
//use endpoint configs from AS domain
ServerConfig sc = getServerConfig();
config = sc.getEndpointConfig(configName);
if (config == null && !specifiedConfig) {
config = sc.getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
if (config == null && specifiedConfig) {
throw Messages.MESSAGES.couldNotFindEndpointConfigName(configName);
}
}
if (config != null) {
return config;
}
}
return null;
} | java | public EndpointConfig resolveEndpointConfig() {
final String endpointClassName = getEndpointClassName();
// 1) default values
//String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
String configName = endpointClassName;
String configFile = EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE;
boolean specifiedConfig = false;
// 2) annotation contribution
if (isEndpointClassAnnotated(org.jboss.ws.api.annotation.EndpointConfig.class))
{
final String cfgName = getEndpointConfigNameFromAnnotation();
if (cfgName != null && !cfgName.isEmpty())
{
configName = cfgName;
}
final String cfgFile = getEndpointConfigFileFromAnnotation();
if (cfgFile != null && !cfgFile.isEmpty())
{
configFile = cfgFile;
}
specifiedConfig = true;
}
// 3) descriptor overrides (jboss-webservices.xml or web.xml)
final String epCfgNameOverride = getEndpointConfigNameOverride();
if (epCfgNameOverride != null && !epCfgNameOverride.isEmpty())
{
configName = epCfgNameOverride;
specifiedConfig = true;
}
final String epCfgFileOverride = getEndpointConfigFileOverride();
if (epCfgFileOverride != null && !epCfgFileOverride.isEmpty())
{
configFile = epCfgFileOverride;
}
// 4) setup of configuration
if (configFile != EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE) {
//look for provided endpoint config file
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(getConfigFile(configFile));
EndpointConfig config = configRoot.getEndpointConfigByName(configName);
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
if (config != null) {
return config;
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
}
}
else
{
EndpointConfig config = null;
URL url = getDefaultConfigFile(configFile);
if (url != null) {
//the default file exists
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(url);
config = configRoot.getEndpointConfigByName(configName);
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
}
}
if (config == null) {
//use endpoint configs from AS domain
ServerConfig sc = getServerConfig();
config = sc.getEndpointConfig(configName);
if (config == null && !specifiedConfig) {
config = sc.getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
if (config == null && specifiedConfig) {
throw Messages.MESSAGES.couldNotFindEndpointConfigName(configName);
}
}
if (config != null) {
return config;
}
}
return null;
} | [
"public",
"EndpointConfig",
"resolveEndpointConfig",
"(",
")",
"{",
"final",
"String",
"endpointClassName",
"=",
"getEndpointClassName",
"(",
")",
";",
"// 1) default values",
"//String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;",
"String"... | Returns the EndpointConfig resolved for the current endpoint
@return the EndpointConfig resolved for the current endpoint | [
"Returns",
"the",
"EndpointConfig",
"resolved",
"for",
"the",
"current",
"endpoint"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java#L54-L142 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java | AbstractCommonConfigResolver.getAllHandlers | public Set<String> getAllHandlers(EndpointConfig config) {
Set<String> set = new HashSet<String>();
if (config != null) {
for (UnifiedHandlerChainMetaData uhcmd : config.getPreHandlerChains()) {
for (UnifiedHandlerMetaData uhmd : uhcmd.getHandlers()) {
set.add(uhmd.getHandlerClass());
}
}
for (UnifiedHandlerChainMetaData uhcmd : config.getPostHandlerChains()) {
for (UnifiedHandlerMetaData uhmd : uhcmd.getHandlers()) {
set.add(uhmd.getHandlerClass());
}
}
}
return set;
} | java | public Set<String> getAllHandlers(EndpointConfig config) {
Set<String> set = new HashSet<String>();
if (config != null) {
for (UnifiedHandlerChainMetaData uhcmd : config.getPreHandlerChains()) {
for (UnifiedHandlerMetaData uhmd : uhcmd.getHandlers()) {
set.add(uhmd.getHandlerClass());
}
}
for (UnifiedHandlerChainMetaData uhcmd : config.getPostHandlerChains()) {
for (UnifiedHandlerMetaData uhmd : uhcmd.getHandlers()) {
set.add(uhmd.getHandlerClass());
}
}
}
return set;
} | [
"public",
"Set",
"<",
"String",
">",
"getAllHandlers",
"(",
"EndpointConfig",
"config",
")",
"{",
"Set",
"<",
"String",
">",
"set",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"config",
"!=",
"null",
")",
"{",
"for",
"(",
"... | Returns a set of full qualified class names of the handlers from the specified endpoint config
@param The config to get the handler class names of
@return A set of full qualified class names of the handlers from the specified endpoint config | [
"Returns",
"a",
"set",
"of",
"full",
"qualified",
"class",
"names",
"of",
"the",
"handlers",
"from",
"the",
"specified",
"endpoint",
"config"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/configuration/AbstractCommonConfigResolver.java#L150-L165 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java | AbstractWSDLFilePublisher.publishWsdlImports | @SuppressWarnings("unchecked")
protected void publishWsdlImports(URL parentURL, Definition parentDefinition, List<String> published, String expLocation) throws Exception
{
@SuppressWarnings("rawtypes")
Iterator it = parentDefinition.getImports().values().iterator();
while (it.hasNext())
{
for (Import wsdlImport : (List<Import>)it.next())
{
String locationURI = wsdlImport.getLocationURI();
// its an external import, don't publish locally
if (locationURI.startsWith("http://") == false && locationURI.startsWith("https://") == false)
{
// infinity loops prevention
if (published.contains(locationURI))
{
continue;
}
else
{
published.add(locationURI);
}
String baseURI = parentURL.toExternalForm();
URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI);
File targetFile = new File(targetURL.getFile()); //JBWS-3488
createParentDir(targetFile);
Definition subdef = wsdlImport.getDefinition();
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
BufferedOutputStream bfos = new BufferedOutputStream(new FileOutputStream(targetFile));
OutputStreamWriter osw = new OutputStreamWriter(bfos, "UTF-8");
try {
wsdlWriter.writeWSDL(subdef, osw);
} finally {
osw.close();
}
DEPLOYMENT_LOGGER.wsdlImportPublishedTo(targetURL);
// recursively publish imports
publishWsdlImports(targetURL, subdef, published, expLocation);
// Publish XMLSchema imports
Element subdoc = DOMUtils.parse(targetURL.openStream(), getDocumentBuilder());
publishSchemaImports(targetURL, subdoc, published, expLocation);
}
}
}
} | java | @SuppressWarnings("unchecked")
protected void publishWsdlImports(URL parentURL, Definition parentDefinition, List<String> published, String expLocation) throws Exception
{
@SuppressWarnings("rawtypes")
Iterator it = parentDefinition.getImports().values().iterator();
while (it.hasNext())
{
for (Import wsdlImport : (List<Import>)it.next())
{
String locationURI = wsdlImport.getLocationURI();
// its an external import, don't publish locally
if (locationURI.startsWith("http://") == false && locationURI.startsWith("https://") == false)
{
// infinity loops prevention
if (published.contains(locationURI))
{
continue;
}
else
{
published.add(locationURI);
}
String baseURI = parentURL.toExternalForm();
URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI);
File targetFile = new File(targetURL.getFile()); //JBWS-3488
createParentDir(targetFile);
Definition subdef = wsdlImport.getDefinition();
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
BufferedOutputStream bfos = new BufferedOutputStream(new FileOutputStream(targetFile));
OutputStreamWriter osw = new OutputStreamWriter(bfos, "UTF-8");
try {
wsdlWriter.writeWSDL(subdef, osw);
} finally {
osw.close();
}
DEPLOYMENT_LOGGER.wsdlImportPublishedTo(targetURL);
// recursively publish imports
publishWsdlImports(targetURL, subdef, published, expLocation);
// Publish XMLSchema imports
Element subdoc = DOMUtils.parse(targetURL.openStream(), getDocumentBuilder());
publishSchemaImports(targetURL, subdoc, published, expLocation);
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"publishWsdlImports",
"(",
"URL",
"parentURL",
",",
"Definition",
"parentDefinition",
",",
"List",
"<",
"String",
">",
"published",
",",
"String",
"expLocation",
")",
"throws",
"Exception",
"... | Publish the wsdl imports for a given wsdl definition | [
"Publish",
"the",
"wsdl",
"imports",
"for",
"a",
"given",
"wsdl",
"definition"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java#L137-L187 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java | AbstractWSDLFilePublisher.publishSchemaImports | protected void publishSchemaImports(URL parentURL, Element element, List<String> published, String expLocation) throws Exception
{
Element childElement = getFirstChildElement(element);
while (childElement != null) {
//first check on namespace only to avoid doing anything on any other wsdl/schema elements
final String ns = childElement.getNamespaceURI();
if (Constants.NS_SCHEMA_XSD.equals(ns)) {
final String ln = childElement.getLocalName();
if ("import".equals(ln) || "include".equals(ln)) {
String schemaLocation = childElement.getAttribute("schemaLocation");
if (schemaLocation.length() > 0 && schemaLocation.startsWith("http://") == false && schemaLocation.startsWith("https://") == false)
{
// infinity loops prevention
if (!published.contains(schemaLocation))
{
published.add(schemaLocation);
String baseURI = parentURL.toExternalForm();
URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
File targetFile = new File(xsdURL.getFile()); //JBWS-3488
createParentDir(targetFile);
String deploymentName = dep.getCanonicalName();
// get the resource path including the separator
int index = baseURI.indexOf(deploymentName) + 1;
String resourcePath = baseURI.substring(index + deploymentName.length());
//check for sub-directories
resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1);
resourcePath = expLocation + resourcePath + schemaLocation;
while (resourcePath.indexOf("//") != -1)
{
resourcePath = resourcePath.replace("//", "/");
}
URL resourceURL = dep.getResourceResolver().resolve(resourcePath);
InputStream is = new ResourceURL(resourceURL).openStream();
if (is == null)
throw MESSAGES.cannotFindSchemaImportInDeployment(resourcePath, deploymentName);
FileOutputStream fos = null;
try
{
fos = new FileOutputStream(targetFile);
IOUtils.copyStream(fos, is);
}
finally
{
if (fos != null) fos.close();
}
DEPLOYMENT_LOGGER.xmlSchemaImportPublishedTo(xsdURL);
// recursively publish imports
Element subdoc = DOMUtils.parse(xsdURL.openStream(), getDocumentBuilder());
publishSchemaImports(xsdURL, subdoc, published, expLocation);
}
}
} else if ("schema".equals(ln)) {
//recurse, as xsd:schema might contain an import
publishSchemaImports(parentURL, childElement, published, expLocation);
}
} else if (Constants.NS_WSDL11.equals(ns) && "types".equals(childElement.getLocalName())) {
//recurse as wsdl:types might contain a schema
publishSchemaImports(parentURL, childElement, published, expLocation);
}
childElement = getNextSiblingElement(childElement);
}
} | java | protected void publishSchemaImports(URL parentURL, Element element, List<String> published, String expLocation) throws Exception
{
Element childElement = getFirstChildElement(element);
while (childElement != null) {
//first check on namespace only to avoid doing anything on any other wsdl/schema elements
final String ns = childElement.getNamespaceURI();
if (Constants.NS_SCHEMA_XSD.equals(ns)) {
final String ln = childElement.getLocalName();
if ("import".equals(ln) || "include".equals(ln)) {
String schemaLocation = childElement.getAttribute("schemaLocation");
if (schemaLocation.length() > 0 && schemaLocation.startsWith("http://") == false && schemaLocation.startsWith("https://") == false)
{
// infinity loops prevention
if (!published.contains(schemaLocation))
{
published.add(schemaLocation);
String baseURI = parentURL.toExternalForm();
URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
File targetFile = new File(xsdURL.getFile()); //JBWS-3488
createParentDir(targetFile);
String deploymentName = dep.getCanonicalName();
// get the resource path including the separator
int index = baseURI.indexOf(deploymentName) + 1;
String resourcePath = baseURI.substring(index + deploymentName.length());
//check for sub-directories
resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1);
resourcePath = expLocation + resourcePath + schemaLocation;
while (resourcePath.indexOf("//") != -1)
{
resourcePath = resourcePath.replace("//", "/");
}
URL resourceURL = dep.getResourceResolver().resolve(resourcePath);
InputStream is = new ResourceURL(resourceURL).openStream();
if (is == null)
throw MESSAGES.cannotFindSchemaImportInDeployment(resourcePath, deploymentName);
FileOutputStream fos = null;
try
{
fos = new FileOutputStream(targetFile);
IOUtils.copyStream(fos, is);
}
finally
{
if (fos != null) fos.close();
}
DEPLOYMENT_LOGGER.xmlSchemaImportPublishedTo(xsdURL);
// recursively publish imports
Element subdoc = DOMUtils.parse(xsdURL.openStream(), getDocumentBuilder());
publishSchemaImports(xsdURL, subdoc, published, expLocation);
}
}
} else if ("schema".equals(ln)) {
//recurse, as xsd:schema might contain an import
publishSchemaImports(parentURL, childElement, published, expLocation);
}
} else if (Constants.NS_WSDL11.equals(ns) && "types".equals(childElement.getLocalName())) {
//recurse as wsdl:types might contain a schema
publishSchemaImports(parentURL, childElement, published, expLocation);
}
childElement = getNextSiblingElement(childElement);
}
} | [
"protected",
"void",
"publishSchemaImports",
"(",
"URL",
"parentURL",
",",
"Element",
"element",
",",
"List",
"<",
"String",
">",
"published",
",",
"String",
"expLocation",
")",
"throws",
"Exception",
"{",
"Element",
"childElement",
"=",
"getFirstChildElement",
"(... | Publish the schema imports for a given wsdl definition | [
"Publish",
"the",
"schema",
"imports",
"for",
"a",
"given",
"wsdl",
"definition"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java#L206-L273 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java | AbstractWSDLFilePublisher.unpublishWsdlFiles | public void unpublishWsdlFiles() throws IOException
{
String deploymentDir = (dep.getParent() != null ? dep.getParent().getSimpleName() : dep.getSimpleName());
File serviceDir = new File(serverConfig.getServerDataDir().getCanonicalPath() + "/wsdl/" + deploymentDir);
deleteWsdlPublishDirectory(serviceDir);
} | java | public void unpublishWsdlFiles() throws IOException
{
String deploymentDir = (dep.getParent() != null ? dep.getParent().getSimpleName() : dep.getSimpleName());
File serviceDir = new File(serverConfig.getServerDataDir().getCanonicalPath() + "/wsdl/" + deploymentDir);
deleteWsdlPublishDirectory(serviceDir);
} | [
"public",
"void",
"unpublishWsdlFiles",
"(",
")",
"throws",
"IOException",
"{",
"String",
"deploymentDir",
"=",
"(",
"dep",
".",
"getParent",
"(",
")",
"!=",
"null",
"?",
"dep",
".",
"getParent",
"(",
")",
".",
"getSimpleName",
"(",
")",
":",
"dep",
".",... | Delete the published wsdl | [
"Delete",
"the",
"published",
"wsdl"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java#L303-L309 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java | AbstractWSDLFilePublisher.deleteWsdlPublishDirectory | protected void deleteWsdlPublishDirectory(File dir) throws IOException
{
String[] files = dir.list();
for (int i = 0; files != null && i < files.length; i++)
{
String fileName = files[i];
File file = new File(dir + "/" + fileName);
if (file.isDirectory())
{
deleteWsdlPublishDirectory(file);
}
else
{
if (file.delete() == false)
DEPLOYMENT_LOGGER.cannotDeletePublishedWsdlDoc(file.toURI().toURL());
}
}
// delete the directory as well
if (dir.delete() == false) {
DEPLOYMENT_LOGGER.cannotDeletePublishedWsdlDoc(dir.toURI().toURL());
}
} | java | protected void deleteWsdlPublishDirectory(File dir) throws IOException
{
String[] files = dir.list();
for (int i = 0; files != null && i < files.length; i++)
{
String fileName = files[i];
File file = new File(dir + "/" + fileName);
if (file.isDirectory())
{
deleteWsdlPublishDirectory(file);
}
else
{
if (file.delete() == false)
DEPLOYMENT_LOGGER.cannotDeletePublishedWsdlDoc(file.toURI().toURL());
}
}
// delete the directory as well
if (dir.delete() == false) {
DEPLOYMENT_LOGGER.cannotDeletePublishedWsdlDoc(dir.toURI().toURL());
}
} | [
"protected",
"void",
"deleteWsdlPublishDirectory",
"(",
"File",
"dir",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"files",
"=",
"dir",
".",
"list",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"files",
"!=",
"null",
"&&",
"i",
"<... | Delete the published wsdl document, traversing down the dir structure | [
"Delete",
"the",
"published",
"wsdl",
"document",
"traversing",
"down",
"the",
"dir",
"structure"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/AbstractWSDLFilePublisher.java#L314-L336 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/DefaultSerializableProxy.java | DefaultSerializableProxy.readResolve | protected Object readResolve() throws ObjectStreamException {
try {
Class<?> proxyClass = getProxyClass();
Object instance = proxyClass.newInstance();
ProxyFactory.setInvocationHandlerStatic(instance, handler);
return instance;
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} | java | protected Object readResolve() throws ObjectStreamException {
try {
Class<?> proxyClass = getProxyClass();
Object instance = proxyClass.newInstance();
ProxyFactory.setInvocationHandlerStatic(instance, handler);
return instance;
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} | [
"protected",
"Object",
"readResolve",
"(",
")",
"throws",
"ObjectStreamException",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"proxyClass",
"=",
"getProxyClass",
"(",
")",
";",
"Object",
"instance",
"=",
"proxyClass",
".",
"newInstance",
"(",
")",
";",
"ProxyF... | Resolve the serialized proxy to a real instance.
@return the resolved instance
@throws ObjectStreamException if an error occurs | [
"Resolve",
"the",
"serialized",
"proxy",
"to",
"a",
"real",
"instance",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/DefaultSerializableProxy.java#L54-L67 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/DefaultSerializableProxy.java | DefaultSerializableProxy.getProxyClass | protected Class<?> getProxyClass() throws ClassNotFoundException {
ClassLoader classLoader = getProxyClassLoader();
return Class.forName(proxyClassName, false, classLoader);
} | java | protected Class<?> getProxyClass() throws ClassNotFoundException {
ClassLoader classLoader = getProxyClassLoader();
return Class.forName(proxyClassName, false, classLoader);
} | [
"protected",
"Class",
"<",
"?",
">",
"getProxyClass",
"(",
")",
"throws",
"ClassNotFoundException",
"{",
"ClassLoader",
"classLoader",
"=",
"getProxyClassLoader",
"(",
")",
";",
"return",
"Class",
".",
"forName",
"(",
"proxyClassName",
",",
"false",
",",
"classL... | Get the associated proxy class.
@return the proxy class
@throws ClassNotFoundException if the proxy class is not found | [
"Get",
"the",
"associated",
"proxy",
"class",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/DefaultSerializableProxy.java#L75-L78 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.newDocumentBuilder | public static DocumentBuilder newDocumentBuilder(final DocumentBuilderFactory factory)
{
try
{
final DocumentBuilder builder = factory.newDocumentBuilder();
return builder;
}
catch (Exception e)
{
throw MESSAGES.unableToCreateInstanceOf(e, DocumentBuilder.class.getName());
}
} | java | public static DocumentBuilder newDocumentBuilder(final DocumentBuilderFactory factory)
{
try
{
final DocumentBuilder builder = factory.newDocumentBuilder();
return builder;
}
catch (Exception e)
{
throw MESSAGES.unableToCreateInstanceOf(e, DocumentBuilder.class.getName());
}
} | [
"public",
"static",
"DocumentBuilder",
"newDocumentBuilder",
"(",
"final",
"DocumentBuilderFactory",
"factory",
")",
"{",
"try",
"{",
"final",
"DocumentBuilder",
"builder",
"=",
"factory",
".",
"newDocumentBuilder",
"(",
")",
";",
"return",
"builder",
";",
"}",
"c... | Creates a new DocumentBuilder instance using the provided DocumentBuilderFactory
@param factory
@return | [
"Creates",
"a",
"new",
"DocumentBuilder",
"instance",
"using",
"the",
"provided",
"DocumentBuilderFactory"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L172-L183 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.parse | public static Element parse(String xmlString) throws IOException
{
try
{
return parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
}
catch (IOException e)
{
ROOT_LOGGER.cannotParse(xmlString);
throw e;
}
} | java | public static Element parse(String xmlString) throws IOException
{
try
{
return parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
}
catch (IOException e)
{
ROOT_LOGGER.cannotParse(xmlString);
throw e;
}
} | [
"public",
"static",
"Element",
"parse",
"(",
"String",
"xmlString",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"parse",
"(",
"new",
"ByteArrayInputStream",
"(",
"xmlString",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
")",
")",
";",
"}",
"catch",
... | Parse the given XML string and return the root Element
This uses the document builder associated with the current thread. | [
"Parse",
"the",
"given",
"XML",
"string",
"and",
"return",
"the",
"root",
"Element",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L197-L208 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.parse | public static Element parse(InputStream xmlStream, DocumentBuilder builder) throws IOException
{
try
{
Document doc;
synchronized (builder) //synchronize to prevent concurrent parsing on the same DocumentBuilder
{
doc = builder.parse(xmlStream);
}
return doc.getDocumentElement();
}
catch (SAXException se)
{
throw new IOException(se.toString());
}
finally
{
xmlStream.close();
}
} | java | public static Element parse(InputStream xmlStream, DocumentBuilder builder) throws IOException
{
try
{
Document doc;
synchronized (builder) //synchronize to prevent concurrent parsing on the same DocumentBuilder
{
doc = builder.parse(xmlStream);
}
return doc.getDocumentElement();
}
catch (SAXException se)
{
throw new IOException(se.toString());
}
finally
{
xmlStream.close();
}
} | [
"public",
"static",
"Element",
"parse",
"(",
"InputStream",
"xmlStream",
",",
"DocumentBuilder",
"builder",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Document",
"doc",
";",
"synchronized",
"(",
"builder",
")",
"//synchronize to prevent concurrent parsing on the sa... | Parse the given XML stream and return the root Element | [
"Parse",
"the",
"given",
"XML",
"stream",
"and",
"return",
"the",
"root",
"Element"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L213-L232 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.parse | public static Element parse(InputStream xmlStream) throws IOException
{
DocumentBuilder builder = getDocumentBuilder();
return parse(xmlStream, builder);
} | java | public static Element parse(InputStream xmlStream) throws IOException
{
DocumentBuilder builder = getDocumentBuilder();
return parse(xmlStream, builder);
} | [
"public",
"static",
"Element",
"parse",
"(",
"InputStream",
"xmlStream",
")",
"throws",
"IOException",
"{",
"DocumentBuilder",
"builder",
"=",
"getDocumentBuilder",
"(",
")",
";",
"return",
"parse",
"(",
"xmlStream",
",",
"builder",
")",
";",
"}"
] | Parse the given XML stream and return the root Element
This uses the document builder associated with the current thread. | [
"Parse",
"the",
"given",
"XML",
"stream",
"and",
"return",
"the",
"root",
"Element",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L238-L242 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.parse | public static Element parse(InputSource source) throws IOException
{
try
{
Document doc;
DocumentBuilder builder = getDocumentBuilder();
synchronized (builder) //synchronize to prevent concurrent parsing on the same DocumentBuilder
{
doc = builder.parse(source);
}
return doc.getDocumentElement();
}
catch (SAXException se)
{
throw new IOException(se.toString());
}
finally
{
InputStream is = source.getByteStream();
if (is != null)
{
is.close();
}
Reader r = source.getCharacterStream();
if (r != null)
{
r.close();
}
}
} | java | public static Element parse(InputSource source) throws IOException
{
try
{
Document doc;
DocumentBuilder builder = getDocumentBuilder();
synchronized (builder) //synchronize to prevent concurrent parsing on the same DocumentBuilder
{
doc = builder.parse(source);
}
return doc.getDocumentElement();
}
catch (SAXException se)
{
throw new IOException(se.toString());
}
finally
{
InputStream is = source.getByteStream();
if (is != null)
{
is.close();
}
Reader r = source.getCharacterStream();
if (r != null)
{
r.close();
}
}
} | [
"public",
"static",
"Element",
"parse",
"(",
"InputSource",
"source",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Document",
"doc",
";",
"DocumentBuilder",
"builder",
"=",
"getDocumentBuilder",
"(",
")",
";",
"synchronized",
"(",
"builder",
")",
"//synchroni... | Parse the given input source and return the root Element.
This uses the document builder associated with the current thread. | [
"Parse",
"the",
"given",
"input",
"source",
"and",
"return",
"the",
"root",
"Element",
".",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L248-L277 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.createElement | public static Element createElement(String localPart)
{
Document doc = getOwnerDocument();
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {}" + localPart);
return doc.createElement(localPart);
} | java | public static Element createElement(String localPart)
{
Document doc = getOwnerDocument();
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {}" + localPart);
return doc.createElement(localPart);
} | [
"public",
"static",
"Element",
"createElement",
"(",
"String",
"localPart",
")",
"{",
"Document",
"doc",
"=",
"getOwnerDocument",
"(",
")",
";",
"if",
"(",
"ROOT_LOGGER",
".",
"isTraceEnabled",
"(",
")",
")",
"ROOT_LOGGER",
".",
"trace",
"(",
"\"createElement ... | Create an Element for a given name.
This uses the document builder associated with the current thread. | [
"Create",
"an",
"Element",
"for",
"a",
"given",
"name",
".",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L283-L288 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.createElement | public static Element createElement(String localPart, String prefix, String uri)
{
Document doc = getOwnerDocument();
if (prefix == null || prefix.length() == 0)
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + localPart);
return doc.createElementNS(uri, localPart);
}
else
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + prefix + ":" + localPart);
return doc.createElementNS(uri, prefix + ":" + localPart);
}
} | java | public static Element createElement(String localPart, String prefix, String uri)
{
Document doc = getOwnerDocument();
if (prefix == null || prefix.length() == 0)
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + localPart);
return doc.createElementNS(uri, localPart);
}
else
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.trace("createElement {" + uri + "}" + prefix + ":" + localPart);
return doc.createElementNS(uri, prefix + ":" + localPart);
}
} | [
"public",
"static",
"Element",
"createElement",
"(",
"String",
"localPart",
",",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"Document",
"doc",
"=",
"getOwnerDocument",
"(",
")",
";",
"if",
"(",
"prefix",
"==",
"null",
"||",
"prefix",
".",
"length"... | Create an Element for a given name, prefix and uri.
This uses the document builder associated with the current thread. | [
"Create",
"an",
"Element",
"for",
"a",
"given",
"name",
"prefix",
"and",
"uri",
".",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L305-L318 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.createElement | public static Element createElement(QName qname)
{
return createElement(qname.getLocalPart(), qname.getPrefix(), qname.getNamespaceURI());
} | java | public static Element createElement(QName qname)
{
return createElement(qname.getLocalPart(), qname.getPrefix(), qname.getNamespaceURI());
} | [
"public",
"static",
"Element",
"createElement",
"(",
"QName",
"qname",
")",
"{",
"return",
"createElement",
"(",
"qname",
".",
"getLocalPart",
"(",
")",
",",
"qname",
".",
"getPrefix",
"(",
")",
",",
"qname",
".",
"getNamespaceURI",
"(",
")",
")",
";",
"... | Create an Element for a given QName.
This uses the document builder associated with the current thread. | [
"Create",
"an",
"Element",
"for",
"a",
"given",
"QName",
".",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L324-L327 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.createTextNode | public static Text createTextNode(String value)
{
Document doc = getOwnerDocument();
return doc.createTextNode(value);
} | java | public static Text createTextNode(String value)
{
Document doc = getOwnerDocument();
return doc.createTextNode(value);
} | [
"public",
"static",
"Text",
"createTextNode",
"(",
"String",
"value",
")",
"{",
"Document",
"doc",
"=",
"getOwnerDocument",
"(",
")",
";",
"return",
"doc",
".",
"createTextNode",
"(",
"value",
")",
";",
"}"
] | Create a org.w3c.dom.Text node.
This uses the document builder associated with the current thread. | [
"Create",
"a",
"org",
".",
"w3c",
".",
"dom",
".",
"Text",
"node",
".",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L333-L337 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.getOwnerDocument | public static Document getOwnerDocument()
{
Document doc = documentThreadLocal.get();
if (doc == null)
{
doc = getDocumentBuilder().newDocument();
documentThreadLocal.set(doc);
}
return doc;
} | java | public static Document getOwnerDocument()
{
Document doc = documentThreadLocal.get();
if (doc == null)
{
doc = getDocumentBuilder().newDocument();
documentThreadLocal.set(doc);
}
return doc;
} | [
"public",
"static",
"Document",
"getOwnerDocument",
"(",
")",
"{",
"Document",
"doc",
"=",
"documentThreadLocal",
".",
"get",
"(",
")",
";",
"if",
"(",
"doc",
"==",
"null",
")",
"{",
"doc",
"=",
"getDocumentBuilder",
"(",
")",
".",
"newDocument",
"(",
")... | Get the owner document that is associated with the current thread | [
"Get",
"the",
"owner",
"document",
"that",
"is",
"associated",
"with",
"the",
"current",
"thread"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L351-L360 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.sourceToElement | public static Element sourceToElement(Source source) throws IOException
{
Element retElement = null;
if (source instanceof StreamSource)
{
StreamSource streamSource = (StreamSource)source;
InputStream ins = streamSource.getInputStream();
if (ins != null)
{
retElement = DOMUtils.parse(ins);
}
Reader reader = streamSource.getReader();
if (reader != null)
{
retElement = DOMUtils.parse(new InputSource(reader));
}
}
else if (source instanceof DOMSource)
{
DOMSource domSource = (DOMSource)source;
Node node = domSource.getNode();
if (node instanceof Element)
{
retElement = (Element)node;
}
else if (node instanceof Document)
{
retElement = ((Document)node).getDocumentElement();
}
}
else if (source instanceof SAXSource)
{
// The fact that JAXBSource derives from SAXSource is an implementation detail.
// Thus in general applications are strongly discouraged from accessing methods defined on SAXSource.
// The XMLReader object obtained by the getXMLReader method shall be used only for parsing the InputSource object returned by the getInputSource method.
final boolean hasInputSource = ((SAXSource) source).getInputSource() != null;
final boolean hasXMLReader = ((SAXSource) source).getXMLReader() != null;
if (hasInputSource || hasXMLReader)
{
try
{
TransformerFactory tf = TransformerFactory.newInstance();
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.transform(source, new StreamResult(baos));
retElement = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
}
catch (TransformerException ex)
{
throw new IOException(ex);
}
}
}
else
{
throw MESSAGES.sourceTypeNotImplemented(source.getClass());
}
return retElement;
} | java | public static Element sourceToElement(Source source) throws IOException
{
Element retElement = null;
if (source instanceof StreamSource)
{
StreamSource streamSource = (StreamSource)source;
InputStream ins = streamSource.getInputStream();
if (ins != null)
{
retElement = DOMUtils.parse(ins);
}
Reader reader = streamSource.getReader();
if (reader != null)
{
retElement = DOMUtils.parse(new InputSource(reader));
}
}
else if (source instanceof DOMSource)
{
DOMSource domSource = (DOMSource)source;
Node node = domSource.getNode();
if (node instanceof Element)
{
retElement = (Element)node;
}
else if (node instanceof Document)
{
retElement = ((Document)node).getDocumentElement();
}
}
else if (source instanceof SAXSource)
{
// The fact that JAXBSource derives from SAXSource is an implementation detail.
// Thus in general applications are strongly discouraged from accessing methods defined on SAXSource.
// The XMLReader object obtained by the getXMLReader method shall be used only for parsing the InputSource object returned by the getInputSource method.
final boolean hasInputSource = ((SAXSource) source).getInputSource() != null;
final boolean hasXMLReader = ((SAXSource) source).getXMLReader() != null;
if (hasInputSource || hasXMLReader)
{
try
{
TransformerFactory tf = TransformerFactory.newInstance();
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.transform(source, new StreamResult(baos));
retElement = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
}
catch (TransformerException ex)
{
throw new IOException(ex);
}
}
}
else
{
throw MESSAGES.sourceTypeNotImplemented(source.getClass());
}
return retElement;
} | [
"public",
"static",
"Element",
"sourceToElement",
"(",
"Source",
"source",
")",
"throws",
"IOException",
"{",
"Element",
"retElement",
"=",
"null",
";",
"if",
"(",
"source",
"instanceof",
"StreamSource",
")",
"{",
"StreamSource",
"streamSource",
"=",
"(",
"Strea... | Parse the contents of the provided source into an element.
This uses the document builder associated with the current thread.
@param source
@return
@throws IOException | [
"Parse",
"the",
"contents",
"of",
"the",
"provided",
"source",
"into",
"an",
"element",
".",
"This",
"uses",
"the",
"document",
"builder",
"associated",
"with",
"the",
"current",
"thread",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L370-L435 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.node2String | public static String node2String(final Node node) throws UnsupportedEncodingException
{
return node2String(node, true, Constants.DEFAULT_XML_CHARSET);
} | java | public static String node2String(final Node node) throws UnsupportedEncodingException
{
return node2String(node, true, Constants.DEFAULT_XML_CHARSET);
} | [
"public",
"static",
"String",
"node2String",
"(",
"final",
"Node",
"node",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"node2String",
"(",
"node",
",",
"true",
",",
"Constants",
".",
"DEFAULT_XML_CHARSET",
")",
";",
"}"
] | Converts XML node in pretty mode using UTF-8 encoding to string.
@param node XML document or element
@return XML string
@throws Exception if some error occurs | [
"Converts",
"XML",
"node",
"in",
"pretty",
"mode",
"using",
"UTF",
"-",
"8",
"encoding",
"to",
"string",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L444-L447 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.node2String | public static String node2String(final Node node, boolean prettyPrint) throws UnsupportedEncodingException
{
return node2String(node, prettyPrint, Constants.DEFAULT_XML_CHARSET);
} | java | public static String node2String(final Node node, boolean prettyPrint) throws UnsupportedEncodingException
{
return node2String(node, prettyPrint, Constants.DEFAULT_XML_CHARSET);
} | [
"public",
"static",
"String",
"node2String",
"(",
"final",
"Node",
"node",
",",
"boolean",
"prettyPrint",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"node2String",
"(",
"node",
",",
"prettyPrint",
",",
"Constants",
".",
"DEFAULT_XML_CHARSET",
")",... | Converts XML node in specified pretty mode using UTF-8 encoding to string.
@param node XML document or element
@param prettyPrint whether XML have to be pretty formated
@return XML string
@throws Exception if some error occurs | [
"Converts",
"XML",
"node",
"in",
"specified",
"pretty",
"mode",
"using",
"UTF",
"-",
"8",
"encoding",
"to",
"string",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L457-L460 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.node2String | public static String node2String(final Node node, boolean prettyPrint, String encoding) throws UnsupportedEncodingException
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new DOMWriter(new PrintWriter(baos), encoding).setPrettyprint(prettyPrint).print(node);
return baos.toString(encoding);
} | java | public static String node2String(final Node node, boolean prettyPrint, String encoding) throws UnsupportedEncodingException
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new DOMWriter(new PrintWriter(baos), encoding).setPrettyprint(prettyPrint).print(node);
return baos.toString(encoding);
} | [
"public",
"static",
"String",
"node2String",
"(",
"final",
"Node",
"node",
",",
"boolean",
"prettyPrint",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"final",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",... | Converts XML node in specified pretty mode and encoding to string.
@param node XML document or element
@param prettyPrint whether XML have to be pretty formated
@param encoding to use
@return XML string
@throws UnsupportedEncodingException | [
"Converts",
"XML",
"node",
"in",
"specified",
"pretty",
"mode",
"and",
"encoding",
"to",
"string",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L471-L476 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/deployment/ContextPropertiesDeploymentAspect.java | ContextPropertiesDeploymentAspect.setContextProperties | public void setContextProperties(Map<String, String> contextProperties)
{
if (contextProperties != null) {
this.contextProperties = new HashMap<String, String>(4);
this.contextProperties.putAll(contextProperties);
}
} | java | public void setContextProperties(Map<String, String> contextProperties)
{
if (contextProperties != null) {
this.contextProperties = new HashMap<String, String>(4);
this.contextProperties.putAll(contextProperties);
}
} | [
"public",
"void",
"setContextProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"contextProperties",
")",
"{",
"if",
"(",
"contextProperties",
"!=",
"null",
")",
"{",
"this",
".",
"contextProperties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Stri... | This is called once at AS boot time during deployment aspect parsing;
this provided map is copied.
@param contextProperties | [
"This",
"is",
"called",
"once",
"at",
"AS",
"boot",
"time",
"during",
"deployment",
"aspect",
"parsing",
";",
"this",
"provided",
"map",
"is",
"copied",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/deployment/ContextPropertiesDeploymentAspect.java#L53-L59 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java | MethodIdentifier.getParameterTypes | public String[] getParameterTypes() {
final String[] parameterTypes = this.parameterTypes;
return parameterTypes == NO_STRINGS ? parameterTypes : parameterTypes.clone();
} | java | public String[] getParameterTypes() {
final String[] parameterTypes = this.parameterTypes;
return parameterTypes == NO_STRINGS ? parameterTypes : parameterTypes.clone();
} | [
"public",
"String",
"[",
"]",
"getParameterTypes",
"(",
")",
"{",
"final",
"String",
"[",
"]",
"parameterTypes",
"=",
"this",
".",
"parameterTypes",
";",
"return",
"parameterTypes",
"==",
"NO_STRINGS",
"?",
"parameterTypes",
":",
"parameterTypes",
".",
"clone",
... | Get the parameter type names, as strings.
@return the parameter type names | [
"Get",
"the",
"parameter",
"type",
"names",
"as",
"strings",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java#L121-L124 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java | MethodIdentifier.getPublicMethod | public Method getPublicMethod(final Class<?> clazz) throws NoSuchMethodException, ClassNotFoundException {
return clazz.getMethod(name, typesOf(parameterTypes, clazz.getClassLoader()));
} | java | public Method getPublicMethod(final Class<?> clazz) throws NoSuchMethodException, ClassNotFoundException {
return clazz.getMethod(name, typesOf(parameterTypes, clazz.getClassLoader()));
} | [
"public",
"Method",
"getPublicMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"NoSuchMethodException",
",",
"ClassNotFoundException",
"{",
"return",
"clazz",
".",
"getMethod",
"(",
"name",
",",
"typesOf",
"(",
"parameterTypes",
",",
"clazz... | Look up a public method matching this method identifier using reflection.
@param clazz the class to search
@return the method
@throws NoSuchMethodException if no such method exists
@throws ClassNotFoundException if one of the classes referenced by this identifier are not found in {@code clazz}'s
class loader | [
"Look",
"up",
"a",
"public",
"method",
"matching",
"this",
"method",
"identifier",
"using",
"reflection",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java#L179-L181 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java | MethodIdentifier.getIdentifier | public static MethodIdentifier getIdentifier(final Class<?> returnType, final String name, final Class<?>... parameterTypes) {
return new MethodIdentifier(returnType.getName(), name, namesOf(parameterTypes));
} | java | public static MethodIdentifier getIdentifier(final Class<?> returnType, final String name, final Class<?>... parameterTypes) {
return new MethodIdentifier(returnType.getName(), name, namesOf(parameterTypes));
} | [
"public",
"static",
"MethodIdentifier",
"getIdentifier",
"(",
"final",
"Class",
"<",
"?",
">",
"returnType",
",",
"final",
"String",
"name",
",",
"final",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"return",
"new",
"MethodIdentifier",
"(",
"r... | Construct a new instance using class objects for the parameter types.
@param returnType the method return type
@param name the method name
@param parameterTypes the method parameter types
@return the identifier | [
"Construct",
"a",
"new",
"instance",
"using",
"class",
"objects",
"for",
"the",
"parameter",
"types",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java#L219-L221 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java | MethodIdentifier.getIdentifier | public static MethodIdentifier getIdentifier(final String returnType, final String name, final String... parameterTypes) {
return new MethodIdentifier(returnType, name, parameterTypes);
} | java | public static MethodIdentifier getIdentifier(final String returnType, final String name, final String... parameterTypes) {
return new MethodIdentifier(returnType, name, parameterTypes);
} | [
"public",
"static",
"MethodIdentifier",
"getIdentifier",
"(",
"final",
"String",
"returnType",
",",
"final",
"String",
"name",
",",
"final",
"String",
"...",
"parameterTypes",
")",
"{",
"return",
"new",
"MethodIdentifier",
"(",
"returnType",
",",
"name",
",",
"p... | Construct a new instance using string names for the return and parameter types.
@param returnType the return type name
@param name the method name
@param parameterTypes the method parameter type names
@return the identifier | [
"Construct",
"a",
"new",
"instance",
"using",
"string",
"names",
"for",
"the",
"return",
"and",
"parameter",
"types",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java#L231-L233 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/ProxyConfiguration.java | ProxyConfiguration.setProxyName | public ProxyConfiguration<T> setProxyName(final Package pkg, final String simpleName) {
this.proxyName = pkg.getName() + '.' + simpleName;
return this;
} | java | public ProxyConfiguration<T> setProxyName(final Package pkg, final String simpleName) {
this.proxyName = pkg.getName() + '.' + simpleName;
return this;
} | [
"public",
"ProxyConfiguration",
"<",
"T",
">",
"setProxyName",
"(",
"final",
"Package",
"pkg",
",",
"final",
"String",
"simpleName",
")",
"{",
"this",
".",
"proxyName",
"=",
"pkg",
".",
"getName",
"(",
")",
"+",
"'",
"'",
"+",
"simpleName",
";",
"return"... | Sets the proxy name
@param pkg The package to define the proxy in
@param simpleName The simple class name
@return the builder | [
"Sets",
"the",
"proxy",
"name"
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/ProxyConfiguration.java#L137-L140 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.loadJavaType | public static Class<?> loadJavaType(String typeName, ClassLoader classLoader) throws ClassNotFoundException
{
if (classLoader == null)
classLoader = getContextClassLoader();
Class<?> javaType = primitiveNames.get(typeName);
if (javaType == null)
javaType = getArray(typeName, classLoader);
if (javaType == null)
javaType = classLoader.loadClass(typeName);
return javaType;
} | java | public static Class<?> loadJavaType(String typeName, ClassLoader classLoader) throws ClassNotFoundException
{
if (classLoader == null)
classLoader = getContextClassLoader();
Class<?> javaType = primitiveNames.get(typeName);
if (javaType == null)
javaType = getArray(typeName, classLoader);
if (javaType == null)
javaType = classLoader.loadClass(typeName);
return javaType;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"loadJavaType",
"(",
"String",
"typeName",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"classLoader",
"==",
"null",
")",
"classLoader",
"=",
"getContextClassLoader",
"(",
... | Load a Java type from a given class loader.
@param typeName maybe the source notation of a primitve, class name, array of both | [
"Load",
"a",
"Java",
"type",
"from",
"a",
"given",
"class",
"loader",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L137-L150 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.isPrimitive | public static boolean isPrimitive(Class<?> javaType)
{
return javaType.isPrimitive() || (javaType.isArray() && isPrimitive(javaType.getComponentType()));
} | java | public static boolean isPrimitive(Class<?> javaType)
{
return javaType.isPrimitive() || (javaType.isArray() && isPrimitive(javaType.getComponentType()));
} | [
"public",
"static",
"boolean",
"isPrimitive",
"(",
"Class",
"<",
"?",
">",
"javaType",
")",
"{",
"return",
"javaType",
".",
"isPrimitive",
"(",
")",
"||",
"(",
"javaType",
".",
"isArray",
"(",
")",
"&&",
"isPrimitive",
"(",
"javaType",
".",
"getComponentTy... | True if the given class is a primitive or array of which. | [
"True",
"if",
"the",
"given",
"class",
"is",
"a",
"primitive",
"or",
"array",
"of",
"which",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L181-L184 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.getJustClassName | public static String getJustClassName(Class<?> cls)
{
if (cls == null)
return null;
if (cls.isArray())
{
Class<?> c = cls.getComponentType();
return getJustClassName(c.getName());
}
return getJustClassName(cls.getName());
} | java | public static String getJustClassName(Class<?> cls)
{
if (cls == null)
return null;
if (cls.isArray())
{
Class<?> c = cls.getComponentType();
return getJustClassName(c.getName());
}
return getJustClassName(cls.getName());
} | [
"public",
"static",
"String",
"getJustClassName",
"(",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"if",
"(",
"cls",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"cls",
".",
"isArray",
"(",
")",
")",
"{",
"Class",
"<",
"?",
">",
"c",
"=",
... | Given a class, strip out the package name
@param cls
@return just the classname | [
"Given",
"a",
"class",
"strip",
"out",
"the",
"package",
"name"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L271-L282 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.getJustClassName | public static String getJustClassName(String classname)
{
int index = classname.lastIndexOf('.');
if (index < 0)
index = 0;
else index = index + 1;
return classname.substring(index);
} | java | public static String getJustClassName(String classname)
{
int index = classname.lastIndexOf('.');
if (index < 0)
index = 0;
else index = index + 1;
return classname.substring(index);
} | [
"public",
"static",
"String",
"getJustClassName",
"(",
"String",
"classname",
")",
"{",
"int",
"index",
"=",
"classname",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"index",
"=",
"0",
";",
"else",
"index",
"=",
"i... | Given a FQN of a class, strip out the package name
@param classname
@return just the classname | [
"Given",
"a",
"FQN",
"of",
"a",
"class",
"strip",
"out",
"the",
"package",
"name"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L290-L297 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.getPrimitiveType | public static Class<?> getPrimitiveType(Class<?> javaType)
{
if (javaType == Integer.class)
return int.class;
if (javaType == Short.class)
return short.class;
if (javaType == Boolean.class)
return boolean.class;
if (javaType == Byte.class)
return byte.class;
if (javaType == Long.class)
return long.class;
if (javaType == Double.class)
return double.class;
if (javaType == Float.class)
return float.class;
if (javaType == Character.class)
return char.class;
if (javaType == Integer[].class)
return int[].class;
if (javaType == Short[].class)
return short[].class;
if (javaType == Boolean[].class)
return boolean[].class;
if (javaType == Byte[].class)
return byte[].class;
if (javaType == Long[].class)
return long[].class;
if (javaType == Double[].class)
return double[].class;
if (javaType == Float[].class)
return float[].class;
if (javaType == Character[].class)
return char[].class;
if (javaType.isArray() && javaType.getComponentType().isArray())
{
Class<?> compType = getPrimitiveType(javaType.getComponentType());
return Array.newInstance(compType, 0).getClass();
}
return javaType;
} | java | public static Class<?> getPrimitiveType(Class<?> javaType)
{
if (javaType == Integer.class)
return int.class;
if (javaType == Short.class)
return short.class;
if (javaType == Boolean.class)
return boolean.class;
if (javaType == Byte.class)
return byte.class;
if (javaType == Long.class)
return long.class;
if (javaType == Double.class)
return double.class;
if (javaType == Float.class)
return float.class;
if (javaType == Character.class)
return char.class;
if (javaType == Integer[].class)
return int[].class;
if (javaType == Short[].class)
return short[].class;
if (javaType == Boolean[].class)
return boolean[].class;
if (javaType == Byte[].class)
return byte[].class;
if (javaType == Long[].class)
return long[].class;
if (javaType == Double[].class)
return double[].class;
if (javaType == Float[].class)
return float[].class;
if (javaType == Character[].class)
return char[].class;
if (javaType.isArray() && javaType.getComponentType().isArray())
{
Class<?> compType = getPrimitiveType(javaType.getComponentType());
return Array.newInstance(compType, 0).getClass();
}
return javaType;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getPrimitiveType",
"(",
"Class",
"<",
"?",
">",
"javaType",
")",
"{",
"if",
"(",
"javaType",
"==",
"Integer",
".",
"class",
")",
"return",
"int",
".",
"class",
";",
"if",
"(",
"javaType",
"==",
"Short",
".... | Get the corresponding primitive for a give wrapper type.
Also handles arrays of which. | [
"Get",
"the",
"corresponding",
"primitive",
"for",
"a",
"give",
"wrapper",
"type",
".",
"Also",
"handles",
"arrays",
"of",
"which",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L303-L346 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.getPrimitiveValueArray | public static Object getPrimitiveValueArray(Object value)
{
if (value == null)
return null;
Class<?> javaType = value.getClass();
if (javaType.isArray())
{
int length = Array.getLength(value);
Object destArr = Array.newInstance(getPrimitiveType(javaType.getComponentType()), length);
for (int i = 0; i < length; i++)
{
Object srcObj = Array.get(value, i);
Array.set(destArr, i, getPrimitiveValueArray(srcObj));
}
return destArr;
}
return value;
} | java | public static Object getPrimitiveValueArray(Object value)
{
if (value == null)
return null;
Class<?> javaType = value.getClass();
if (javaType.isArray())
{
int length = Array.getLength(value);
Object destArr = Array.newInstance(getPrimitiveType(javaType.getComponentType()), length);
for (int i = 0; i < length; i++)
{
Object srcObj = Array.get(value, i);
Array.set(destArr, i, getPrimitiveValueArray(srcObj));
}
return destArr;
}
return value;
} | [
"public",
"static",
"Object",
"getPrimitiveValueArray",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"Class",
"<",
"?",
">",
"javaType",
"=",
"value",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"javaTy... | Converts an n-dimensional array of wrapper types to primitive types | [
"Converts",
"an",
"n",
"-",
"dimensional",
"array",
"of",
"wrapper",
"types",
"to",
"primitive",
"types"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L351-L370 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.isAssignableFrom | public static boolean isAssignableFrom(Class<?> dest, Class<?> src)
{
if (dest == null || src == null)
throw MESSAGES.cannotCheckClassIsAssignableFrom(dest, src);
boolean isAssignable = dest.isAssignableFrom(src);
if (isAssignable == false && dest.getName().equals(src.getName()))
{
ClassLoader destLoader = dest.getClassLoader();
ClassLoader srcLoader = src.getClassLoader();
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.notAssignableDueToConflictingClassLoaders(dest, src, destLoader, srcLoader);
}
if (isAssignable == false && isPrimitive(dest))
{
dest = getWrapperType(dest);
isAssignable = dest.isAssignableFrom(src);
}
if (isAssignable == false && isPrimitive(src))
{
src = getWrapperType(src);
isAssignable = dest.isAssignableFrom(src);
}
return isAssignable;
} | java | public static boolean isAssignableFrom(Class<?> dest, Class<?> src)
{
if (dest == null || src == null)
throw MESSAGES.cannotCheckClassIsAssignableFrom(dest, src);
boolean isAssignable = dest.isAssignableFrom(src);
if (isAssignable == false && dest.getName().equals(src.getName()))
{
ClassLoader destLoader = dest.getClassLoader();
ClassLoader srcLoader = src.getClassLoader();
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.notAssignableDueToConflictingClassLoaders(dest, src, destLoader, srcLoader);
}
if (isAssignable == false && isPrimitive(dest))
{
dest = getWrapperType(dest);
isAssignable = dest.isAssignableFrom(src);
}
if (isAssignable == false && isPrimitive(src))
{
src = getWrapperType(src);
isAssignable = dest.isAssignableFrom(src);
}
return isAssignable;
} | [
"public",
"static",
"boolean",
"isAssignableFrom",
"(",
"Class",
"<",
"?",
">",
"dest",
",",
"Class",
"<",
"?",
">",
"src",
")",
"{",
"if",
"(",
"dest",
"==",
"null",
"||",
"src",
"==",
"null",
")",
"throw",
"MESSAGES",
".",
"cannotCheckClassIsAssignable... | Return true if the dest class is assignable from the src.
Also handles arrays and primitives. | [
"Return",
"true",
"if",
"the",
"dest",
"class",
"is",
"assignable",
"from",
"the",
"src",
".",
"Also",
"handles",
"arrays",
"and",
"primitives",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L454-L478 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.erasure | public static Class<?> erasure(Type type)
{
if (type instanceof ParameterizedType)
{
return erasure(((ParameterizedType)type).getRawType());
}
if (type instanceof TypeVariable<?>)
{
return erasure(((TypeVariable<?>)type).getBounds()[0]);
}
if (type instanceof WildcardType)
{
return erasure(((WildcardType)type).getUpperBounds()[0]);
}
if (type instanceof GenericArrayType)
{
return Array.newInstance(erasure(((GenericArrayType)type).getGenericComponentType()), 0).getClass();
}
// Only type left is class
return (Class<?>)type;
} | java | public static Class<?> erasure(Type type)
{
if (type instanceof ParameterizedType)
{
return erasure(((ParameterizedType)type).getRawType());
}
if (type instanceof TypeVariable<?>)
{
return erasure(((TypeVariable<?>)type).getBounds()[0]);
}
if (type instanceof WildcardType)
{
return erasure(((WildcardType)type).getUpperBounds()[0]);
}
if (type instanceof GenericArrayType)
{
return Array.newInstance(erasure(((GenericArrayType)type).getGenericComponentType()), 0).getClass();
}
// Only type left is class
return (Class<?>)type;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"erasure",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"return",
"erasure",
"(",
"(",
"(",
"ParameterizedType",
")",
"type",
")",
".",
"getRawType",
"(",
")",
... | Erases a type according to the JLS type erasure rules
@param t type to erase
@return erased type | [
"Erases",
"a",
"type",
"according",
"to",
"the",
"JLS",
"type",
"erasure",
"rules"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L605-L626 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.isJBossRepositoryClassLoader | public static boolean isJBossRepositoryClassLoader(ClassLoader loader)
{
Class<?> clazz = loader.getClass();
while (!clazz.getName().startsWith("java"))
{
if ("org.jboss.mx.loading.RepositoryClassLoader".equals(clazz.getName()))
return true;
clazz = clazz.getSuperclass();
}
return false;
} | java | public static boolean isJBossRepositoryClassLoader(ClassLoader loader)
{
Class<?> clazz = loader.getClass();
while (!clazz.getName().startsWith("java"))
{
if ("org.jboss.mx.loading.RepositoryClassLoader".equals(clazz.getName()))
return true;
clazz = clazz.getSuperclass();
}
return false;
} | [
"public",
"static",
"boolean",
"isJBossRepositoryClassLoader",
"(",
"ClassLoader",
"loader",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"loader",
".",
"getClass",
"(",
")",
";",
"while",
"(",
"!",
"clazz",
".",
"getName",
"(",
")",
".",
"startsWith",
... | Tests if this class loader is a JBoss RepositoryClassLoader
@param loader
@return | [
"Tests",
"if",
"this",
"class",
"loader",
"is",
"a",
"JBoss",
"RepositoryClassLoader"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L658-L669 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/JavaUtils.java | JavaUtils.clearBlacklists | public static void clearBlacklists(ClassLoader loader)
{
if (isJBossRepositoryClassLoader(loader))
{
for(Method m : loader.getClass().getMethods())
{
if("clearBlackLists".equalsIgnoreCase(m.getName()))
{
try
{
m.invoke(loader);
}
catch (Exception e)
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.couldNotClearBlacklist(loader, e);
}
}
}
}
} | java | public static void clearBlacklists(ClassLoader loader)
{
if (isJBossRepositoryClassLoader(loader))
{
for(Method m : loader.getClass().getMethods())
{
if("clearBlackLists".equalsIgnoreCase(m.getName()))
{
try
{
m.invoke(loader);
}
catch (Exception e)
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.couldNotClearBlacklist(loader, e);
}
}
}
}
} | [
"public",
"static",
"void",
"clearBlacklists",
"(",
"ClassLoader",
"loader",
")",
"{",
"if",
"(",
"isJBossRepositoryClassLoader",
"(",
"loader",
")",
")",
"{",
"for",
"(",
"Method",
"m",
":",
"loader",
".",
"getClass",
"(",
")",
".",
"getMethods",
"(",
")"... | Clears black lists on a JBoss RepositoryClassLoader. This is somewhat of a hack, and
could be replaced with an integration module. This is needed when the following order of
events occur.
<ol>
<li>loadClass() returns not found</li>
<li>Some call to defineClass()</li>
<ol>
The CNFE triggers a black list addition, which cause the class never again to be found.
@param loader the loader to clear black lists for | [
"Clears",
"black",
"lists",
"on",
"a",
"JBoss",
"RepositoryClassLoader",
".",
"This",
"is",
"somewhat",
"of",
"a",
"hack",
"and",
"could",
"be",
"replaced",
"with",
"an",
"integration",
"module",
".",
"This",
"is",
"needed",
"when",
"the",
"following",
"orde... | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/JavaUtils.java#L685-L704 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/resolvers/ResourceReferenceResolver.java | ResourceReferenceResolver.getName | private static String getName(final String resourceName, final String fallBackName)
{
return resourceName.length() > 0 ? resourceName : fallBackName;
} | java | private static String getName(final String resourceName, final String fallBackName)
{
return resourceName.length() > 0 ? resourceName : fallBackName;
} | [
"private",
"static",
"String",
"getName",
"(",
"final",
"String",
"resourceName",
",",
"final",
"String",
"fallBackName",
")",
"{",
"return",
"resourceName",
".",
"length",
"(",
")",
">",
"0",
"?",
"resourceName",
":",
"fallBackName",
";",
"}"
] | Returns JNDI resource name.
@param resourceName to use if specified
@param fallBackName fall back bean name otherwise
@return JNDI resource name | [
"Returns",
"JNDI",
"resource",
"name",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/resolvers/ResourceReferenceResolver.java#L77-L80 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/resolvers/ResourceReferenceResolver.java | ResourceReferenceResolver.convertToBeanName | private static String convertToBeanName(final String methodName)
{
return Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
} | java | private static String convertToBeanName(final String methodName)
{
return Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
} | [
"private",
"static",
"String",
"convertToBeanName",
"(",
"final",
"String",
"methodName",
")",
"{",
"return",
"Character",
".",
"toLowerCase",
"(",
"methodName",
".",
"charAt",
"(",
"3",
")",
")",
"+",
"methodName",
".",
"substring",
"(",
"4",
")",
";",
"}... | Translates "setBeanName" to "beanName" string.
@param methodName to translate
@return bean name | [
"Translates",
"setBeanName",
"to",
"beanName",
"string",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/resolvers/ResourceReferenceResolver.java#L88-L91 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/invocation/AbstractInvocationHandler.java | AbstractInvocationHandler.getImplMethod | protected final Method getImplMethod(final Class<?> implClass, final Method seiMethod) throws NoSuchMethodException
{
final String methodName = seiMethod.getName();
final Class<?>[] paramTypes = seiMethod.getParameterTypes();
return implClass.getMethod(methodName, paramTypes);
} | java | protected final Method getImplMethod(final Class<?> implClass, final Method seiMethod) throws NoSuchMethodException
{
final String methodName = seiMethod.getName();
final Class<?>[] paramTypes = seiMethod.getParameterTypes();
return implClass.getMethod(methodName, paramTypes);
} | [
"protected",
"final",
"Method",
"getImplMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"implClass",
",",
"final",
"Method",
"seiMethod",
")",
"throws",
"NoSuchMethodException",
"{",
"final",
"String",
"methodName",
"=",
"seiMethod",
".",
"getName",
"(",
")",
"... | Returns implementation method that will be used for invocation.
@param implClass implementation endpoint class
@param seiMethod SEI interface method used for method finding algorithm
@return implementation method
@throws NoSuchMethodException if implementation method wasn't found | [
"Returns",
"implementation",
"method",
"that",
"will",
"be",
"used",
"for",
"invocation",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/invocation/AbstractInvocationHandler.java#L82-L88 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java | ConfigHelper.setupConfigHandlers | @SuppressWarnings("rawtypes")
public void setupConfigHandlers(Binding binding, CommonConfig config)
{
if (config != null) {
//start with the use handlers only to remove the previously set configuration
List<Handler> userHandlers = getNonConfigHandlers(binding.getHandlerChain());
List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding.getBindingID(), true); //PRE
handlers.addAll(userHandlers); //ENDPOINT
handlers.addAll(convertToHandlers(config.getPostHandlerChains(), binding.getBindingID(), false)); //POST
binding.setHandlerChain(handlers);
}
} | java | @SuppressWarnings("rawtypes")
public void setupConfigHandlers(Binding binding, CommonConfig config)
{
if (config != null) {
//start with the use handlers only to remove the previously set configuration
List<Handler> userHandlers = getNonConfigHandlers(binding.getHandlerChain());
List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding.getBindingID(), true); //PRE
handlers.addAll(userHandlers); //ENDPOINT
handlers.addAll(convertToHandlers(config.getPostHandlerChains(), binding.getBindingID(), false)); //POST
binding.setHandlerChain(handlers);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"void",
"setupConfigHandlers",
"(",
"Binding",
"binding",
",",
"CommonConfig",
"config",
")",
"{",
"if",
"(",
"config",
"!=",
"null",
")",
"{",
"//start with the use handlers only to remove the previously set ... | Setups a given Binding instance using a specified CommonConfig
@param binding the Binding instance to setup
@param config the CommonConfig with the input configuration | [
"Setups",
"a",
"given",
"Binding",
"instance",
"using",
"a",
"specified",
"CommonConfig"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java#L176-L187 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/ProxyFactory.java | ProxyFactory.newInstance | public T newInstance(InvocationHandler handler) throws InstantiationException, IllegalAccessException {
T ret = newInstance();
setInvocationHandler(ret, handler);
return ret;
} | java | public T newInstance(InvocationHandler handler) throws InstantiationException, IllegalAccessException {
T ret = newInstance();
setInvocationHandler(ret, handler);
return ret;
} | [
"public",
"T",
"newInstance",
"(",
"InvocationHandler",
"handler",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"T",
"ret",
"=",
"newInstance",
"(",
")",
";",
"setInvocationHandler",
"(",
"ret",
",",
"handler",
")",
";",
"return",
... | Create a new proxy, initialising it with the given invocation handler.
@param handler the invocation handler to use
@return the new proxy instance
@throws IllegalAccessException if the constructor is not accessible
@throws InstantiationException if instantiation failed due to an exception | [
"Create",
"a",
"new",
"proxy",
"initialising",
"it",
"with",
"the",
"given",
"invocation",
"handler",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/ProxyFactory.java#L269-L273 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/ProxyFactory.java | ProxyFactory.setInvocationHandler | public void setInvocationHandler(Object proxy, InvocationHandler handler) {
Field field = getInvocationHandlerField();
try {
field.set(proxy, handler);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | java | public void setInvocationHandler(Object proxy, InvocationHandler handler) {
Field field = getInvocationHandlerField();
try {
field.set(proxy, handler);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"setInvocationHandler",
"(",
"Object",
"proxy",
",",
"InvocationHandler",
"handler",
")",
"{",
"Field",
"field",
"=",
"getInvocationHandlerField",
"(",
")",
";",
"try",
"{",
"field",
".",
"set",
"(",
"proxy",
",",
"handler",
")",
";",
"}",
... | Sets the invocation handler for a proxy created from this factory.
@param proxy the proxy to modify
@param handler the handler to use | [
"Sets",
"the",
"invocation",
"handler",
"for",
"a",
"proxy",
"created",
"from",
"this",
"factory",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/ProxyFactory.java#L358-L367 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/ProxyFactory.java | ProxyFactory.getInvocationHandler | public InvocationHandler getInvocationHandler(Object proxy) {
Field field = getInvocationHandlerField();
try {
return (InvocationHandler) field.get(proxy);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Object is not a proxy of correct type", e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | java | public InvocationHandler getInvocationHandler(Object proxy) {
Field field = getInvocationHandlerField();
try {
return (InvocationHandler) field.get(proxy);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Object is not a proxy of correct type", e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | [
"public",
"InvocationHandler",
"getInvocationHandler",
"(",
"Object",
"proxy",
")",
"{",
"Field",
"field",
"=",
"getInvocationHandlerField",
"(",
")",
";",
"try",
"{",
"return",
"(",
"InvocationHandler",
")",
"field",
".",
"get",
"(",
"proxy",
")",
";",
"}",
... | Returns the invocation handler for a proxy created from this factory.
@param proxy the proxy
@return the invocation handler | [
"Returns",
"the",
"invocation",
"handler",
"for",
"a",
"proxy",
"created",
"from",
"this",
"factory",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/ProxyFactory.java#L375-L384 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractClassFactory.java | AbstractClassFactory.isProxyClassDefined | public boolean isProxyClassDefined(ClassLoader classLoader) {
try {
// first check that the proxy has not already been created
classLoader.loadClass(this.className);
return true;
} catch (ClassNotFoundException e) {
return false;
}
} | java | public boolean isProxyClassDefined(ClassLoader classLoader) {
try {
// first check that the proxy has not already been created
classLoader.loadClass(this.className);
return true;
} catch (ClassNotFoundException e) {
return false;
}
} | [
"public",
"boolean",
"isProxyClassDefined",
"(",
"ClassLoader",
"classLoader",
")",
"{",
"try",
"{",
"// first check that the proxy has not already been created",
"classLoader",
".",
"loadClass",
"(",
"this",
".",
"className",
")",
";",
"return",
"true",
";",
"}",
"ca... | Checks if the proxy class has been defined in the given class loader
@param classLoader The class loader to check
@return true if the proxy is defined in the class loader | [
"Checks",
"if",
"the",
"proxy",
"class",
"has",
"been",
"defined",
"in",
"the",
"given",
"class",
"loader"
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractClassFactory.java#L228-L236 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java | ContextRootDeploymentAspect.getImplicitContextRoot | protected String getImplicitContextRoot(ArchiveDeployment dep)
{
String simpleName = dep.getSimpleName();
String contextRoot = simpleName.substring(0, simpleName.length() - 4);
return contextRoot;
} | java | protected String getImplicitContextRoot(ArchiveDeployment dep)
{
String simpleName = dep.getSimpleName();
String contextRoot = simpleName.substring(0, simpleName.length() - 4);
return contextRoot;
} | [
"protected",
"String",
"getImplicitContextRoot",
"(",
"ArchiveDeployment",
"dep",
")",
"{",
"String",
"simpleName",
"=",
"dep",
".",
"getSimpleName",
"(",
")",
";",
"String",
"contextRoot",
"=",
"simpleName",
".",
"substring",
"(",
"0",
",",
"simpleName",
".",
... | Use the implicit context root derived from the deployment name | [
"Use",
"the",
"implicit",
"context",
"root",
"derived",
"from",
"the",
"deployment",
"name"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java#L100-L105 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/IOUtils.java | IOUtils.copyReader | public static void copyReader(OutputStream outs, Reader reader) throws IOException
{
try
{
OutputStreamWriter writer = new OutputStreamWriter(outs, StandardCharsets.UTF_8);
char[] bytes = new char[1024];
int r = reader.read(bytes);
while (r > 0)
{
writer.write(bytes, 0, r);
r = reader.read(bytes);
}
}
catch (IOException e)
{
throw e;
}
finally{
reader.close();
}
} | java | public static void copyReader(OutputStream outs, Reader reader) throws IOException
{
try
{
OutputStreamWriter writer = new OutputStreamWriter(outs, StandardCharsets.UTF_8);
char[] bytes = new char[1024];
int r = reader.read(bytes);
while (r > 0)
{
writer.write(bytes, 0, r);
r = reader.read(bytes);
}
}
catch (IOException e)
{
throw e;
}
finally{
reader.close();
}
} | [
"public",
"static",
"void",
"copyReader",
"(",
"OutputStream",
"outs",
",",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"try",
"{",
"OutputStreamWriter",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"outs",
",",
"StandardCharsets",
".",
"UTF_8",
"... | Copy the reader to the output stream | [
"Copy",
"the",
"reader",
"to",
"the",
"output",
"stream"
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/IOUtils.java#L95-L115 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/InterceptorInvocationHandler.java | InterceptorInvocationHandler.invoke | public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
InterceptorContext context = new InterceptorContext();
context.setParameters(args);
context.setMethod(method);
return interceptor.processInvocation(context);
} | java | public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
InterceptorContext context = new InterceptorContext();
context.setParameters(args);
context.setMethod(method);
return interceptor.processInvocation(context);
} | [
"public",
"Object",
"invoke",
"(",
"final",
"Object",
"proxy",
",",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"InterceptorContext",
"context",
"=",
"new",
"InterceptorContext",
"(",
")",
";",
"con... | Handle a proxy method invocation.
@param proxy the proxy instance
@param method the invoked method
@param args the method arguments
@return the result of the method call
@throws Throwable the exception to thrown from the method invocation on the proxy instance, if any | [
"Handle",
"a",
"proxy",
"method",
"invocation",
"."
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/InterceptorInvocationHandler.java#L60-L65 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/UUIDGenerator.java | UUIDGenerator.generateRandomUUIDBytes | public static byte[] generateRandomUUIDBytes()
{
if (rand == null)
rand = new SecureRandom();
byte[] buffer = new byte[16];
rand.nextBytes(buffer);
// Set version to 3 (Random)
buffer[6] = (byte) ((buffer[6] & 0x0f) | 0x40);
// Set variant to 2 (IETF)
buffer[8] = (byte) ((buffer[8] & 0x3f) | 0x80);
return buffer;
} | java | public static byte[] generateRandomUUIDBytes()
{
if (rand == null)
rand = new SecureRandom();
byte[] buffer = new byte[16];
rand.nextBytes(buffer);
// Set version to 3 (Random)
buffer[6] = (byte) ((buffer[6] & 0x0f) | 0x40);
// Set variant to 2 (IETF)
buffer[8] = (byte) ((buffer[8] & 0x3f) | 0x80);
return buffer;
} | [
"public",
"static",
"byte",
"[",
"]",
"generateRandomUUIDBytes",
"(",
")",
"{",
"if",
"(",
"rand",
"==",
"null",
")",
"rand",
"=",
"new",
"SecureRandom",
"(",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"16",
"]",
";",
"rand",
".... | Generates a pseudo random UUID and returns it in byte array form.
@return a UUID byte array in network order | [
"Generates",
"a",
"pseudo",
"random",
"UUID",
"and",
"returns",
"it",
"in",
"byte",
"array",
"form",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/UUIDGenerator.java#L58-L72 | train |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/UUIDGenerator.java | UUIDGenerator.convertToString | public static String convertToString(byte[] uuid)
{
if (uuid.length != 16)
throw Messages.MESSAGES.uuidMustBeOf16Bytes();
String string = bytesToHex(uuid, 0, 4) + "-"
+ bytesToHex(uuid, 4, 2) + "-"
+ bytesToHex(uuid, 6, 2) + "-"
+ bytesToHex(uuid, 8, 2) + "-"
+ bytesToHex(uuid, 10, 6);
return string;
} | java | public static String convertToString(byte[] uuid)
{
if (uuid.length != 16)
throw Messages.MESSAGES.uuidMustBeOf16Bytes();
String string = bytesToHex(uuid, 0, 4) + "-"
+ bytesToHex(uuid, 4, 2) + "-"
+ bytesToHex(uuid, 6, 2) + "-"
+ bytesToHex(uuid, 8, 2) + "-"
+ bytesToHex(uuid, 10, 6);
return string;
} | [
"public",
"static",
"String",
"convertToString",
"(",
"byte",
"[",
"]",
"uuid",
")",
"{",
"if",
"(",
"uuid",
".",
"length",
"!=",
"16",
")",
"throw",
"Messages",
".",
"MESSAGES",
".",
"uuidMustBeOf16Bytes",
"(",
")",
";",
"String",
"string",
"=",
"bytesT... | Converts a UUID in byte array form to the IETF string format.
<p>The BNF follows:
<pre>
UUID = <time_low> "-" <time_mid> "-"
<time_high_and_version> "-"
<variant_and_sequence> "-"
<node>
time_low = 4*<hexOctet>
time_mid = 2*<hexOctet>
time_high_and_version = 2*<hexOctet>
variant_and_sequence = 2*<hexOctet>
node = 6*<hexOctet>
hexOctet = <hexDigit><hexDigit>
hexDigit =
"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
| "a" | "b" | "c" | "d" | "e" | "f"
| "A" | "B" | "C" | "D" | "E" | "F"
</pre>
@param uuid a 16 byte
@return the IETF string form of the passed UUID | [
"Converts",
"a",
"UUID",
"in",
"byte",
"array",
"form",
"to",
"the",
"IETF",
"string",
"format",
"."
] | fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7 | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/UUIDGenerator.java#L110-L122 | train |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractProxyFactory.java | AbstractProxyFactory.afterClassLoad | @Override
public void afterClassLoad(Class<?> clazz) {
super.afterClassLoad(clazz);
//force <clinit> to be run, while the correct ThreadLocal is set
//if we do not run this then <clinit> may be run later, perhaps even in
//another thread
try {
Class.forName(clazz.getName(), true, clazz.getClassLoader());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} | java | @Override
public void afterClassLoad(Class<?> clazz) {
super.afterClassLoad(clazz);
//force <clinit> to be run, while the correct ThreadLocal is set
//if we do not run this then <clinit> may be run later, perhaps even in
//another thread
try {
Class.forName(clazz.getName(), true, clazz.getClassLoader());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Override",
"public",
"void",
"afterClassLoad",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"super",
".",
"afterClassLoad",
"(",
"clazz",
")",
";",
"//force <clinit> to be run, while the correct ThreadLocal is set",
"//if we do not run this then <clinit> may be run... | Sets the accessible flag on the cached methods | [
"Sets",
"the",
"accessible",
"flag",
"on",
"the",
"cached",
"methods"
] | f72586a554264cbc78fcdad9fdd3e84b833249c9 | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractProxyFactory.java#L100-L111 | train |
nominanuda/zen-project | zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java | HtmlUnitRegExpProxy.isEscaped | static boolean isEscaped(final String characters, final int position) {
int p = position;
int nbBackslash = 0;
while (p > 0 && characters.charAt(--p) == '\\') {
nbBackslash++;
}
return (nbBackslash % 2 == 1);
} | java | static boolean isEscaped(final String characters, final int position) {
int p = position;
int nbBackslash = 0;
while (p > 0 && characters.charAt(--p) == '\\') {
nbBackslash++;
}
return (nbBackslash % 2 == 1);
} | [
"static",
"boolean",
"isEscaped",
"(",
"final",
"String",
"characters",
",",
"final",
"int",
"position",
")",
"{",
"int",
"p",
"=",
"position",
";",
"int",
"nbBackslash",
"=",
"0",
";",
"while",
"(",
"p",
">",
"0",
"&&",
"characters",
".",
"charAt",
"(... | Indicates if the character at the given position is escaped or not.
@param characters
the characters to consider
@param position
the position
@return <code>true</code> if escaped | [
"Indicates",
"if",
"the",
"character",
"at",
"the",
"given",
"position",
"is",
"escaped",
"or",
"not",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java#L242-L249 | train |
nominanuda/zen-project | zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java | HtmlUnitRegExpProxy.wrappedAction | private Object wrappedAction(final Context cx, final Scriptable scope,
final Scriptable thisObj, final Object[] args, final int actionType) {
// take care to set the context's RegExp proxy to the original one as
// this is checked
// (cf net.sourceforge.htmlunit.corejs.javascript.regexp.RegExpImp:334)
try {
ScriptRuntime.setRegExpProxy(cx, wrapped_);
return wrapped_.action(cx, scope, thisObj, args, actionType);
} finally {
ScriptRuntime.setRegExpProxy(cx, this);
}
} | java | private Object wrappedAction(final Context cx, final Scriptable scope,
final Scriptable thisObj, final Object[] args, final int actionType) {
// take care to set the context's RegExp proxy to the original one as
// this is checked
// (cf net.sourceforge.htmlunit.corejs.javascript.regexp.RegExpImp:334)
try {
ScriptRuntime.setRegExpProxy(cx, wrapped_);
return wrapped_.action(cx, scope, thisObj, args, actionType);
} finally {
ScriptRuntime.setRegExpProxy(cx, this);
}
} | [
"private",
"Object",
"wrappedAction",
"(",
"final",
"Context",
"cx",
",",
"final",
"Scriptable",
"scope",
",",
"final",
"Scriptable",
"thisObj",
",",
"final",
"Object",
"[",
"]",
"args",
",",
"final",
"int",
"actionType",
")",
"{",
"// take care to set the conte... | Calls action on the wrapped RegExp proxy. | [
"Calls",
"action",
"on",
"the",
"wrapped",
"RegExp",
"proxy",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java#L254-L266 | train |
nominanuda/zen-project | zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java | HtmlUnitRegExpProxy.jsRegExpToJavaRegExp | static String jsRegExpToJavaRegExp(String re) {
re = re.replaceAll("\\[\\^\\\\\\d\\]", ".");
re = re.replaceAll("\\[([^\\]]*)\\\\b([^\\]]*)\\]", "[$1\\\\cH$2]"); // [...\b...]
// ->
// [...\cH...]
re = re.replaceAll("(?<!\\\\)\\[([^((?<!\\\\)\\[)\\]]*)\\[", "[$1\\\\["); // [...[...]
// ->
// [...\[...]
// back reference in character classes are simply ignored by browsers
re = re.replaceAll("(?<!\\\\)\\[([^\\]]*)(?<!\\\\)\\\\\\d", "[$1"); // [...ab\5cd...]
// ->
// [...abcd...]
// characters escaped without need should be "un-escaped"
re = re.replaceAll("(?<!\\\\)\\\\([ACE-RT-VX-Zaeg-mpqyz])", "$1");
re = escapeJSCurly(re);
return re;
} | java | static String jsRegExpToJavaRegExp(String re) {
re = re.replaceAll("\\[\\^\\\\\\d\\]", ".");
re = re.replaceAll("\\[([^\\]]*)\\\\b([^\\]]*)\\]", "[$1\\\\cH$2]"); // [...\b...]
// ->
// [...\cH...]
re = re.replaceAll("(?<!\\\\)\\[([^((?<!\\\\)\\[)\\]]*)\\[", "[$1\\\\["); // [...[...]
// ->
// [...\[...]
// back reference in character classes are simply ignored by browsers
re = re.replaceAll("(?<!\\\\)\\[([^\\]]*)(?<!\\\\)\\\\\\d", "[$1"); // [...ab\5cd...]
// ->
// [...abcd...]
// characters escaped without need should be "un-escaped"
re = re.replaceAll("(?<!\\\\)\\\\([ACE-RT-VX-Zaeg-mpqyz])", "$1");
re = escapeJSCurly(re);
return re;
} | [
"static",
"String",
"jsRegExpToJavaRegExp",
"(",
"String",
"re",
")",
"{",
"re",
"=",
"re",
".",
"replaceAll",
"(",
"\"\\\\[\\\\^\\\\\\\\\\\\d\\\\]\"",
",",
"\".\"",
")",
";",
"re",
"=",
"re",
".",
"replaceAll",
"(",
"\"\\\\[([^\\\\]]*)\\\\\\\\b([^\\\\]]*)\\\\]\"",
... | Transform a JavaScript regular expression to a Java regular expression
@param re
the JavaScript regular expression to transform
@return the transformed expression | [
"Transform",
"a",
"JavaScript",
"regular",
"expression",
"to",
"a",
"Java",
"regular",
"expression"
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java#L361-L380 | train |
nominanuda/zen-project | zen-store/src/main/java/com/nominanuda/solr/SolrHttpRequestHandler.java | SolrHttpRequestHandler.consumeInputFully | private void consumeInputFully(HttpServletRequest req) {
try {
ServletInputStream is = req.getInputStream();
while (!is.isFinished() && is.read() != -1) {
}
} catch (IOException e) {
log.info("Could not consume full client request", e);
}
} | java | private void consumeInputFully(HttpServletRequest req) {
try {
ServletInputStream is = req.getInputStream();
while (!is.isFinished() && is.read() != -1) {
}
} catch (IOException e) {
log.info("Could not consume full client request", e);
}
} | [
"private",
"void",
"consumeInputFully",
"(",
"HttpServletRequest",
"req",
")",
"{",
"try",
"{",
"ServletInputStream",
"is",
"=",
"req",
".",
"getInputStream",
"(",
")",
";",
"while",
"(",
"!",
"is",
".",
"isFinished",
"(",
")",
"&&",
"is",
".",
"read",
"... | connection - see SOLR-8453 and SOLR-8683 | [
"connection",
"-",
"see",
"SOLR",
"-",
"8453",
"and",
"SOLR",
"-",
"8683"
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-store/src/main/java/com/nominanuda/solr/SolrHttpRequestHandler.java#L172-L180 | train |
nominanuda/zen-project | zen-core/src/main/java/com/nominanuda/zen/xml/SaxBuffer.java | SaxBuffer.toSAX | public void toSAX(ContentHandler contentHandler) throws SAXException {
for (SaxBit saxbit : this.saxbits) {
saxbit.send(contentHandler);
}
} | java | public void toSAX(ContentHandler contentHandler) throws SAXException {
for (SaxBit saxbit : this.saxbits) {
saxbit.send(contentHandler);
}
} | [
"public",
"void",
"toSAX",
"(",
"ContentHandler",
"contentHandler",
")",
"throws",
"SAXException",
"{",
"for",
"(",
"SaxBit",
"saxbit",
":",
"this",
".",
"saxbits",
")",
"{",
"saxbit",
".",
"send",
"(",
"contentHandler",
")",
";",
"}",
"}"
] | Stream this buffer into the provided content handler. If contentHandler
object implements LexicalHandler, it will get lexical events as well. | [
"Stream",
"this",
"buffer",
"into",
"the",
"provided",
"content",
"handler",
".",
"If",
"contentHandler",
"object",
"implements",
"LexicalHandler",
"it",
"will",
"get",
"lexical",
"events",
"as",
"well",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-core/src/main/java/com/nominanuda/zen/xml/SaxBuffer.java#L188-L192 | train |
nominanuda/zen-project | zen-core/src/main/java/com/nominanuda/zen/xml/SaxBuffer.java | SaxBuffer.dump | public void dump(Writer writer) throws IOException {
Iterator<SaxBit> i = this.saxbits.iterator();
while (i.hasNext()) {
final SaxBit saxbit = i.next();
saxbit.dump(writer);
}
writer.flush();
} | java | public void dump(Writer writer) throws IOException {
Iterator<SaxBit> i = this.saxbits.iterator();
while (i.hasNext()) {
final SaxBit saxbit = i.next();
saxbit.dump(writer);
}
writer.flush();
} | [
"public",
"void",
"dump",
"(",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"Iterator",
"<",
"SaxBit",
">",
"i",
"=",
"this",
".",
"saxbits",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
... | Dump buffer contents into the provided writer.
@param writer
@throws IOException | [
"Dump",
"buffer",
"contents",
"into",
"the",
"provided",
"writer",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-core/src/main/java/com/nominanuda/zen/xml/SaxBuffer.java#L199-L206 | train |
nominanuda/zen-project | zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java | BaseTree.addChild | @Override
public void addChild(Tree t) {
//System.out.println("add child "+t.toStringTree()+" "+this.toStringTree());
//System.out.println("existing children: "+children);
if ( t==null ) {
return; // do nothing upon addChild(null)
}
BaseTree childTree = (BaseTree)t;
if ( childTree.isNil() ) { // t is an empty node possibly with children
if ( this.children!=null && this.children == childTree.children ) {
throw new RuntimeException("attempt to add child list to itself");
}
// just add all of childTree's children to this
if ( childTree.children!=null ) {
if ( this.children!=null ) { // must copy, this has children already
int n = childTree.children.size();
for (int i = 0; i < n; i++) {
Tree c = (Tree)childTree.children.get(i);
this.children.add(c);
// handle double-link stuff for each child of nil root
c.setParent(this);
c.setChildIndex(children.size()-1);
}
}
else {
// no children for this but t has children; just set pointer
// call general freshener routine
this.children = childTree.children;
this.freshenParentAndChildIndexes();
}
}
}
else { // child is not nil (don't care about children)
if ( children==null ) {
children = createChildrenList(); // create children list on demand
}
children.add(t);
childTree.setParent(this);
childTree.setChildIndex(children.size()-1);
}
// System.out.println("now children are: "+children);
} | java | @Override
public void addChild(Tree t) {
//System.out.println("add child "+t.toStringTree()+" "+this.toStringTree());
//System.out.println("existing children: "+children);
if ( t==null ) {
return; // do nothing upon addChild(null)
}
BaseTree childTree = (BaseTree)t;
if ( childTree.isNil() ) { // t is an empty node possibly with children
if ( this.children!=null && this.children == childTree.children ) {
throw new RuntimeException("attempt to add child list to itself");
}
// just add all of childTree's children to this
if ( childTree.children!=null ) {
if ( this.children!=null ) { // must copy, this has children already
int n = childTree.children.size();
for (int i = 0; i < n; i++) {
Tree c = (Tree)childTree.children.get(i);
this.children.add(c);
// handle double-link stuff for each child of nil root
c.setParent(this);
c.setChildIndex(children.size()-1);
}
}
else {
// no children for this but t has children; just set pointer
// call general freshener routine
this.children = childTree.children;
this.freshenParentAndChildIndexes();
}
}
}
else { // child is not nil (don't care about children)
if ( children==null ) {
children = createChildrenList(); // create children list on demand
}
children.add(t);
childTree.setParent(this);
childTree.setChildIndex(children.size()-1);
}
// System.out.println("now children are: "+children);
} | [
"@",
"Override",
"public",
"void",
"addChild",
"(",
"Tree",
"t",
")",
"{",
"//System.out.println(\"add child \"+t.toStringTree()+\" \"+this.toStringTree());",
"//System.out.println(\"existing children: \"+children);",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"return",
";",
"... | Add t as child of this node.
Warning: if t has no children, but child does
and child isNil then this routine moves children to t via
t.children = child.children; i.e., without copying the array. | [
"Add",
"t",
"as",
"child",
"of",
"this",
"node",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java#L91-L132 | train |
nominanuda/zen-project | zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java | BaseTree.addChildren | public void addChildren(List<? extends Tree> kids) {
for (int i = 0; i < kids.size(); i++) {
Tree t = kids.get(i);
addChild(t);
}
} | java | public void addChildren(List<? extends Tree> kids) {
for (int i = 0; i < kids.size(); i++) {
Tree t = kids.get(i);
addChild(t);
}
} | [
"public",
"void",
"addChildren",
"(",
"List",
"<",
"?",
"extends",
"Tree",
">",
"kids",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"kids",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Tree",
"t",
"=",
"kids",
".",
"get",
... | Add all elements of kids list as children of this node | [
"Add",
"all",
"elements",
"of",
"kids",
"list",
"as",
"children",
"of",
"this",
"node"
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java#L135-L140 | train |
nominanuda/zen-project | zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java | BaseTree.getAncestor | @Override
public Tree getAncestor(int ttype) {
Tree t = this;
t = t.getParent();
while ( t!=null ) {
if ( t.getType()==ttype ) return t;
t = t.getParent();
}
return null;
} | java | @Override
public Tree getAncestor(int ttype) {
Tree t = this;
t = t.getParent();
while ( t!=null ) {
if ( t.getType()==ttype ) return t;
t = t.getParent();
}
return null;
} | [
"@",
"Override",
"public",
"Tree",
"getAncestor",
"(",
"int",
"ttype",
")",
"{",
"Tree",
"t",
"=",
"this",
";",
"t",
"=",
"t",
".",
"getParent",
"(",
")",
";",
"while",
"(",
"t",
"!=",
"null",
")",
"{",
"if",
"(",
"t",
".",
"getType",
"(",
")",... | Walk upwards and get first ancestor with this token type. | [
"Walk",
"upwards",
"and",
"get",
"first",
"ancestor",
"with",
"this",
"token",
"type",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java#L336-L345 | train |
nominanuda/zen-project | zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java | BaseTree.getAncestors | @Override
public List<? extends Tree> getAncestors() {
if ( getParent()==null ) return null;
List<Tree> ancestors = new ArrayList<Tree>();
Tree t = this;
t = t.getParent();
while ( t!=null ) {
ancestors.add(0, t); // insert at start
t = t.getParent();
}
return ancestors;
} | java | @Override
public List<? extends Tree> getAncestors() {
if ( getParent()==null ) return null;
List<Tree> ancestors = new ArrayList<Tree>();
Tree t = this;
t = t.getParent();
while ( t!=null ) {
ancestors.add(0, t); // insert at start
t = t.getParent();
}
return ancestors;
} | [
"@",
"Override",
"public",
"List",
"<",
"?",
"extends",
"Tree",
">",
"getAncestors",
"(",
")",
"{",
"if",
"(",
"getParent",
"(",
")",
"==",
"null",
")",
"return",
"null",
";",
"List",
"<",
"Tree",
">",
"ancestors",
"=",
"new",
"ArrayList",
"<",
"Tree... | Return a list of all ancestors of this node. The first node of
list is the root and the last is the parent of this node. | [
"Return",
"a",
"list",
"of",
"all",
"ancestors",
"of",
"this",
"node",
".",
"The",
"first",
"node",
"of",
"list",
"is",
"the",
"root",
"and",
"the",
"last",
"is",
"the",
"parent",
"of",
"this",
"node",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java#L350-L361 | train |
nominanuda/zen-project | zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java | BaseTree.toStringTree | @Override
public String toStringTree() {
if ( children==null || children.isEmpty() ) {
return this.toString();
}
StringBuilder buf = new StringBuilder();
if ( !isNil() ) {
buf.append("(");
buf.append(this.toString());
buf.append(' ');
}
for (int i = 0; children!=null && i < children.size(); i++) {
Tree t = (Tree)children.get(i);
if ( i>0 ) {
buf.append(' ');
}
buf.append(t.toStringTree());
}
if ( !isNil() ) {
buf.append(")");
}
return buf.toString();
} | java | @Override
public String toStringTree() {
if ( children==null || children.isEmpty() ) {
return this.toString();
}
StringBuilder buf = new StringBuilder();
if ( !isNil() ) {
buf.append("(");
buf.append(this.toString());
buf.append(' ');
}
for (int i = 0; children!=null && i < children.size(); i++) {
Tree t = (Tree)children.get(i);
if ( i>0 ) {
buf.append(' ');
}
buf.append(t.toStringTree());
}
if ( !isNil() ) {
buf.append(")");
}
return buf.toString();
} | [
"@",
"Override",
"public",
"String",
"toStringTree",
"(",
")",
"{",
"if",
"(",
"children",
"==",
"null",
"||",
"children",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"this",
".",
"toString",
"(",
")",
";",
"}",
"StringBuilder",
"buf",
"=",
"new",
... | Print out a whole tree not just a node | [
"Print",
"out",
"a",
"whole",
"tree",
"not",
"just",
"a",
"node"
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java#L364-L386 | train |
nominanuda/zen-project | zen-core/src/main/java/com/nominanuda/zen/worker/AbsWorker.java | AbsWorker.work | public Obj work(Obj cmd) throws Exception {
stopping = false;
return status().with(P_STATUS, STATUS_STARTED);
} | java | public Obj work(Obj cmd) throws Exception {
stopping = false;
return status().with(P_STATUS, STATUS_STARTED);
} | [
"public",
"Obj",
"work",
"(",
"Obj",
"cmd",
")",
"throws",
"Exception",
"{",
"stopping",
"=",
"false",
";",
"return",
"status",
"(",
")",
".",
"with",
"(",
"P_STATUS",
",",
"STATUS_STARTED",
")",
";",
"}"
] | null not run , false err , true ok | [
"null",
"not",
"run",
"false",
"err",
"true",
"ok"
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-core/src/main/java/com/nominanuda/zen/worker/AbsWorker.java#L33-L36 | train |
nominanuda/zen-project | zen-jsweb/src/main/java/com/nominanuda/springsoy/SoySource.java | SoySource.render | public String render(SoyMapData model, String view) throws IOException {
return getSoyTofu(null).newRenderer(view).setData(model).render();
} | java | public String render(SoyMapData model, String view) throws IOException {
return getSoyTofu(null).newRenderer(view).setData(model).render();
} | [
"public",
"String",
"render",
"(",
"SoyMapData",
"model",
",",
"String",
"view",
")",
"throws",
"IOException",
"{",
"return",
"getSoyTofu",
"(",
"null",
")",
".",
"newRenderer",
"(",
"view",
")",
".",
"setData",
"(",
"model",
")",
".",
"render",
"(",
")"... | simple helper method to quickly render a template
@param model
@param view
@return
@throws IOException | [
"simple",
"helper",
"method",
"to",
"quickly",
"render",
"a",
"template"
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-jsweb/src/main/java/com/nominanuda/springsoy/SoySource.java#L106-L108 | train |
nominanuda/zen-project | zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java | DataStructHelper.buildObject | public Obj buildObject(Object... members) {
Obj o = newObject();
for (int i = 0; i < members.length; i+=2) {
o.put((String)members[i], members[i+1]);
}
return o;
} | java | public Obj buildObject(Object... members) {
Obj o = newObject();
for (int i = 0; i < members.length; i+=2) {
o.put((String)members[i], members[i+1]);
}
return o;
} | [
"public",
"Obj",
"buildObject",
"(",
"Object",
"...",
"members",
")",
"{",
"Obj",
"o",
"=",
"newObject",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"members",
".",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"o",
".",
"put",
... | members in the form key, val, key, val etc. | [
"members",
"in",
"the",
"form",
"key",
"val",
"key",
"val",
"etc",
"."
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java#L669-L675 | train |
nominanuda/zen-project | zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java | DataStructHelper.sort | @SuppressWarnings("unchecked")
public <T> void sort(Arr arr, Comparator<T> c) {
int l = arr.getLength();
Object[] objs = new Object[l];
for (int i=0; i<l; i++) {
objs[i] = arr.get(i);
}
Arrays.sort((T[])objs, c);
for (int i=0; i<l; i++) {
arr.put(i, objs[i]);
}
} | java | @SuppressWarnings("unchecked")
public <T> void sort(Arr arr, Comparator<T> c) {
int l = arr.getLength();
Object[] objs = new Object[l];
for (int i=0; i<l; i++) {
objs[i] = arr.get(i);
}
Arrays.sort((T[])objs, c);
for (int i=0; i<l; i++) {
arr.put(i, objs[i]);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"void",
"sort",
"(",
"Arr",
"arr",
",",
"Comparator",
"<",
"T",
">",
"c",
")",
"{",
"int",
"l",
"=",
"arr",
".",
"getLength",
"(",
")",
";",
"Object",
"[",
"]",
"objs",
... | can lead to classcastexception if comparator is not of the right type | [
"can",
"lead",
"to",
"classcastexception",
"if",
"comparator",
"is",
"not",
"of",
"the",
"right",
"type"
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-dataobject/src/main/java/com/nominanuda/dataobject/DataStructHelper.java#L859-L870 | train |
nominanuda/zen-project | zen-dataobject/src/main/java/com/nominanuda/dataobject/transform/JsonPipeline.java | JsonPipeline.build | public JsonTransformer build() {
try {
return new WrappingTransformer(buildPipe());
} catch(Exception e) {
throw new RuntimeException("Failed to build pipeline: " + e.getMessage(), e);
}
} | java | public JsonTransformer build() {
try {
return new WrappingTransformer(buildPipe());
} catch(Exception e) {
throw new RuntimeException("Failed to build pipeline: " + e.getMessage(), e);
}
} | [
"public",
"JsonTransformer",
"build",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"WrappingTransformer",
"(",
"buildPipe",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Failed to build pipeline: ... | Build a raw pipeline without a terminating transformer. It is the caller's responsibility to set the final transformer (@see JsonTransformer.setTarget()) and to apply the pipeline to a stream.
@return | [
"Build",
"a",
"raw",
"pipeline",
"without",
"a",
"terminating",
"transformer",
".",
"It",
"is",
"the",
"caller",
"s",
"responsibility",
"to",
"set",
"the",
"final",
"transformer",
"("
] | fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-dataobject/src/main/java/com/nominanuda/dataobject/transform/JsonPipeline.java#L80-L86 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java | AbstractSearch.getSearchDimensions | public List<String> getSearchDimensions() {
List<String> dimensions = new ArrayList<String>();
for (int i = 0; i < m_Space.dimensions(); ++i) {
dimensions.add(m_Space.getDimension(i).getLabel());
}
return dimensions;
} | java | public List<String> getSearchDimensions() {
List<String> dimensions = new ArrayList<String>();
for (int i = 0; i < m_Space.dimensions(); ++i) {
dimensions.add(m_Space.getDimension(i).getLabel());
}
return dimensions;
} | [
"public",
"List",
"<",
"String",
">",
"getSearchDimensions",
"(",
")",
"{",
"List",
"<",
"String",
">",
"dimensions",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_Space",
".",
"dime... | Returns the search dimensions
@return a List with string values of the search dimensions | [
"Returns",
"the",
"search",
"dimensions"
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L118-L124 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java | AbstractSearch.logPerformances | protected String logPerformances(Space space, Vector<Performance> performances, Tag type) {
return m_Owner.logPerformances(space, performances, type);
} | java | protected String logPerformances(Space space, Vector<Performance> performances, Tag type) {
return m_Owner.logPerformances(space, performances, type);
} | [
"protected",
"String",
"logPerformances",
"(",
"Space",
"space",
",",
"Vector",
"<",
"Performance",
">",
"performances",
",",
"Tag",
"type",
")",
"{",
"return",
"m_Owner",
".",
"logPerformances",
"(",
"space",
",",
"performances",
",",
"type",
")",
";",
"}"
... | generates a table string for all the performances in the space and returns
that.
@param space the current space to align the performances to
@param performances the performances to align
@param type the type of performance
@return the table string | [
"generates",
"a",
"table",
"string",
"for",
"all",
"the",
"performances",
"in",
"the",
"space",
"and",
"returns",
"that",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L262-L264 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java | AbstractSearch.logPerformances | protected void logPerformances(Space space, Vector<Performance> performances) {
m_Owner.logPerformances(space, performances);
} | java | protected void logPerformances(Space space, Vector<Performance> performances) {
m_Owner.logPerformances(space, performances);
} | [
"protected",
"void",
"logPerformances",
"(",
"Space",
"space",
",",
"Vector",
"<",
"Performance",
">",
"performances",
")",
"{",
"m_Owner",
".",
"logPerformances",
"(",
"space",
",",
"performances",
")",
";",
"}"
] | aligns all performances in the space and prints those tables to the log
file.
@param space the current space to align the performances to
@param performances the performances to align | [
"aligns",
"all",
"performances",
"in",
"the",
"space",
"and",
"prints",
"those",
"tables",
"to",
"the",
"log",
"file",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L273-L275 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java | AbstractSearch.addPerformance | public void addPerformance(Performance performance, int folds) {
m_Performances.add(performance);
m_Cache.add(folds, performance);
m_Trace.add(new AbstractMap.SimpleEntry<Integer, Performance>(folds, performance));
} | java | public void addPerformance(Performance performance, int folds) {
m_Performances.add(performance);
m_Cache.add(folds, performance);
m_Trace.add(new AbstractMap.SimpleEntry<Integer, Performance>(folds, performance));
} | [
"public",
"void",
"addPerformance",
"(",
"Performance",
"performance",
",",
"int",
"folds",
")",
"{",
"m_Performances",
".",
"add",
"(",
"performance",
")",
";",
"m_Cache",
".",
"add",
"(",
"folds",
",",
"performance",
")",
";",
"m_Trace",
".",
"add",
"(",... | Adds the performance to the cache and the current list of performances.
@param performance the performance to add
@param folds the number of folds | [
"Adds",
"the",
"performance",
"to",
"the",
"cache",
"and",
"the",
"current",
"list",
"of",
"performances",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L283-L288 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java | AbstractSearch.getTraceParameterSettings | public List<Entry<String, Object>> getTraceParameterSettings(int index) {
List<Entry<String, Object>> result = new ArrayList<Map.Entry<String,Object>>();
List<String> dimensions = getSearchDimensions();
for (int i = 0; i < dimensions.size(); ++i) {
String parameter = dimensions.get(i);
Object value = m_Trace.get(index).getValue().getValues().getValue(i);
Map.Entry<String, Object> current = new AbstractMap.SimpleEntry<String,Object>(parameter,value);
result.add(i, current);
}
return result;
} | java | public List<Entry<String, Object>> getTraceParameterSettings(int index) {
List<Entry<String, Object>> result = new ArrayList<Map.Entry<String,Object>>();
List<String> dimensions = getSearchDimensions();
for (int i = 0; i < dimensions.size(); ++i) {
String parameter = dimensions.get(i);
Object value = m_Trace.get(index).getValue().getValues().getValue(i);
Map.Entry<String, Object> current = new AbstractMap.SimpleEntry<String,Object>(parameter,value);
result.add(i, current);
}
return result;
} | [
"public",
"List",
"<",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"getTraceParameterSettings",
"(",
"int",
"index",
")",
"{",
"List",
"<",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Map",
".",
"Entry... | Returns the parameter settings in structured way
@param index the index of the trace item to obtain
@return the parameter settings | [
"Returns",
"the",
"parameter",
"settings",
"in",
"structured",
"way"
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L340-L351 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java | AbstractSearch.search | public SearchResult search(Instances data) throws Exception {
SearchResult result;
SearchResult best;
try {
log("\n"
+ getClass().getName() + "\n"
+ getClass().getName().replaceAll(".", "=") + "\n"
+ "Options: " + Utils.joinOptions(getOptions()) + "\n");
log("\n---> check");
check(data);
log("\n---> preSearch");
preSearch(data);
log("\n---> doSearch");
best = doSearch(data);
log("\n---> postSearch");
result = postSearch(data, best);
}
catch (Exception e) {
throw e;
}
finally {
cleanUpSearch();
}
return result;
} | java | public SearchResult search(Instances data) throws Exception {
SearchResult result;
SearchResult best;
try {
log("\n"
+ getClass().getName() + "\n"
+ getClass().getName().replaceAll(".", "=") + "\n"
+ "Options: " + Utils.joinOptions(getOptions()) + "\n");
log("\n---> check");
check(data);
log("\n---> preSearch");
preSearch(data);
log("\n---> doSearch");
best = doSearch(data);
log("\n---> postSearch");
result = postSearch(data, best);
}
catch (Exception e) {
throw e;
}
finally {
cleanUpSearch();
}
return result;
} | [
"public",
"SearchResult",
"search",
"(",
"Instances",
"data",
")",
"throws",
"Exception",
"{",
"SearchResult",
"result",
";",
"SearchResult",
"best",
";",
"try",
"{",
"log",
"(",
"\"\\n\"",
"+",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"\\n\"... | Performs the search and returns the best setup.
@param data the dataset to use
@return the best classifier setup
@throws Exception if search fails | [
"Performs",
"the",
"search",
"and",
"returns",
"the",
"best",
"setup",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L432-L462 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractEvaluationTask.java | AbstractEvaluationTask.cleanUp | public void cleanUp() {
m_Owner = null;
m_Train = null;
m_Test = null;
m_Generator = null;
m_Values = null;
} | java | public void cleanUp() {
m_Owner = null;
m_Train = null;
m_Test = null;
m_Generator = null;
m_Values = null;
} | [
"public",
"void",
"cleanUp",
"(",
")",
"{",
"m_Owner",
"=",
"null",
";",
"m_Train",
"=",
"null",
";",
"m_Test",
"=",
"null",
";",
"m_Generator",
"=",
"null",
";",
"m_Values",
"=",
"null",
";",
"}"
] | Cleans up after the task finishes. | [
"Cleans",
"up",
"after",
"the",
"task",
"finishes",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractEvaluationTask.java#L128-L134 | train |
fracpete/multisearch-weka-package | src/main/java/weka/core/setupgenerator/Point.java | Point.compareTo | public int compareTo(Point<E> obj) {
if (obj == null)
return -1;
if (dimensions() != obj.dimensions())
return -1;
for (int i = 0; i < dimensions(); i++) {
if (getValue(i).getClass() != obj.getValue(i).getClass())
return -1;
if (getValue(i) instanceof Double) {
if (Utils.sm((Double) getValue(i), (Double) obj.getValue(i))) {
return -1;
} else if (Utils.gr((Double) getValue(i), (Double) obj.getValue(i))) {
return 1;
}
} else {
int r = getValue(i).toString().compareTo(obj.getValue(i).toString());
if (r != 0) {
return r;
}
}
}
return 0;
} | java | public int compareTo(Point<E> obj) {
if (obj == null)
return -1;
if (dimensions() != obj.dimensions())
return -1;
for (int i = 0; i < dimensions(); i++) {
if (getValue(i).getClass() != obj.getValue(i).getClass())
return -1;
if (getValue(i) instanceof Double) {
if (Utils.sm((Double) getValue(i), (Double) obj.getValue(i))) {
return -1;
} else if (Utils.gr((Double) getValue(i), (Double) obj.getValue(i))) {
return 1;
}
} else {
int r = getValue(i).toString().compareTo(obj.getValue(i).toString());
if (r != 0) {
return r;
}
}
}
return 0;
} | [
"public",
"int",
"compareTo",
"(",
"Point",
"<",
"E",
">",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"return",
"-",
"1",
";",
"if",
"(",
"dimensions",
"(",
")",
"!=",
"obj",
".",
"dimensions",
"(",
")",
")",
"return",
"-",
"1",
";",... | Compares the given point with this point.
@param obj an object to be compared with this point
@return -1, 0, +1, in a manner consistent with equals | [
"Compares",
"the",
"given",
"point",
"with",
"this",
"point",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/core/setupgenerator/Point.java#L124-L150 | train |
fracpete/multisearch-weka-package | src/main/java/weka/core/setupgenerator/Space.java | Space.subspace | public Space subspace(Point<Integer> center) {
Space result;
SpaceDimension[] dimensions;
int i;
dimensions = new SpaceDimension[dimensions()];
for (i = 0; i < dimensions.length; i++)
dimensions[i] = getDimension(i).subdimension(
center.getValue(i) - 1, center.getValue(i) + 1);
result = new Space(dimensions);
return result;
} | java | public Space subspace(Point<Integer> center) {
Space result;
SpaceDimension[] dimensions;
int i;
dimensions = new SpaceDimension[dimensions()];
for (i = 0; i < dimensions.length; i++)
dimensions[i] = getDimension(i).subdimension(
center.getValue(i) - 1, center.getValue(i) + 1);
result = new Space(dimensions);
return result;
} | [
"public",
"Space",
"subspace",
"(",
"Point",
"<",
"Integer",
">",
"center",
")",
"{",
"Space",
"result",
";",
"SpaceDimension",
"[",
"]",
"dimensions",
";",
"int",
"i",
";",
"dimensions",
"=",
"new",
"SpaceDimension",
"[",
"dimensions",
"(",
")",
"]",
";... | Returns a subspace around the given point, with just one more
neighbor left and right on each dimension.
@param center the center of the new "universe" ;-)
@return the new space | [
"Returns",
"a",
"subspace",
"around",
"the",
"given",
"point",
"with",
"just",
"one",
"more",
"neighbor",
"left",
"and",
"right",
"on",
"each",
"dimension",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/core/setupgenerator/Space.java#L162-L175 | train |
fracpete/multisearch-weka-package | src/main/java/weka/core/setupgenerator/Space.java | Space.inc | protected boolean inc(Integer[] locations, int[] max) {
boolean result;
int i;
result = true;
i = 0;
while (i < locations.length) {
if (locations[i] < max[i] - 1) {
locations[i]++;
break;
}
else {
locations[i] = 0;
i++;
// adding was not possible!
if (i == locations.length)
result = false;
}
}
return result;
} | java | protected boolean inc(Integer[] locations, int[] max) {
boolean result;
int i;
result = true;
i = 0;
while (i < locations.length) {
if (locations[i] < max[i] - 1) {
locations[i]++;
break;
}
else {
locations[i] = 0;
i++;
// adding was not possible!
if (i == locations.length)
result = false;
}
}
return result;
} | [
"protected",
"boolean",
"inc",
"(",
"Integer",
"[",
"]",
"locations",
",",
"int",
"[",
"]",
"max",
")",
"{",
"boolean",
"result",
";",
"int",
"i",
";",
"result",
"=",
"true",
";",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"locations",
".",
"len... | Increments the location array by 1.
@param locations the position in the space
@param max the maxima
@return true if locations could be incremented | [
"Increments",
"the",
"location",
"array",
"by",
"1",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/core/setupgenerator/Space.java#L184-L206 | train |
fracpete/multisearch-weka-package | src/main/java/weka/core/setupgenerator/Space.java | Space.listPoints | protected Vector<Point<Integer>> listPoints() {
Vector<Point<Integer>> result;
int i;
int[] max;
Integer[] locations;
boolean ok;
result = new Vector<Point<Integer>>();
// determine maximum locations per dimension
max = new int[dimensions()];
for (i = 0; i < max.length; i++)
max[i] = getDimension(i).width();
// create first point
locations = new Integer[dimensions()];
for (i = 0; i < locations.length; i++)
locations[i] = 0;
result.add(new Point<Integer>(locations));
ok = true;
while (ok) {
ok = inc(locations, max);
if (ok)
result.add(new Point<Integer>(locations));
}
return result;
} | java | protected Vector<Point<Integer>> listPoints() {
Vector<Point<Integer>> result;
int i;
int[] max;
Integer[] locations;
boolean ok;
result = new Vector<Point<Integer>>();
// determine maximum locations per dimension
max = new int[dimensions()];
for (i = 0; i < max.length; i++)
max[i] = getDimension(i).width();
// create first point
locations = new Integer[dimensions()];
for (i = 0; i < locations.length; i++)
locations[i] = 0;
result.add(new Point<Integer>(locations));
ok = true;
while (ok) {
ok = inc(locations, max);
if (ok)
result.add(new Point<Integer>(locations));
}
return result;
} | [
"protected",
"Vector",
"<",
"Point",
"<",
"Integer",
">",
">",
"listPoints",
"(",
")",
"{",
"Vector",
"<",
"Point",
"<",
"Integer",
">>",
"result",
";",
"int",
"i",
";",
"int",
"[",
"]",
"max",
";",
"Integer",
"[",
"]",
"locations",
";",
"boolean",
... | returns a Vector with all points in the space.
@return a Vector with all points | [
"returns",
"a",
"Vector",
"with",
"all",
"points",
"in",
"the",
"space",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/core/setupgenerator/Space.java#L213-L241 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java | PerformanceCache.getID | protected String getID(int cv, Point<Object> values) {
String result;
int i;
result = "" + cv;
for (i = 0; i < values.dimensions(); i++)
result += "\t" + values.getValue(i);
return result;
} | java | protected String getID(int cv, Point<Object> values) {
String result;
int i;
result = "" + cv;
for (i = 0; i < values.dimensions(); i++)
result += "\t" + values.getValue(i);
return result;
} | [
"protected",
"String",
"getID",
"(",
"int",
"cv",
",",
"Point",
"<",
"Object",
">",
"values",
")",
"{",
"String",
"result",
";",
"int",
"i",
";",
"result",
"=",
"\"\"",
"+",
"cv",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"d... | returns the ID string for a cache item.
@param cv the number of folds in the cross-validation
@param values the point in the space
@return the ID string | [
"returns",
"the",
"ID",
"string",
"for",
"a",
"cache",
"item",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java#L50-L60 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java | PerformanceCache.get | public Performance get(int cv, Point<Object> values) {
return m_Cache.get(getID(cv, values));
} | java | public Performance get(int cv, Point<Object> values) {
return m_Cache.get(getID(cv, values));
} | [
"public",
"Performance",
"get",
"(",
"int",
"cv",
",",
"Point",
"<",
"Object",
">",
"values",
")",
"{",
"return",
"m_Cache",
".",
"get",
"(",
"getID",
"(",
"cv",
",",
"values",
")",
")",
";",
"}"
] | returns a cached performance object, null if not yet in the cache.
@param cv the number of folds in the cross-validation
@param values the point in the space
@return the cached performance item, null if not in cache | [
"returns",
"a",
"cached",
"performance",
"object",
"null",
"if",
"not",
"yet",
"in",
"the",
"cache",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java#L80-L82 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java | PerformanceCache.add | public void add(int cv, Performance p) {
m_Cache.put(getID(cv, p.getValues()), p);
} | java | public void add(int cv, Performance p) {
m_Cache.put(getID(cv, p.getValues()), p);
} | [
"public",
"void",
"add",
"(",
"int",
"cv",
",",
"Performance",
"p",
")",
"{",
"m_Cache",
".",
"put",
"(",
"getID",
"(",
"cv",
",",
"p",
".",
"getValues",
"(",
")",
")",
",",
"p",
")",
";",
"}"
] | adds the performance to the cache.
@param cv the number of folds in the cross-validation
@param p the performance object to store | [
"adds",
"the",
"performance",
"to",
"the",
"cache",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java#L90-L92 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/DefaultEvaluationFactory.java | DefaultEvaluationFactory.newTask | @Override
public DefaultEvaluationTask newTask(MultiSearchCapable owner, Instances train, Instances test, SetupGenerator generator, Point<Object> values, int folds, int eval, int classLabel) {
return new DefaultEvaluationTask(owner, train, test, generator, values, folds, eval, classLabel);
} | java | @Override
public DefaultEvaluationTask newTask(MultiSearchCapable owner, Instances train, Instances test, SetupGenerator generator, Point<Object> values, int folds, int eval, int classLabel) {
return new DefaultEvaluationTask(owner, train, test, generator, values, folds, eval, classLabel);
} | [
"@",
"Override",
"public",
"DefaultEvaluationTask",
"newTask",
"(",
"MultiSearchCapable",
"owner",
",",
"Instances",
"train",
",",
"Instances",
"test",
",",
"SetupGenerator",
"generator",
",",
"Point",
"<",
"Object",
">",
"values",
",",
"int",
"folds",
",",
"int... | Returns a new task.
@param owner the owning search
@param train the training data
@param test the test data
@param generator the generator
@param values the values
@param folds the number of folds
@param eval the evaluation
@param classLabel the class label index (0-based; if applicable)
@return the task | [
"Returns",
"a",
"new",
"task",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/DefaultEvaluationFactory.java#L73-L76 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractEvaluationMetrics.java | AbstractEvaluationMetrics.check | public boolean check(int id) {
for (Tag tag: getTags()) {
if (tag.getID() == id)
return true;
}
return false;
} | java | public boolean check(int id) {
for (Tag tag: getTags()) {
if (tag.getID() == id)
return true;
}
return false;
} | [
"public",
"boolean",
"check",
"(",
"int",
"id",
")",
"{",
"for",
"(",
"Tag",
"tag",
":",
"getTags",
"(",
")",
")",
"{",
"if",
"(",
"tag",
".",
"getID",
"(",
")",
"==",
"id",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Returns whether the ID is valid.
@param id the ID to check
@return true if valid | [
"Returns",
"whether",
"the",
"ID",
"is",
"valid",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractEvaluationMetrics.java#L76-L82 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/DefaultEvaluationWrapper.java | DefaultEvaluationWrapper.getMetric | public double getMetric(int id, int classLabel) {
try {
switch (id) {
case DefaultEvaluationMetrics.EVALUATION_CC:
return m_Evaluation.correlationCoefficient();
case DefaultEvaluationMetrics.EVALUATION_MATTHEWS_CC:
return m_Evaluation.matthewsCorrelationCoefficient(0);
case DefaultEvaluationMetrics.EVALUATION_RMSE:
return m_Evaluation.rootMeanSquaredError();
case DefaultEvaluationMetrics.EVALUATION_RRSE:
return m_Evaluation.rootRelativeSquaredError();
case DefaultEvaluationMetrics.EVALUATION_MAE:
return m_Evaluation.meanAbsoluteError();
case DefaultEvaluationMetrics.EVALUATION_RAE:
return m_Evaluation.relativeAbsoluteError();
case DefaultEvaluationMetrics.EVALUATION_COMBINED:
return (1 - StrictMath.abs(m_Evaluation.correlationCoefficient()) + m_Evaluation.rootRelativeSquaredError() + m_Evaluation.relativeAbsoluteError());
case DefaultEvaluationMetrics.EVALUATION_ACC:
return m_Evaluation.pctCorrect();
case DefaultEvaluationMetrics.EVALUATION_KAPPA:
return m_Evaluation.kappa();
case DefaultEvaluationMetrics.EVALUATION_PRECISION:
return m_Evaluation.precision(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_PRECISION:
return m_Evaluation.weightedPrecision();
case DefaultEvaluationMetrics.EVALUATION_RECALL:
return m_Evaluation.recall(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_RECALL:
return m_Evaluation.weightedRecall();
case DefaultEvaluationMetrics.EVALUATION_AUC:
return m_Evaluation.areaUnderROC(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_AUC:
return m_Evaluation.weightedAreaUnderROC();
case DefaultEvaluationMetrics.EVALUATION_PRC:
return m_Evaluation.areaUnderPRC(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_PRC:
return m_Evaluation.weightedAreaUnderPRC();
case DefaultEvaluationMetrics.EVALUATION_FMEASURE:
return m_Evaluation.fMeasure(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_FMEASURE:
return m_Evaluation.weightedFMeasure();
case DefaultEvaluationMetrics.EVALUATION_TRUE_POSITIVE_RATE:
return m_Evaluation.truePositiveRate(classLabel);
case DefaultEvaluationMetrics.EVALUATION_TRUE_NEGATIVE_RATE:
return m_Evaluation.trueNegativeRate(classLabel);
case DefaultEvaluationMetrics.EVALUATION_FALSE_POSITIVE_RATE:
return m_Evaluation.falsePositiveRate(classLabel);
case DefaultEvaluationMetrics.EVALUATION_FALSE_NEGATIVE_RATE:
return m_Evaluation.falseNegativeRate(classLabel);
default:
return Double.NaN;
}
}
catch (Exception e) {
return Double.NaN;
}
} | java | public double getMetric(int id, int classLabel) {
try {
switch (id) {
case DefaultEvaluationMetrics.EVALUATION_CC:
return m_Evaluation.correlationCoefficient();
case DefaultEvaluationMetrics.EVALUATION_MATTHEWS_CC:
return m_Evaluation.matthewsCorrelationCoefficient(0);
case DefaultEvaluationMetrics.EVALUATION_RMSE:
return m_Evaluation.rootMeanSquaredError();
case DefaultEvaluationMetrics.EVALUATION_RRSE:
return m_Evaluation.rootRelativeSquaredError();
case DefaultEvaluationMetrics.EVALUATION_MAE:
return m_Evaluation.meanAbsoluteError();
case DefaultEvaluationMetrics.EVALUATION_RAE:
return m_Evaluation.relativeAbsoluteError();
case DefaultEvaluationMetrics.EVALUATION_COMBINED:
return (1 - StrictMath.abs(m_Evaluation.correlationCoefficient()) + m_Evaluation.rootRelativeSquaredError() + m_Evaluation.relativeAbsoluteError());
case DefaultEvaluationMetrics.EVALUATION_ACC:
return m_Evaluation.pctCorrect();
case DefaultEvaluationMetrics.EVALUATION_KAPPA:
return m_Evaluation.kappa();
case DefaultEvaluationMetrics.EVALUATION_PRECISION:
return m_Evaluation.precision(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_PRECISION:
return m_Evaluation.weightedPrecision();
case DefaultEvaluationMetrics.EVALUATION_RECALL:
return m_Evaluation.recall(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_RECALL:
return m_Evaluation.weightedRecall();
case DefaultEvaluationMetrics.EVALUATION_AUC:
return m_Evaluation.areaUnderROC(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_AUC:
return m_Evaluation.weightedAreaUnderROC();
case DefaultEvaluationMetrics.EVALUATION_PRC:
return m_Evaluation.areaUnderPRC(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_PRC:
return m_Evaluation.weightedAreaUnderPRC();
case DefaultEvaluationMetrics.EVALUATION_FMEASURE:
return m_Evaluation.fMeasure(classLabel);
case DefaultEvaluationMetrics.EVALUATION_WEIGHTED_FMEASURE:
return m_Evaluation.weightedFMeasure();
case DefaultEvaluationMetrics.EVALUATION_TRUE_POSITIVE_RATE:
return m_Evaluation.truePositiveRate(classLabel);
case DefaultEvaluationMetrics.EVALUATION_TRUE_NEGATIVE_RATE:
return m_Evaluation.trueNegativeRate(classLabel);
case DefaultEvaluationMetrics.EVALUATION_FALSE_POSITIVE_RATE:
return m_Evaluation.falsePositiveRate(classLabel);
case DefaultEvaluationMetrics.EVALUATION_FALSE_NEGATIVE_RATE:
return m_Evaluation.falseNegativeRate(classLabel);
default:
return Double.NaN;
}
}
catch (Exception e) {
return Double.NaN;
}
} | [
"public",
"double",
"getMetric",
"(",
"int",
"id",
",",
"int",
"classLabel",
")",
"{",
"try",
"{",
"switch",
"(",
"id",
")",
"{",
"case",
"DefaultEvaluationMetrics",
".",
"EVALUATION_CC",
":",
"return",
"m_Evaluation",
".",
"correlationCoefficient",
"(",
")",
... | Returns the metric for the given ID.
@param id the id to get the metric for
@param classLabel the class label index for which to return metric (if applicable)
@return the metric | [
"Returns",
"the",
"metric",
"for",
"the",
"given",
"ID",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/DefaultEvaluationWrapper.java#L67-L123 | train |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/DefaultEvaluationMetrics.java | DefaultEvaluationMetrics.invert | public boolean invert(int id) {
switch (id) {
case EVALUATION_CC:
case EVALUATION_ACC:
case EVALUATION_KAPPA:
case EVALUATION_MATTHEWS_CC:
case EVALUATION_PRECISION:
case EVALUATION_WEIGHTED_PRECISION:
case EVALUATION_RECALL:
case EVALUATION_WEIGHTED_RECALL:
case EVALUATION_AUC:
case EVALUATION_WEIGHTED_AUC:
case EVALUATION_PRC:
case EVALUATION_WEIGHTED_PRC:
case EVALUATION_FMEASURE:
case EVALUATION_WEIGHTED_FMEASURE:
case EVALUATION_TRUE_POSITIVE_RATE:
case EVALUATION_TRUE_NEGATIVE_RATE:
return true;
default:
return false;
}
} | java | public boolean invert(int id) {
switch (id) {
case EVALUATION_CC:
case EVALUATION_ACC:
case EVALUATION_KAPPA:
case EVALUATION_MATTHEWS_CC:
case EVALUATION_PRECISION:
case EVALUATION_WEIGHTED_PRECISION:
case EVALUATION_RECALL:
case EVALUATION_WEIGHTED_RECALL:
case EVALUATION_AUC:
case EVALUATION_WEIGHTED_AUC:
case EVALUATION_PRC:
case EVALUATION_WEIGHTED_PRC:
case EVALUATION_FMEASURE:
case EVALUATION_WEIGHTED_FMEASURE:
case EVALUATION_TRUE_POSITIVE_RATE:
case EVALUATION_TRUE_NEGATIVE_RATE:
return true;
default:
return false;
}
} | [
"public",
"boolean",
"invert",
"(",
"int",
"id",
")",
"{",
"switch",
"(",
"id",
")",
"{",
"case",
"EVALUATION_CC",
":",
"case",
"EVALUATION_ACC",
":",
"case",
"EVALUATION_KAPPA",
":",
"case",
"EVALUATION_MATTHEWS_CC",
":",
"case",
"EVALUATION_PRECISION",
":",
... | Returns whether to negate the metric for sorting purposes.
@param id the metric id
@return true if to invert | [
"Returns",
"whether",
"to",
"negate",
"the",
"metric",
"for",
"sorting",
"purposes",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/DefaultEvaluationMetrics.java#L158-L180 | train |
fracpete/multisearch-weka-package | src/main/java/weka/core/setupgenerator/ListParameter.java | ListParameter.getItems | public String[] getItems() throws Exception {
String[] result;
if (getCustomDelimiter().isEmpty())
result = Utils.splitOptions(getList());
else
result = getList().split(getCustomDelimiter());
return result;
} | java | public String[] getItems() throws Exception {
String[] result;
if (getCustomDelimiter().isEmpty())
result = Utils.splitOptions(getList());
else
result = getList().split(getCustomDelimiter());
return result;
} | [
"public",
"String",
"[",
"]",
"getItems",
"(",
")",
"throws",
"Exception",
"{",
"String",
"[",
"]",
"result",
";",
"if",
"(",
"getCustomDelimiter",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"result",
"=",
"Utils",
".",
"splitOptions",
"(",
"getList",
"(... | Splits the list string using the appropriate delimiter.
@return the list items
@throws Exception if the splitting fails | [
"Splits",
"the",
"list",
"string",
"using",
"the",
"appropriate",
"delimiter",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/core/setupgenerator/ListParameter.java#L202-L211 | train |
fracpete/multisearch-weka-package | src/main/java/weka/core/setupgenerator/ListParameter.java | ListParameter.spaceDimension | public SpaceDimension spaceDimension() throws Exception {
String[] items;
items = getItems();
return new ListSpaceDimension(0, items.length - 1, items, getProperty());
} | java | public SpaceDimension spaceDimension() throws Exception {
String[] items;
items = getItems();
return new ListSpaceDimension(0, items.length - 1, items, getProperty());
} | [
"public",
"SpaceDimension",
"spaceDimension",
"(",
")",
"throws",
"Exception",
"{",
"String",
"[",
"]",
"items",
";",
"items",
"=",
"getItems",
"(",
")",
";",
"return",
"new",
"ListSpaceDimension",
"(",
"0",
",",
"items",
".",
"length",
"-",
"1",
",",
"i... | Returns the parameter as space dimensions.
@return the dimension
@throws Exception if instantiation of dimension fails | [
"Returns",
"the",
"parameter",
"as",
"space",
"dimensions",
"."
] | 756fcf343e7cc9fd3844c99a0e1e828368f393d0 | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/core/setupgenerator/ListParameter.java#L219-L224 | train |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/provider/ChaiConfiguration.java | ChaiConfiguration.getBooleanSetting | public boolean getBooleanSetting( final ChaiSetting setting )
{
final String settingValue = getSetting( setting );
return StringHelper.convertStrToBoolean( settingValue );
} | java | public boolean getBooleanSetting( final ChaiSetting setting )
{
final String settingValue = getSetting( setting );
return StringHelper.convertStrToBoolean( settingValue );
} | [
"public",
"boolean",
"getBooleanSetting",
"(",
"final",
"ChaiSetting",
"setting",
")",
"{",
"final",
"String",
"settingValue",
"=",
"getSetting",
"(",
"setting",
")",
";",
"return",
"StringHelper",
".",
"convertStrToBoolean",
"(",
"settingValue",
")",
";",
"}"
] | Get an individual setting value and test it as a boolean.
@param setting the setting to return
@return the value or the default value if no value exists. | [
"Get",
"an",
"individual",
"setting",
"value",
"and",
"test",
"it",
"as",
"a",
"boolean",
"."
] | a6d4b5dbfa4e270db0ce70892512cbe39e64b874 | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/provider/ChaiConfiguration.java#L173-L177 | train |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/provider/ChaiConfiguration.java | ChaiConfiguration.bindURLsAsList | public List<String> bindURLsAsList()
{
final List<String> splitUrls = Arrays.asList( getSetting( ChaiSetting.BIND_URLS ).split( LDAP_URL_SEPARATOR_REGEX_PATTERN ) );
return Collections.unmodifiableList( splitUrls );
} | java | public List<String> bindURLsAsList()
{
final List<String> splitUrls = Arrays.asList( getSetting( ChaiSetting.BIND_URLS ).split( LDAP_URL_SEPARATOR_REGEX_PATTERN ) );
return Collections.unmodifiableList( splitUrls );
} | [
"public",
"List",
"<",
"String",
">",
"bindURLsAsList",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"splitUrls",
"=",
"Arrays",
".",
"asList",
"(",
"getSetting",
"(",
"ChaiSetting",
".",
"BIND_URLS",
")",
".",
"split",
"(",
"LDAP_URL_SEPARATOR_REGEX_... | Returns an immutable list of the ldap URLs.
@return an immutable list of the ldapURLS. | [
"Returns",
"an",
"immutable",
"list",
"of",
"the",
"ldap",
"URLs",
"."
] | a6d4b5dbfa4e270db0ce70892512cbe39e64b874 | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/provider/ChaiConfiguration.java#L184-L188 | train |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/provider/FailOverWrapper.java | FailOverWrapper.pause | private static void pause( final long time )
{
final long startTime = System.currentTimeMillis();
do
{
try
{
final long sleepTime = time - ( System.currentTimeMillis() - startTime );
Thread.sleep( sleepTime > 0 ? sleepTime : 10 );
}
catch ( InterruptedException e )
{
//don't care
}
} while ( ( System.currentTimeMillis() - startTime ) < time );
} | java | private static void pause( final long time )
{
final long startTime = System.currentTimeMillis();
do
{
try
{
final long sleepTime = time - ( System.currentTimeMillis() - startTime );
Thread.sleep( sleepTime > 0 ? sleepTime : 10 );
}
catch ( InterruptedException e )
{
//don't care
}
} while ( ( System.currentTimeMillis() - startTime ) < time );
} | [
"private",
"static",
"void",
"pause",
"(",
"final",
"long",
"time",
")",
"{",
"final",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"do",
"{",
"try",
"{",
"final",
"long",
"sleepTime",
"=",
"time",
"-",
"(",
"System",
".... | Causes the executing thread to pause for a period of time.
@param time in ms | [
"Causes",
"the",
"executing",
"thread",
"to",
"pause",
"for",
"a",
"period",
"of",
"time",
"."
] | a6d4b5dbfa4e270db0ce70892512cbe39e64b874 | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/provider/FailOverWrapper.java#L72-L87 | train |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/cr/ChaiCrFactory.java | ChaiCrFactory.newChaiResponseSet | public static ChaiResponseSet newChaiResponseSet(
final Map<Challenge, String> challengeResponseMap,
final Locale locale,
final int minimumRandomRequired,
final ChaiConfiguration chaiConfiguration,
final String csIdentifier
)
throws ChaiValidationException
{
return newChaiResponseSet( challengeResponseMap, Collections.emptyMap(), locale, minimumRandomRequired, chaiConfiguration, csIdentifier );
} | java | public static ChaiResponseSet newChaiResponseSet(
final Map<Challenge, String> challengeResponseMap,
final Locale locale,
final int minimumRandomRequired,
final ChaiConfiguration chaiConfiguration,
final String csIdentifier
)
throws ChaiValidationException
{
return newChaiResponseSet( challengeResponseMap, Collections.emptyMap(), locale, minimumRandomRequired, chaiConfiguration, csIdentifier );
} | [
"public",
"static",
"ChaiResponseSet",
"newChaiResponseSet",
"(",
"final",
"Map",
"<",
"Challenge",
",",
"String",
">",
"challengeResponseMap",
",",
"final",
"Locale",
"locale",
",",
"final",
"int",
"minimumRandomRequired",
",",
"final",
"ChaiConfiguration",
"chaiConf... | Create a new ResponseSet. The generated ResponseSet will be suitable for writing to the directory.
@param challengeResponseMap A map containing Challenges as the key, and string responses for values
@param locale The locale the response set is stored in
@param minimumRandomRequired Minimum random responses required
@param chaiConfiguration Appropriate configuration to use during this operation
@param csIdentifier Identifier to store on generated ChaiResponseSet
@return A ResponseSet suitable for writing.
@throws com.novell.ldapchai.exception.ChaiValidationException when there is a logical problem with the response set data, such as more randoms required then exist | [
"Create",
"a",
"new",
"ResponseSet",
".",
"The",
"generated",
"ResponseSet",
"will",
"be",
"suitable",
"for",
"writing",
"to",
"the",
"directory",
"."
] | a6d4b5dbfa4e270db0ce70892512cbe39e64b874 | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/cr/ChaiCrFactory.java#L70-L80 | train |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/provider/WatchdogService.java | WatchdogService.checkTimer | private void checkTimer()
{
try
{
serviceThreadLock.lock();
if ( watchdogTimer == null )
{
// if there is NOT an active timer
if ( !issuedWatchdogWrappers.allValues().isEmpty() )
{
// if there are active providers.
LOGGER.debug( "starting up " + THREAD_NAME + ", " + watchdogFrequency + "ms check frequency" );
// create a new timer
startWatchdogThread();
}
}
}
finally
{
serviceThreadLock.unlock();
}
} | java | private void checkTimer()
{
try
{
serviceThreadLock.lock();
if ( watchdogTimer == null )
{
// if there is NOT an active timer
if ( !issuedWatchdogWrappers.allValues().isEmpty() )
{
// if there are active providers.
LOGGER.debug( "starting up " + THREAD_NAME + ", " + watchdogFrequency + "ms check frequency" );
// create a new timer
startWatchdogThread();
}
}
}
finally
{
serviceThreadLock.unlock();
}
} | [
"private",
"void",
"checkTimer",
"(",
")",
"{",
"try",
"{",
"serviceThreadLock",
".",
"lock",
"(",
")",
";",
"if",
"(",
"watchdogTimer",
"==",
"null",
")",
"{",
"// if there is NOT an active timer",
"if",
"(",
"!",
"issuedWatchdogWrappers",
".",
"allValues",
"... | Regulate the timer. This is important because the timer task creates its own thread,
and if the task isn't cleaned up, there could be a thread leak. | [
"Regulate",
"the",
"timer",
".",
"This",
"is",
"important",
"because",
"the",
"timer",
"task",
"creates",
"its",
"own",
"thread",
"and",
"if",
"the",
"task",
"isn",
"t",
"cleaned",
"up",
"there",
"could",
"be",
"a",
"thread",
"leak",
"."
] | a6d4b5dbfa4e270db0ce70892512cbe39e64b874 | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/provider/WatchdogService.java#L71-L94 | train |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/ConfigObjectRecord.java | ConfigObjectRecord.createNew | public static ConfigObjectRecord createNew( final ChaiEntry entry,
final String attr,
final String recordType,
final String guid1,
final String guid2 )
{
//Ensure the entry is not null
if ( entry == null )
{
throw new NullPointerException( "entry can not be null" );
}
//Ensure the record type is not null
if ( recordType == null )
{
throw new NullPointerException( "recordType can not be null" );
}
//Make sure the attr is not null
if ( attr == null )
{
throw new NullPointerException( "attr can not be null" );
}
// truncate record type to 4 chars.
final String effectiveRecordType = recordType.length() > 4
? recordType.substring( 0, 4 )
: recordType;
final ConfigObjectRecord cor = new ConfigObjectRecord();
cor.objectEntry = entry;
cor.attr = attr;
cor.recordType = effectiveRecordType;
cor.guid1 = ( guid1 == null || guid1.length() < 1 ) ? EMPTY_RECORD_VALUE : guid1;
cor.guid2 = ( guid2 == null || guid2.length() < 1 ) ? EMPTY_RECORD_VALUE : guid2;
return cor;
} | java | public static ConfigObjectRecord createNew( final ChaiEntry entry,
final String attr,
final String recordType,
final String guid1,
final String guid2 )
{
//Ensure the entry is not null
if ( entry == null )
{
throw new NullPointerException( "entry can not be null" );
}
//Ensure the record type is not null
if ( recordType == null )
{
throw new NullPointerException( "recordType can not be null" );
}
//Make sure the attr is not null
if ( attr == null )
{
throw new NullPointerException( "attr can not be null" );
}
// truncate record type to 4 chars.
final String effectiveRecordType = recordType.length() > 4
? recordType.substring( 0, 4 )
: recordType;
final ConfigObjectRecord cor = new ConfigObjectRecord();
cor.objectEntry = entry;
cor.attr = attr;
cor.recordType = effectiveRecordType;
cor.guid1 = ( guid1 == null || guid1.length() < 1 ) ? EMPTY_RECORD_VALUE : guid1;
cor.guid2 = ( guid2 == null || guid2.length() < 1 ) ? EMPTY_RECORD_VALUE : guid2;
return cor;
} | [
"public",
"static",
"ConfigObjectRecord",
"createNew",
"(",
"final",
"ChaiEntry",
"entry",
",",
"final",
"String",
"attr",
",",
"final",
"String",
"recordType",
",",
"final",
"String",
"guid1",
",",
"final",
"String",
"guid2",
")",
"{",
"//Ensure the entry is not ... | Create a new config object record. This will only create a java object representing the config
object record. It is up to the caller to call the updatePayload method which will actually
commit the record to the directory.
@param entry The {@code ChaiEntry} object where the config object record will be stored.
@param attr The ldap attribute name to use for storage.
@param recordType Record type for the record.
@param guid1 The first associated guid value
@param guid2 The second associated guid value
@return A ConfigObjectRecordInstance | [
"Create",
"a",
"new",
"config",
"object",
"record",
".",
"This",
"will",
"only",
"create",
"a",
"java",
"object",
"representing",
"the",
"config",
"object",
"record",
".",
"It",
"is",
"up",
"to",
"the",
"caller",
"to",
"call",
"the",
"updatePayload",
"meth... | a6d4b5dbfa4e270db0ce70892512cbe39e64b874 | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/ConfigObjectRecord.java#L93-L132 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.