_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q172600 | Operations.createReadAttributeOperation | test | public static ModelNode createReadAttributeOperation(PathAddress address, Attribute attribute) {
return createAttributeOperation(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION, address, attribute);
} | java | {
"resource": ""
} |
q172601 | Operations.createWriteAttributeOperation | test | public static ModelNode createWriteAttributeOperation(PathAddress address, Attribute attribute, ModelNode value) {
ModelNode operation = createAttributeOperation(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, address, attribute);
operation.get(ModelDescriptionConstants.VALUE).set(value);
return operation;
} | java | {
"resource": ""
} |
q172602 | Operations.createUndefineAttributeOperation | test | public static ModelNode createUndefineAttributeOperation(PathAddress address, Attribute attribute) {
return createAttributeOperation(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, address, attribute);
} | java | {
"resource": ""
} |
q172603 | NamingLookupValue.getValue | test | public T getValue() throws IllegalStateException {
final Context context = contextValue.getValue();
try {
return (T)context.lookup(contextName);
} catch (NamingException e) {
throw NamingLogger.ROOT_LOGGER.entryNotRegistered(e, contextName, context);
}
} | java | {
"resource": ""
} |
q172604 | InitialContext.addUrlContextFactory | test | public static synchronized void addUrlContextFactory(final String scheme, ObjectFactory factory) {
Map<String, ObjectFactory> factories = new HashMap<String, ObjectFactory>(urlContextFactories);
factories.put(scheme, factory);
urlContextFactories = Collections.unmodifiableMap(factories);
} | java | {
"resource": ""
} |
q172605 | InitialContext.removeUrlContextFactory | test | public static synchronized void removeUrlContextFactory(final String scheme, ObjectFactory factory) {
Map<String, ObjectFactory> factories = new HashMap<String, ObjectFactory>(urlContextFactories);
ObjectFactory f = factories.get(scheme);
if (f == factory) {
factories.remove(scheme);
urlContextFactories = Collections.unmodifiableMap(factories);
return;
} else {
throw new IllegalArgumentException();
}
} | java | {
"resource": ""
} |
q172606 | WildFlyProviderResolver.loadProviders | test | private List<ValidationProvider<?>> loadProviders(ClassLoader classLoader) {
@SuppressWarnings("rawtypes")
Iterator<ValidationProvider> providerIterator = ServiceLoader.load(ValidationProvider.class, classLoader).iterator();
LinkedList<ValidationProvider<?>> providers = new LinkedList<ValidationProvider<?>>();
while (providerIterator.hasNext()) {
try {
ValidationProvider<?> provider = providerIterator.next();
// put Hibernate Validator to the beginning of the list
if (provider.getClass().getName().equals("org.hibernate.validator.HibernateValidator")) {
providers.addFirst(provider);
} else {
providers.add(provider);
}
} catch (ServiceConfigurationError e) {
// ignore, because it can happen when multiple
// providers are present and some of them are not class loader
// compatible with our API.
}
}
return providers;
} | java | {
"resource": ""
} |
q172607 | WebMetaDataModifier.modify | test | void modify(final Deployment dep) {
final JBossWebMetaData jbossWebMD = WSHelper.getOptionalAttachment(dep, JBossWebMetaData.class);
if (jbossWebMD != null) {
this.configureEndpoints(dep, jbossWebMD);
this.modifyContextRoot(dep, jbossWebMD);
}
} | java | {
"resource": ""
} |
q172608 | WebMetaDataModifier.configureEndpoints | test | private void configureEndpoints(final Deployment dep, final JBossWebMetaData jbossWebMD) {
final String transportClassName = this.getTransportClassName(dep);
WSLogger.ROOT_LOGGER.trace("Modifying servlets");
// get a list of the endpoint bean class names
final Set<String> epNames = new HashSet<String>();
for (Endpoint ep : dep.getService().getEndpoints()) {
epNames.add(ep.getTargetBeanName());
}
// fix servlet class names for endpoints
for (final ServletMetaData servletMD : jbossWebMD.getServlets()) {
final String endpointClassName = ASHelper.getEndpointClassName(servletMD);
if (endpointClassName != null && endpointClassName.length() > 0) { // exclude JSP
if (epNames.contains(endpointClassName)) {
// set transport servlet
servletMD.setServletClass(WSFServlet.class.getName());
WSLogger.ROOT_LOGGER.tracef("Setting transport class: %s for endpoint: %s", transportClassName, endpointClassName);
final List<ParamValueMetaData> initParams = WebMetaDataHelper.getServletInitParams(servletMD);
// configure transport class name
WebMetaDataHelper.newParamValue(WSFServlet.STACK_SERVLET_DELEGATE_CLASS, transportClassName, initParams);
// configure webservice endpoint
WebMetaDataHelper.newParamValue(Endpoint.SEPID_DOMAIN_ENDPOINT, endpointClassName, initParams);
} else if (endpointClassName.startsWith("org.apache.cxf")) {
throw WSLogger.ROOT_LOGGER.invalidWSServlet(endpointClassName);
}
}
}
} | java | {
"resource": ""
} |
q172609 | WebMetaDataModifier.modifyContextRoot | test | private void modifyContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD) {
final String contextRoot = dep.getService().getContextRoot();
if (WSLogger.ROOT_LOGGER.isTraceEnabled()) {
WSLogger.ROOT_LOGGER.tracef("Setting context root: %s for deployment: %s", contextRoot, dep.getSimpleName());
}
jbossWebMD.setContextRoot(contextRoot);
} | java | {
"resource": ""
} |
q172610 | WebMetaDataModifier.getTransportClassName | test | private String getTransportClassName(final Deployment dep) {
String transportClassName = (String) dep.getProperty(WSConstants.STACK_TRANSPORT_CLASS);
if (transportClassName == null) throw WSLogger.ROOT_LOGGER.missingDeploymentProperty(WSConstants.STACK_TRANSPORT_CLASS);
return transportClassName;
} | java | {
"resource": ""
} |
q172611 | SecurityActions.setRunAsIdentity | test | static RunAs setRunAsIdentity(final RunAs principal, final SecurityContext sc) {
if (WildFlySecurityManager.isChecking()) {
return WildFlySecurityManager.doUnchecked(new PrivilegedAction<RunAs>() {
@Override
public RunAs run() {
if (sc == null) {
throw UndertowLogger.ROOT_LOGGER.noSecurityContext();
}
RunAs old = sc.getOutgoingRunAs();
sc.setOutgoingRunAs(principal);
return old;
}
});
} else {
if (sc == null) {
throw UndertowLogger.ROOT_LOGGER.noSecurityContext();
}
RunAs old = sc.getOutgoingRunAs();
sc.setOutgoingRunAs(principal);
return old;
}
} | java | {
"resource": ""
} |
q172612 | SecurityActions.popRunAsIdentity | test | static RunAs popRunAsIdentity(final SecurityContext sc) {
if (WildFlySecurityManager.isChecking()) {
return AccessController.doPrivileged(new PrivilegedAction<RunAs>() {
@Override
public RunAs run() {
if (sc == null) {
throw UndertowLogger.ROOT_LOGGER.noSecurityContext();
}
RunAs principal = sc.getOutgoingRunAs();
sc.setOutgoingRunAs(null);
return principal;
}
});
} else {
if (sc == null) {
throw UndertowLogger.ROOT_LOGGER.noSecurityContext();
}
RunAs principal = sc.getOutgoingRunAs();
sc.setOutgoingRunAs(null);
return principal;
}
} | java | {
"resource": ""
} |
q172613 | UndertowDeploymentProcessor.processManagement | test | void processManagement(final DeploymentUnit unit, JBossWebMetaData metaData) {
final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
for (final JBossServletMetaData servlet : metaData.getServlets()) {
try {
final String name = servlet.getName();
final ModelNode node = deploymentResourceSupport.getDeploymentSubModel(UndertowExtension.SUBSYSTEM_NAME, PathElement.pathElement("servlet", name));
node.get("servlet-class").set(servlet.getServletClass());
node.get("servlet-name").set(servlet.getServletName());
} catch (Exception e) {
// Should a failure in creating the mgmt view also make to the deployment to fail?
continue;
}
}
} | java | {
"resource": ""
} |
q172614 | Injection.inject | test | @SuppressWarnings("unchecked")
public void inject(Object object, String propertyName, Object propertyValue)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
inject(object, propertyName, propertyValue, null, false);
} | java | {
"resource": ""
} |
q172615 | Injection.argumentMatches | test | private boolean argumentMatches(String classType, String propertyType) {
return (classType.equals(propertyType))
|| (classType.equals("java.lang.Byte") && propertyType.equals("byte"))
|| (classType.equals("java.lang.Short") && propertyType.equals("short"))
|| (classType.equals("java.lang.Integer") && propertyType.equals("int"))
|| (classType.equals("java.lang.Long") && propertyType.equals("long"))
|| (classType.equals("java.lang.Float") && propertyType.equals("float"))
|| (classType.equals("java.lang.Double") && propertyType.equals("double"))
|| (classType.equals("java.lang.Boolean") && propertyType.equals("boolean"))
|| (classType.equals("java.lang.Character") && propertyType.equals("char"));
} | java | {
"resource": ""
} |
q172616 | Injection.findMethod | test | protected Method findMethod(Class<?> clz, String methodName, String propertyType) {
while (!clz.equals(Object.class)) {
List<Method> hits = null;
Method[] methods = SecurityActions.getDeclaredMethods(clz);
for (int i = 0; i < methods.length; i++) {
final Method method = methods[i];
if (methodName.equals(method.getName()) && method.getParameterTypes().length == 1) {
if (propertyType == null || argumentMatches(propertyType, method.getParameterTypes()[0].getName())) {
if (hits == null)
hits = new ArrayList<Method>(1);
SecurityActions.setAccessible(method);
hits.add(method);
}
}
}
if (hits != null) {
if (hits.size() == 1) {
return hits.get(0);
} else {
Collections.sort(hits, new MethodSorter());
if (propertyType != null) {
for (Method m : hits) {
if (propertyType.equals(m.getParameterTypes()[0].getName()))
return m;
}
}
return hits.get(0);
}
}
clz = clz.getSuperclass();
}
return null;
} | java | {
"resource": ""
} |
q172617 | Injection.findField | test | protected Field findField(Class<?> clz, String fieldName, String fieldType) {
while (!clz.equals(Object.class)) {
List<Field> hits = null;
Field[] fields = SecurityActions.getDeclaredFields(clz);
for (int i = 0; i < fields.length; i++) {
final Field field = fields[i];
if (fieldName.equals(field.getName())) {
if (fieldType == null || argumentMatches(fieldType, field.getType().getName())) {
if (hits == null)
hits = new ArrayList<Field>(1);
SecurityActions.setAccessible(field);
hits.add(field);
}
}
}
if (hits != null) {
if (hits.size() == 1) {
return hits.get(0);
} else {
Collections.sort(hits, new FieldSorter());
if (fieldType != null) {
for (Field f : hits) {
if (fieldType.equals(f.getType().getName()))
return f;
}
}
return hits.get(0);
}
}
clz = clz.getSuperclass();
}
return null;
} | java | {
"resource": ""
} |
q172618 | VaultTool.initOptions | test | private void initOptions() {
options = new Options();
options.addOption("k", KEYSTORE_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineKeyStoreURL());
options.addOption("p", KEYSTORE_PASSWORD_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineKeyStorePassword());
options.addOption("e", ENC_DIR_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineEncryptionDirectory());
options.addOption("s", SALT_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineSalt());
options.addOption("i", ITERATION_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineIterationCount());
options.addOption("v", ALIAS_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineVaultKeyStoreAlias());
options.addOption("b", VAULT_BLOCK_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineVaultBlock());
options.addOption("a", ATTRIBUTE_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineAttributeName());
options.addOption("t", CREATE_KEYSTORE_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineAutomaticallyCreateKeystore());
OptionGroup og = new OptionGroup();
Option x = new Option("x", SEC_ATTR_VALUE_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineSecuredAttribute());
Option c = new Option("c", CHECK_SEC_ATTR_EXISTS_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineCheckAttribute());
Option r = new Option("r", REMOVE_SEC_ATTR_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineRemoveSecuredAttribute());
Option h = new Option("h", HELP_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineHelp());
og.addOption(x);
og.addOption(c);
og.addOption(r);
og.addOption(h);
og.setRequired(true);
options.addOptionGroup(og);
} | java | {
"resource": ""
} |
q172619 | AuditNotificationReceiver.deriveUsefulInfo | test | private static String deriveUsefulInfo(HttpServletRequest httpRequest) {
StringBuilder sb = new StringBuilder();
sb.append("[").append(httpRequest.getContextPath());
sb.append(":cookies=").append(Arrays.toString(httpRequest.getCookies())).append(":headers=");
// Append Header information
Enumeration<?> en = httpRequest.getHeaderNames();
while (en.hasMoreElements()) {
String headerName = (String) en.nextElement();
sb.append(headerName).append("=");
// Ensure HTTP Basic Password is not logged
if (!headerName.contains("authorization")) { sb.append(httpRequest.getHeader(headerName)).append(","); }
}
sb.append("]");
// Append Request parameter information
sb.append("[parameters=");
Enumeration<?> enparam = httpRequest.getParameterNames();
while (enparam.hasMoreElements()) {
String paramName = (String) enparam.nextElement();
String[] paramValues = httpRequest.getParameterValues(paramName);
int len = paramValues != null ? paramValues.length : 0;
for (int i = 0; i < len; i++) { sb.append(paramValues[i]).append("::"); }
sb.append(",");
}
sb.append("][attributes=");
// Append Request attribute information
Enumeration<?> enu = httpRequest.getAttributeNames();
while (enu.hasMoreElements()) {
String attrName = (String) enu.nextElement();
sb.append(attrName).append("=");
sb.append(httpRequest.getAttribute(attrName)).append(",");
}
sb.append("]");
return sb.toString();
} | java | {
"resource": ""
} |
q172620 | JdrReportService.standaloneCollect | test | public JdrReport standaloneCollect(CLI cli, String protocol, String host, int port) throws OperationFailedException {
return new JdrRunner(cli, protocol, host, port, null, null).collect();
} | java | {
"resource": ""
} |
q172621 | JdrReportService.collect | test | public JdrReport collect() throws OperationFailedException {
JdrRunner runner = new JdrRunner(true);
serverEnvironment = serverEnvironmentValue.getValue();
runner.setJbossHomeDir(serverEnvironment.getHomeDir().getAbsolutePath());
runner.setReportLocationDir(serverEnvironment.getServerTempDir().getAbsolutePath());
runner.setControllerClient(controllerClient);
runner.setHostControllerName(serverEnvironment.getHostControllerName());
runner.setServerName(serverEnvironment.getServerName());
return runner.collect();
} | java | {
"resource": ""
} |
q172622 | ResourceAdapterDeploymentRegistryImpl.registerResourceAdapterDeployment | test | public void registerResourceAdapterDeployment(ResourceAdapterDeployment deployment) {
if (deployment == null)
throw new IllegalArgumentException(ConnectorLogger.ROOT_LOGGER.nullVar("Deployment"));
DEPLOYMENT_CONNECTOR_REGISTRY_LOGGER.tracef("Adding deployment: %s", deployment);
deployments.add(deployment);
} | java | {
"resource": ""
} |
q172623 | ResourceAdapterDeploymentRegistryImpl.unregisterResourceAdapterDeployment | test | public void unregisterResourceAdapterDeployment(ResourceAdapterDeployment deployment) {
if (deployment == null)
throw new IllegalArgumentException(ConnectorLogger.ROOT_LOGGER.nullVar("Deployment"));
DEPLOYMENT_CONNECTOR_REGISTRY_LOGGER.tracef("Removing deployment: %s", deployment);
deployments.remove(deployment);
} | java | {
"resource": ""
} |
q172624 | JacORBExtension.registerTransformers | test | protected static void registerTransformers(final SubsystemRegistration subsystem) {
ChainedTransformationDescriptionBuilder chained = ResourceTransformationDescriptionBuilder.Factory.createChainedSubystemInstance(CURRENT_MODEL_VERSION);
ModelVersion MODEL_VERSION_EAP64 = ModelVersion.create(1, 4, 0);
ModelVersion MODEL_VERSION_EAP63 = ModelVersion.create(1, 3, 0);//also EAP6.2
ResourceTransformationDescriptionBuilder builder64 = chained.createBuilder(CURRENT_MODEL_VERSION, MODEL_VERSION_EAP64);
builder64.getAttributeBuilder()
.addRejectCheck(RejectAttributeChecker.DEFINED, JacORBSubsystemDefinitions.PERSISTENT_SERVER_ID)
.setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(JacORBSubsystemDefinitions.PERSISTENT_SERVER_ID.getDefaultValue()), JacORBSubsystemDefinitions.PERSISTENT_SERVER_ID)
.setValueConverter(new AttributeConverter.DefaultValueAttributeConverter(JacORBSubsystemDefinitions.INTEROP_CHUNK_RMI_VALUETYPES),JacORBSubsystemDefinitions.INTEROP_CHUNK_RMI_VALUETYPES);
ResourceTransformationDescriptionBuilder builder63 = chained.createBuilder(MODEL_VERSION_EAP64, MODEL_VERSION_EAP63);
builder63.getAttributeBuilder()
.addRejectCheck(RejectAttributeChecker.DEFINED, IORTransportConfigDefinition.ATTRIBUTES.toArray(new AttributeDefinition[0]))
.addRejectCheck(RejectAttributeChecker.DEFINED, IORASContextDefinition.ATTRIBUTES.toArray(new AttributeDefinition[0]))
.addRejectCheck(RejectAttributeChecker.DEFINED, IORSASContextDefinition.ATTRIBUTES.toArray(new AttributeDefinition[0]))
.end()
.rejectChildResource(IORSettingsDefinition.INSTANCE.getPathElement());
chained.buildAndRegister(subsystem, new ModelVersion[]{
MODEL_VERSION_EAP64,
MODEL_VERSION_EAP63
});
} | java | {
"resource": ""
} |
q172625 | StubStrategy.writeParams | test | public void writeParams(OutputStream out, Object[] params) {
int len = params.length;
if (len != paramWriters.length) {
throw IIOPLogger.ROOT_LOGGER.errorMashalingParams();
}
for (int i = 0; i < len; i++) {
Object param = params[i];
if (param instanceof PortableRemoteObject) {
try {
param = PortableRemoteObject.toStub((Remote) param);
} catch (NoSuchObjectException e) {
throw new RuntimeException(e);
}
}
paramWriters[i].write(out, RemoteObjectSubstitutionManager.writeReplaceRemote(param));
}
} | java | {
"resource": ""
} |
q172626 | StubStrategy.readException | test | public Exception readException(String id, InputStream in) {
ExceptionReader exceptionReader = (ExceptionReader) exceptionMap.get(id);
if (exceptionReader == null) {
return new UnexpectedException(id);
} else {
return exceptionReader.read(in);
}
} | java | {
"resource": ""
} |
q172627 | StatefulSessionSynchronizationInterceptor.getLockOwner | test | private static Object getLockOwner(final TransactionSynchronizationRegistry transactionSynchronizationRegistry) {
Object owner = transactionSynchronizationRegistry.getTransactionKey();
return owner != null ? owner : Thread.currentThread();
} | java | {
"resource": ""
} |
q172628 | StatefulSessionSynchronizationInterceptor.releaseLock | test | static void releaseLock(final StatefulSessionComponentInstance instance) {
instance.getLock().unlock(getLockOwner(instance.getComponent().getTransactionSynchronizationRegistry()));
ROOT_LOGGER.tracef("Released lock: %s", instance.getLock());
} | java | {
"resource": ""
} |
q172629 | JdrZipFile.addLog | test | public void addLog(String content, String logName) throws Exception {
String name = "sos_logs/" + logName;
this.add(new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)), name);
} | java | {
"resource": ""
} |
q172630 | JSFDependencyProcessor.addCDIFlag | test | private void addCDIFlag(WarMetaData warMetaData, DeploymentUnit deploymentUnit) {
JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData();
if (webMetaData == null) {
webMetaData = new JBossWebMetaData();
warMetaData.setMergedJBossWebMetaData(webMetaData);
}
List<ParamValueMetaData> contextParams = webMetaData.getContextParams();
if (contextParams == null) {
contextParams = new ArrayList<ParamValueMetaData>();
}
boolean isCDI = false;
final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
if (support.hasCapability(WELD_CAPABILITY_NAME)) {
isCDI = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).get()
.isPartOfWeldDeployment(deploymentUnit);
}
ParamValueMetaData param = new ParamValueMetaData();
param.setParamName(IS_CDI_PARAM);
param.setParamValue(Boolean.toString(isCDI));
contextParams.add(param);
webMetaData.setContextParams(contextParams);
} | java | {
"resource": ""
} |
q172631 | AbstractInvocationHandler.getComponentView | test | protected ComponentView getComponentView() {
ComponentView cv = componentView;
// we need to check both, otherwise it is possible for
// componentView to be initialized before reference
if (cv == null) {
synchronized (this) {
cv = componentView;
if (cv == null) {
cv = getMSCService(componentViewName, ComponentView.class);
if (cv == null) {
throw WSLogger.ROOT_LOGGER.cannotFindComponentView(componentViewName);
}
if (reference == null) {
try {
reference = cv.createInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
componentView = cv;
}
}
}
return cv;
} | java | {
"resource": ""
} |
q172632 | AbstractInvocationHandler.invoke | test | public void invoke(final Endpoint endpoint, final Invocation wsInvocation) throws Exception {
try {
if (!EndpointState.STARTED.equals(endpoint.getState())) {
throw WSLogger.ROOT_LOGGER.endpointAlreadyStopped(endpoint.getShortName());
}
SecurityDomainContext securityDomainContext = endpoint.getSecurityDomainContext();
securityDomainContext.runAs((Callable<Void>) () -> {
invokeInternal(endpoint, wsInvocation);
return null;
});
} catch (Throwable t) {
handleInvocationException(t);
} finally {
onAfterInvocation(wsInvocation);
}
} | java | {
"resource": ""
} |
q172633 | AbstractInvocationHandler.getComponentViewMethod | test | protected Method getComponentViewMethod(final Method seiMethod, final Collection<Method> viewMethods) {
for (final Method viewMethod : viewMethods) {
if (matches(seiMethod, viewMethod)) {
return viewMethod;
}
}
throw new IllegalStateException();
} | java | {
"resource": ""
} |
q172634 | AbstractInvocationHandler.matches | test | private boolean matches(final Method seiMethod, final Method viewMethod) {
if (!seiMethod.getName().equals(viewMethod.getName())) return false;
final Class<?>[] sourceParams = seiMethod.getParameterTypes();
final Class<?>[] targetParams = viewMethod.getParameterTypes();
if (sourceParams.length != targetParams.length) return false;
for (int i = 0; i < sourceParams.length; i++) {
if (!sourceParams[i].equals(targetParams[i])) return false;
}
return true;
} | java | {
"resource": ""
} |
q172635 | JPAService.createManagementStatisticsResource | test | public static Resource createManagementStatisticsResource(
final ManagementAdaptor managementAdaptor,
final String scopedPersistenceUnitName,
final DeploymentUnit deploymentUnit) {
synchronized (existingResourceDescriptionResolver) {
final EntityManagerFactoryLookup entityManagerFactoryLookup = new EntityManagerFactoryLookup();
final Statistics statistics = managementAdaptor.getStatistics();
if (false == existingResourceDescriptionResolver.contains(managementAdaptor.getVersion())) {
// setup statistics (this used to be part of JPA subsystem startup)
ResourceDescriptionResolver resourceDescriptionResolver = new StandardResourceDescriptionResolver(
statistics.getResourceBundleKeyPrefix(), statistics.getResourceBundleName(), statistics.getClass().getClassLoader()){
private ResourceDescriptionResolver fallback = JPAExtension.getResourceDescriptionResolver();
//add a fallback in case provider doesn't have all properties properly defined
@Override
public String getResourceAttributeDescription(String attributeName, Locale locale, ResourceBundle bundle) {
if (bundle.containsKey(getBundleKey(attributeName))) {
return super.getResourceAttributeDescription(attributeName, locale, bundle);
}else{
return fallback.getResourceAttributeDescription(attributeName, locale, fallback.getResourceBundle(locale));
}
}
};
PathElement subsystemPE = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, JPAExtension.SUBSYSTEM_NAME);
ManagementResourceRegistration deploymentResourceRegistration = deploymentUnit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT);
ManagementResourceRegistration deploymentSubsystemRegistration =
deploymentResourceRegistration.getSubModel(PathAddress.pathAddress(subsystemPE));
ManagementResourceRegistration subdeploymentSubsystemRegistration =
deploymentResourceRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBDEPLOYMENT), subsystemPE));
ManagementResourceRegistration providerResource = deploymentSubsystemRegistration.registerSubModel(
new ManagementResourceDefinition(PathElement.pathElement(managementAdaptor.getIdentificationLabel()), resourceDescriptionResolver, statistics, entityManagerFactoryLookup));
providerResource.registerReadOnlyAttribute(PersistenceUnitServiceHandler.SCOPED_UNIT_NAME, null);
providerResource = subdeploymentSubsystemRegistration.registerSubModel(
new ManagementResourceDefinition(PathElement.pathElement(managementAdaptor.getIdentificationLabel()), resourceDescriptionResolver, statistics, entityManagerFactoryLookup));
providerResource.registerReadOnlyAttribute(PersistenceUnitServiceHandler.SCOPED_UNIT_NAME, null);
existingResourceDescriptionResolver.add(managementAdaptor.getVersion());
}
// create (per deployment) dynamic Resource implementation that can reflect the deployment specific names (e.g. jpa entity classname/Hibernate region name)
return new DynamicManagementStatisticsResource(statistics, scopedPersistenceUnitName, managementAdaptor.getIdentificationLabel(), entityManagerFactoryLookup);
}
} | java | {
"resource": ""
} |
q172636 | AbstractSecurityMetaDataAccessorEJB.getEjbSecurityMetaData | test | private EJBSecurityMetaData getEjbSecurityMetaData(final Endpoint endpoint) {
final String ejbName = endpoint.getShortName();
final Deployment dep = endpoint.getService().getDeployment();
final EJBArchiveMetaData ejbArchiveMD = WSHelper.getOptionalAttachment(dep, EJBArchiveMetaData.class);
final EJBMetaData ejbMD = ejbArchiveMD != null ? ejbArchiveMD.getBeanByEjbName(ejbName) : null;
return ejbMD != null ? ejbMD.getSecurityMetaData() : null;
} | java | {
"resource": ""
} |
q172637 | AbstractSecurityMetaDataAccessorEJB.getDomain | test | private String getDomain(final String oldSecurityDomain, final String nextSecurityDomain) {
if (nextSecurityDomain == null) {
return oldSecurityDomain;
}
if (oldSecurityDomain == null) {
return nextSecurityDomain;
}
ensureSameDomains(oldSecurityDomain, nextSecurityDomain);
return oldSecurityDomain;
} | java | {
"resource": ""
} |
q172638 | AbstractSecurityMetaDataAccessorEJB.ensureSameDomains | test | private void ensureSameDomains(final String oldSecurityDomain, final String newSecurityDomain) {
final boolean domainsDiffer = !oldSecurityDomain.equals(newSecurityDomain);
if (domainsDiffer)
throw WSLogger.ROOT_LOGGER.multipleSecurityDomainsDetected(oldSecurityDomain, newSecurityDomain);
} | java | {
"resource": ""
} |
q172639 | AttributeAnalysis.setIDLName | test | void setIDLName(String idlName) {
super.setIDLName(idlName);
// If the first char is an uppercase letter and the second char is not
// an uppercase letter, then convert the first char to lowercase.
if (idlName.charAt(0) >= 0x41 && idlName.charAt(0) <= 0x5a
&& (idlName.length() <= 1
|| idlName.charAt(1) < 0x41 || idlName.charAt(1) > 0x5a)) {
idlName =
idlName.substring(0, 1).toLowerCase(Locale.ENGLISH) + idlName.substring(1);
}
if (accessorAnalysis != null)
accessorAnalysis.setIDLName("_get_" + idlName);
if (mutatorAnalysis != null)
mutatorAnalysis.setIDLName("_set_" + idlName);
} | java | {
"resource": ""
} |
q172640 | JndiName.getAbsoluteName | test | public String getAbsoluteName() {
final StringBuilder absolute = new StringBuilder();
if (parent != null) {
absolute.append(parent).append(ENTRY_SEPARATOR);
}
absolute.append(local);
return absolute.toString();
} | java | {
"resource": ""
} |
q172641 | JndiName.of | test | public static JndiName of(final String name) {
if(name == null || name.isEmpty()) throw NamingLogger.ROOT_LOGGER.invalidJndiName(name);
final String[] parts = name.split(ENTRY_SEPARATOR);
JndiName current = null;
for(String part : parts) {
current = new JndiName(current, part);
}
return current;
} | java | {
"resource": ""
} |
q172642 | IronJacamarDeploymentParsingProcessor.deploy | test | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ResourceRoot resourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile deploymentRoot = resourceRoot.getRoot();
final boolean resolveProperties = Util.shouldResolveJBoss(deploymentUnit);
IronJacamarXmlDescriptor xmlDescriptor = process(deploymentRoot, resolveProperties);
if (xmlDescriptor != null) {
deploymentUnit.putAttachment(IronJacamarXmlDescriptor.ATTACHMENT_KEY, xmlDescriptor);
}
} | java | {
"resource": ""
} |
q172643 | RunningRequestsHttpHandler.handleRequest | test | @Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
runningCount.increment();
exchange.addExchangeCompleteListener(new ExchangeCompletionListener() {
@Override
public void exchangeEvent(HttpServerExchange exchange, NextListener nextListener) {
runningCount.decrement();
// Proceed to next listener must be called!
nextListener.proceed();
}
});
wrappedHandler.handleRequest(exchange);
} | java | {
"resource": ""
} |
q172644 | InjectedJMSContext.isInTransaction | test | private boolean isInTransaction() {
TransactionSynchronizationRegistry tsr = getTransactionSynchronizationRegistry();
boolean inTx = tsr.getTransactionStatus() == Status.STATUS_ACTIVE;
return inTx;
} | java | {
"resource": ""
} |
q172645 | InjectedJMSContext.getTransactionSynchronizationRegistry | test | private TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {
TransactionSynchronizationRegistry cachedTSR = transactionSynchronizationRegistry;
if (cachedTSR == null) {
cachedTSR = (TransactionSynchronizationRegistry) lookup(TRANSACTION_SYNCHRONIZATION_REGISTRY_LOOKUP);
transactionSynchronizationRegistry = cachedTSR;
}
return cachedTSR;
} | java | {
"resource": ""
} |
q172646 | InjectedJMSContext.getConnectionFactory | test | private ConnectionFactory getConnectionFactory() {
ConnectionFactory cachedCF = connectionFactory;
if (cachedCF == null) {
cachedCF = (ConnectionFactory)lookup(info.getConnectionFactoryLookup());
connectionFactory = cachedCF;
}
return cachedCF;
} | java | {
"resource": ""
} |
q172647 | NamingUtils.getLastComponent | test | public static String getLastComponent(final Name name) {
if(name.size() > 0)
return name.get(name.size() - 1);
return "";
} | java | {
"resource": ""
} |
q172648 | NamingUtils.isEmpty | test | public static boolean isEmpty(final Name name) {
return name.isEmpty() || (name.size() == 1 && "".equals(name.get(0)));
} | java | {
"resource": ""
} |
q172649 | NamingUtils.nameNotFoundException | test | public static NameNotFoundException nameNotFoundException(final String name, final Name contextName) {
return NamingLogger.ROOT_LOGGER.nameNotFoundInContext(name, contextName);
} | java | {
"resource": ""
} |
q172650 | NamingUtils.namingException | test | public static NamingException namingException(final String message, final Throwable cause) {
final NamingException exception = new NamingException(message);
if (cause != null) exception.initCause(cause);
return exception;
} | java | {
"resource": ""
} |
q172651 | NamingUtils.namingException | test | public static NamingException namingException(final String message, final Throwable cause, final Name remainingName) {
final NamingException exception = namingException(message, cause);
exception.setRemainingName(remainingName);
return exception;
} | java | {
"resource": ""
} |
q172652 | NamingUtils.cannotProceedException | test | public static CannotProceedException cannotProceedException(final Object resolvedObject, final Name remainingName) {
final CannotProceedException cpe = new CannotProceedException();
cpe.setResolvedObj(resolvedObject);
cpe.setRemainingName(remainingName);
return cpe;
} | java | {
"resource": ""
} |
q172653 | NamingUtils.namingEnumeration | test | public static <T> NamingEnumeration<T> namingEnumeration(final Collection<T> collection) {
final Iterator<T> iterator = collection.iterator();
return new NamingEnumeration<T>() {
public T next() {
return nextElement();
}
public boolean hasMore() {
return hasMoreElements();
}
public void close() {
}
public boolean hasMoreElements() {
return iterator.hasNext();
}
public T nextElement() {
return iterator.next();
}
};
} | java | {
"resource": ""
} |
q172654 | NamingUtils.rebind | test | public static void rebind(final Context ctx, final String name, final Object value) throws NamingException {
final Name n = ctx.getNameParser("").parse(name);
rebind(ctx, n, value);
} | java | {
"resource": ""
} |
q172655 | AbstractActiveMQComponentControlHandler.getActiveMQComponentControl | test | protected final T getActiveMQComponentControl(final OperationContext context, final ModelNode operation, final boolean forWrite) throws OperationFailedException {
final ServiceName artemisServiceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
ServiceController<?> artemisService = context.getServiceRegistry(forWrite).getService(artemisServiceName);
ActiveMQServer server = ActiveMQServer.class.cast(artemisService.getValue());
PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
T control = getActiveMQComponentControl(server, address);
if (control == null) {
throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address);
}
return control;
} | java | {
"resource": ""
} |
q172656 | CommonIronJacamarParser.parseConnectionAttributes_5_0 | test | private String parseConnectionAttributes_5_0(final XMLExtendedStreamReader reader, final ModelNode connectionDefinitionNode)
throws XMLStreamException {
String poolName = null;
String jndiName = null;
int attributeSize = reader.getAttributeCount();
for (int i = 0; i < attributeSize; i++) {
ConnectionDefinition.Attribute attribute = ConnectionDefinition.Attribute.forName(reader.getAttributeLocalName(i));
String value = reader.getAttributeValue(i);
switch (attribute) {
case ENABLED: {
ENABLED.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case CONNECTABLE: {
CONNECTABLE.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case TRACKING: {
TRACKING.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case JNDI_NAME: {
jndiName = value;
JNDINAME.parseAndSetParameter(jndiName, connectionDefinitionNode, reader);
break;
}
case POOL_NAME: {
poolName = value;
break;
}
case USE_JAVA_CONTEXT: {
USE_JAVA_CONTEXT.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case USE_CCM: {
USE_CCM.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case SHARABLE: {
SHARABLE.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case ENLISTMENT: {
ENLISTMENT.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case CLASS_NAME: {
CLASS_NAME.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case MCP: {
MCP.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
}
case ENLISTMENT_TRACE:
ENLISTMENT_TRACE.parseAndSetParameter(value, connectionDefinitionNode, reader);
break;
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
if (poolName == null || poolName.trim().equals("")) {
if (jndiName != null && jndiName.trim().length() != 0) {
if (jndiName.contains("/")) {
poolName = jndiName.substring(jndiName.lastIndexOf("/") + 1);
} else {
poolName = jndiName.substring(jndiName.lastIndexOf(":") + 1);
}
} else {
throw ParseUtils.missingRequired(reader, EnumSet.of(ConnectionDefinition.Attribute.JNDI_NAME));
}
}
return poolName;
} | java | {
"resource": ""
} |
q172657 | BasicComponent.createInstance | test | public ComponentInstance createInstance(Object instance) {
BasicComponentInstance obj = constructComponentInstance(new ImmediateManagedReference(instance), true);
obj.constructionFinished();
return obj;
} | java | {
"resource": ""
} |
q172658 | JaxrsSpringProcessor.getResteasySpringVirtualFile | test | protected synchronized VirtualFile getResteasySpringVirtualFile() throws DeploymentUnitProcessingException {
if(resourceRoot != null) {
return resourceRoot;
}
try {
Module module = Module.getBootModuleLoader().loadModule(MODULE);
URL fileUrl = module.getClassLoader().getResource(JAR_LOCATION);
if (fileUrl == null) {
throw JaxrsLogger.JAXRS_LOGGER.noSpringIntegrationJar();
}
File dir = new File(fileUrl.toURI());
File file = null;
for (String jar : dir.list()) {
if (jar.endsWith(".jar")) {
file = new File(dir, jar);
break;
}
}
if (file == null) {
throw JaxrsLogger.JAXRS_LOGGER.noSpringIntegrationJar();
}
VirtualFile vf = VFS.getChild(file.toURI());
final Closeable mountHandle = VFS.mountZip(file, vf, TempFileProviderService.provider());
Service<Closeable> mountHandleService = new Service<Closeable>() {
public void start(StartContext startContext) throws StartException {
}
public void stop(StopContext stopContext) {
VFSUtils.safeClose(mountHandle);
}
public Closeable getValue() throws IllegalStateException, IllegalArgumentException {
return mountHandle;
}
};
ServiceBuilder<Closeable> builder = serviceTarget.addService(ServiceName.JBOSS.append(SERVICE_NAME),
mountHandleService);
builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
resourceRoot = vf;
return resourceRoot;
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
} | java | {
"resource": ""
} |
q172659 | AbstractRuntimeMetricsHandler.resolveRuntimeName | test | protected static String resolveRuntimeName(final OperationContext context, final PathElement address){
final ModelNode runtimeName = context.readResourceFromRoot(PathAddress.pathAddress(address),false).getModel()
.get(ModelDescriptionConstants.RUNTIME_NAME);
return runtimeName.asString();
} | java | {
"resource": ""
} |
q172660 | UndertowSubsystemParser_7_0.listenerBuilder | test | private static PersistentResourceXMLDescription.PersistentResourceXMLBuilder listenerBuilder(PersistentResourceDefinition resource) {
return builder(resource.getPathElement())
// xsd socket-optionsType
.addAttributes(
ListenerResourceDefinition.RECEIVE_BUFFER,
ListenerResourceDefinition.SEND_BUFFER,
ListenerResourceDefinition.BACKLOG,
ListenerResourceDefinition.KEEP_ALIVE,
ListenerResourceDefinition.READ_TIMEOUT,
ListenerResourceDefinition.WRITE_TIMEOUT,
ListenerResourceDefinition.MAX_CONNECTIONS)
// xsd listener-type
.addAttributes(
ListenerResourceDefinition.SOCKET_BINDING,
ListenerResourceDefinition.WORKER,
ListenerResourceDefinition.BUFFER_POOL,
ListenerResourceDefinition.ENABLED,
ListenerResourceDefinition.RESOLVE_PEER_ADDRESS,
ListenerResourceDefinition.MAX_ENTITY_SIZE,
ListenerResourceDefinition.BUFFER_PIPELINED_DATA,
ListenerResourceDefinition.MAX_HEADER_SIZE,
ListenerResourceDefinition.MAX_PARAMETERS,
ListenerResourceDefinition.MAX_HEADERS,
ListenerResourceDefinition.MAX_COOKIES,
ListenerResourceDefinition.ALLOW_ENCODED_SLASH,
ListenerResourceDefinition.DECODE_URL,
ListenerResourceDefinition.URL_CHARSET,
ListenerResourceDefinition.ALWAYS_SET_KEEP_ALIVE,
ListenerResourceDefinition.MAX_BUFFERED_REQUEST_SIZE,
ListenerResourceDefinition.RECORD_REQUEST_START_TIME,
ListenerResourceDefinition.ALLOW_EQUALS_IN_COOKIE_VALUE,
ListenerResourceDefinition.NO_REQUEST_TIMEOUT,
ListenerResourceDefinition.REQUEST_PARSE_TIMEOUT,
ListenerResourceDefinition.DISALLOWED_METHODS,
ListenerResourceDefinition.SECURE,
ListenerResourceDefinition.RFC6265_COOKIE_VALIDATION,
ListenerResourceDefinition.ALLOW_UNESCAPED_CHARACTERS_IN_URL);
} | java | {
"resource": ""
} |
q172661 | PrimitiveAnalysis.getPrimitiveAnalysis | test | public static PrimitiveAnalysis getPrimitiveAnalysis(final Class cls) {
if (cls == null)
throw IIOPLogger.ROOT_LOGGER.cannotAnalyzeNullClass();
if (cls == Void.TYPE)
return voidAnalysis;
if (cls == Boolean.TYPE)
return booleanAnalysis;
if (cls == Character.TYPE)
return charAnalysis;
if (cls == Byte.TYPE)
return byteAnalysis;
if (cls == Short.TYPE)
return shortAnalysis;
if (cls == Integer.TYPE)
return intAnalysis;
if (cls == Long.TYPE)
return longAnalysis;
if (cls == Float.TYPE)
return floatAnalysis;
if (cls == Double.TYPE)
return doubleAnalysis;
throw IIOPLogger.ROOT_LOGGER.notAPrimitive(cls.getName());
} | java | {
"resource": ""
} |
q172662 | ShutDownInterceptorFactory.shutdown | test | public void shutdown() {
int value;
int oldValue;
//set the shutdown bit
do {
oldValue = invocationCount;
value = SHUTDOWN_FLAG | oldValue;
//the component has already been shutdown
if (oldValue == value) {
return;
}
} while (!updater.compareAndSet(this, oldValue, value));
synchronized (lock) {
value = invocationCount;
while (value != SHUTDOWN_FLAG) {
try {
lock.wait();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
value = invocationCount;
if((value & SHUTDOWN_FLAG) == 0) {
return; //component has been restarted
}
}
}
} | java | {
"resource": ""
} |
q172663 | WebMetaDataHelper.getUrlPatterns | test | public static List<String> getUrlPatterns(final String urlPattern) {
final List<String> linkedList = new LinkedList<String>();
linkedList.add(urlPattern);
return linkedList;
} | java | {
"resource": ""
} |
q172664 | WebMetaDataHelper.getServlets | test | public static JBossServletsMetaData getServlets(final JBossWebMetaData jbossWebMD) {
JBossServletsMetaData servletsMD = jbossWebMD.getServlets();
if (servletsMD == null) {
servletsMD = new JBossServletsMetaData();
jbossWebMD.setServlets(servletsMD);
}
return servletsMD;
} | java | {
"resource": ""
} |
q172665 | WebMetaDataHelper.getServletMappings | test | public static List<ServletMappingMetaData> getServletMappings(final JBossWebMetaData jbossWebMD) {
List<ServletMappingMetaData> servletMappingsMD = jbossWebMD.getServletMappings();
if (servletMappingsMD == null) {
servletMappingsMD = new LinkedList<ServletMappingMetaData>();
jbossWebMD.setServletMappings(servletMappingsMD);
}
return servletMappingsMD;
} | java | {
"resource": ""
} |
q172666 | WebMetaDataHelper.getSecurityConstraints | test | public static List<SecurityConstraintMetaData> getSecurityConstraints(final JBossWebMetaData jbossWebMD) {
List<SecurityConstraintMetaData> securityConstraintsMD = jbossWebMD.getSecurityConstraints();
if (securityConstraintsMD == null) {
securityConstraintsMD = new LinkedList<SecurityConstraintMetaData>();
jbossWebMD.setSecurityConstraints(securityConstraintsMD);
}
return securityConstraintsMD;
} | java | {
"resource": ""
} |
q172667 | WebMetaDataHelper.getLoginConfig | test | public static LoginConfigMetaData getLoginConfig(final JBossWebMetaData jbossWebMD) {
LoginConfigMetaData loginConfigMD = jbossWebMD.getLoginConfig();
if (loginConfigMD == null) {
loginConfigMD = new LoginConfigMetaData();
jbossWebMD.setLoginConfig(loginConfigMD);
}
return loginConfigMD;
} | java | {
"resource": ""
} |
q172668 | WebMetaDataHelper.getContextParams | test | public static List<ParamValueMetaData> getContextParams(final JBossWebMetaData jbossWebMD) {
List<ParamValueMetaData> contextParamsMD = jbossWebMD.getContextParams();
if (contextParamsMD == null) {
contextParamsMD = new LinkedList<ParamValueMetaData>();
jbossWebMD.setContextParams(contextParamsMD);
}
return contextParamsMD;
} | java | {
"resource": ""
} |
q172669 | WebMetaDataHelper.getWebResourceCollections | test | public static WebResourceCollectionsMetaData getWebResourceCollections(final SecurityConstraintMetaData securityConstraintMD) {
WebResourceCollectionsMetaData webResourceCollectionsMD = securityConstraintMD.getResourceCollections();
if (webResourceCollectionsMD == null) {
webResourceCollectionsMD = new WebResourceCollectionsMetaData();
securityConstraintMD.setResourceCollections(webResourceCollectionsMD);
}
return webResourceCollectionsMD;
} | java | {
"resource": ""
} |
q172670 | WebMetaDataHelper.getServletInitParams | test | public static List<ParamValueMetaData> getServletInitParams(final ServletMetaData servletMD) {
List<ParamValueMetaData> initParamsMD = servletMD.getInitParam();
if (initParamsMD == null) {
initParamsMD = new LinkedList<ParamValueMetaData>();
servletMD.setInitParam(initParamsMD);
}
return initParamsMD;
} | java | {
"resource": ""
} |
q172671 | WebMetaDataHelper.newSecurityConstraint | test | public static SecurityConstraintMetaData newSecurityConstraint(final List<SecurityConstraintMetaData> securityConstraintsMD) {
final SecurityConstraintMetaData securityConstraintMD = new SecurityConstraintMetaData();
securityConstraintsMD.add(securityConstraintMD);
return securityConstraintMD;
} | java | {
"resource": ""
} |
q172672 | WebMetaDataHelper.newWebResourceCollection | test | public static WebResourceCollectionMetaData newWebResourceCollection(final String servletName, final String urlPattern,
final boolean securedWsdl, final WebResourceCollectionsMetaData webResourceCollectionsMD) {
final WebResourceCollectionMetaData webResourceCollectionMD = new WebResourceCollectionMetaData();
webResourceCollectionMD.setWebResourceName(servletName);
webResourceCollectionMD.setUrlPatterns(WebMetaDataHelper.getUrlPatterns(urlPattern));
webResourceCollectionMD.setHttpMethods(WebMetaDataHelper.getHttpMethods(securedWsdl));
webResourceCollectionsMD.add(webResourceCollectionMD);
return webResourceCollectionMD;
} | java | {
"resource": ""
} |
q172673 | WebMetaDataHelper.newServlet | test | public static JBossServletMetaData newServlet(final String servletName, final String servletClass,
final JBossServletsMetaData servletsMD) {
final JBossServletMetaData servletMD = new JBossServletMetaData();
servletMD.setServletName(servletName);
servletMD.setServletClass(servletClass);
servletsMD.add(servletMD);
return servletMD;
} | java | {
"resource": ""
} |
q172674 | WebMetaDataHelper.newServletMapping | test | public static ServletMappingMetaData newServletMapping(final String servletName, final List<String> urlPatterns,
final List<ServletMappingMetaData> servletMappingsMD) {
final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData();
servletMappingMD.setServletName(servletName);
servletMappingMD.setUrlPatterns(urlPatterns);
servletMappingsMD.add(servletMappingMD);
return servletMappingMD;
} | java | {
"resource": ""
} |
q172675 | WebMetaDataHelper.newAuthConstraint | test | public static AuthConstraintMetaData newAuthConstraint(final List<String> roleNames,
final SecurityConstraintMetaData securityConstraintMD) {
final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData();
authConstraintMD.setRoleNames(roleNames);
securityConstraintMD.setAuthConstraint(authConstraintMD);
return authConstraintMD;
} | java | {
"resource": ""
} |
q172676 | WebMetaDataHelper.newUserDataConstraint | test | public static UserDataConstraintMetaData newUserDataConstraint(final String transportGuarantee,
final SecurityConstraintMetaData securityConstraintMD) {
final UserDataConstraintMetaData userDataConstraintMD = new UserDataConstraintMetaData();
final TransportGuaranteeType transportGuaranteeValue = TransportGuaranteeType.valueOf(transportGuarantee);
userDataConstraintMD.setTransportGuarantee(transportGuaranteeValue);
securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
return userDataConstraintMD;
} | java | {
"resource": ""
} |
q172677 | WebMetaDataHelper.newParamValue | test | public static ParamValueMetaData newParamValue(final String key, final String value, final List<ParamValueMetaData> paramsMD) {
final ParamValueMetaData paramValueMD = WebMetaDataHelper.newParamValue(key, value);
paramsMD.add(paramValueMD);
return paramValueMD;
} | java | {
"resource": ""
} |
q172678 | WebMetaDataHelper.newParamValue | test | private static ParamValueMetaData newParamValue(final String key, final String value) {
final ParamValueMetaData paramMD = new ParamValueMetaData();
paramMD.setParamName(key);
paramMD.setParamValue(value);
return paramMD;
} | java | {
"resource": ""
} |
q172679 | JPAInterceptorProcessor.registerSessionBeanInterceptors | test | private void registerSessionBeanInterceptors(SessionBeanComponentDescription componentDescription, final DeploymentUnit deploymentUnit) {
// if it's a SFSB then setup appropriate interceptors
if (componentDescription.isStateful()) {
// first setup the post construct and pre destroy component interceptors
componentDescription.getConfigurators().addFirst(new ComponentConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws
DeploymentUnitProcessingException {
configuration.addPostConstructInterceptor(SFSBPreCreateInterceptor.FACTORY, InterceptorOrder.ComponentPostConstruct.JPA_SFSB_PRE_CREATE);
configuration.addPostConstructInterceptor(SFSBCreateInterceptor.FACTORY, InterceptorOrder.ComponentPostConstruct.JPA_SFSB_CREATE);
configuration.addPreDestroyInterceptor(SFSBDestroyInterceptor.FACTORY, InterceptorOrder.ComponentPreDestroy.JPA_SFSB_DESTROY);
configuration.addComponentInterceptor(SFSBInvocationInterceptor.FACTORY, InterceptorOrder.Component.JPA_SFSB_INTERCEPTOR, false);
//we need to serialized the entity manager state
configuration.getInterceptorContextKeys().add(SFSBInvocationInterceptor.CONTEXT_KEY);
}
});
}
// register interceptor on stateful/stateless SB with transactional entity manager.
if ((componentDescription.isStateful() || componentDescription.isStateless())) {
componentDescription.getConfigurators().add(new ComponentConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws
DeploymentUnitProcessingException {
configuration.addComponentInterceptor(SBInvocationInterceptor.FACTORY, InterceptorOrder.Component.JPA_SESSION_BEAN_INTERCEPTOR, false);
}
});
}
} | java | {
"resource": ""
} |
q172680 | AbstractDeploymentDescriptorBindingsProcessor.processInjectionTargets | test | protected Class<?> processInjectionTargets(final ResourceInjectionTarget resourceInjectionTarget, InjectionSource injectionSource, ClassLoader classLoader, DeploymentReflectionIndex deploymentReflectionIndex, ResourceInjectionMetaData entry, Class<?> classType) throws DeploymentUnitProcessingException {
if (entry.getInjectionTargets() != null) {
for (ResourceInjectionTargetMetaData injectionTarget : entry.getInjectionTargets()) {
final String injectionTargetClassName = injectionTarget.getInjectionTargetClass();
final String injectionTargetName = injectionTarget.getInjectionTargetName();
final AccessibleObject fieldOrMethod = getInjectionTarget(injectionTargetClassName, injectionTargetName, classLoader, deploymentReflectionIndex);
final Class<?> injectionTargetType = fieldOrMethod instanceof Field ? ((Field) fieldOrMethod).getType() : ((Method) fieldOrMethod).getParameterTypes()[0];
final String memberName = fieldOrMethod instanceof Field ? ((Field) fieldOrMethod).getName() : ((Method) fieldOrMethod).getName();
if (classType != null) {
if (!injectionTargetType.isAssignableFrom(classType)) {
boolean ok = false;
if (classType.isPrimitive()) {
if (BOXED_TYPES.get(classType).equals(injectionTargetType)) {
ok = true;
}
} else if (injectionTargetType.isPrimitive()) {
if (BOXED_TYPES.get(injectionTargetType).equals(classType)) {
ok = true;
}
}
if (!ok) {
throw EeLogger.ROOT_LOGGER.invalidInjectionTarget(injectionTarget.getInjectionTargetName(), injectionTarget.getInjectionTargetClass(), classType);
}
classType = injectionTargetType;
}
} else {
classType = injectionTargetType;
}
final InjectionTarget injectionTargetDescription = fieldOrMethod instanceof Field ?
new FieldInjectionTarget(injectionTargetClassName, memberName, classType.getName()) :
new MethodInjectionTarget(injectionTargetClassName, memberName, classType.getName());
final ResourceInjectionConfiguration injectionConfiguration = new ResourceInjectionConfiguration(injectionTargetDescription, injectionSource);
resourceInjectionTarget.addResourceInjection(injectionConfiguration);
}
}
return classType;
} | java | {
"resource": ""
} |
q172681 | WeldStartService.stop | test | @Override
public void stop(final StopContext context) {
final WeldBootstrapService bootstrapService = bootstrapSupplier.get();
if (!bootstrapService.isStarted()) {
throw WeldLogger.ROOT_LOGGER.notStarted("WeldContainer");
}
WeldLogger.DEPLOYMENT_LOGGER.stoppingWeldService(bootstrapService.getDeploymentName());
ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(bootstrapService.getDeployment().getModule().getClassLoader());
WeldProvider.containerShutDown(Container.instance(bootstrapService.getDeploymentName()));
bootstrapService.getBootstrap().shutdown();
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
ModuleGroupSingletonProvider.removeClassLoader(bootstrapService.getDeployment().getModule().getClassLoader());
}
bootstrapService.setStarted(false);
} | java | {
"resource": ""
} |
q172682 | Util.getJndiName | test | public static String getJndiName(final OperationContext context, final ModelNode modelNode) throws OperationFailedException {
final String rawJndiName = JNDI_NAME.resolveModelAttribute(context, modelNode).asString();
return cleanJndiName(rawJndiName, modelNode.hasDefined(USE_JAVA_CONTEXT.getName()) && modelNode.get(USE_JAVA_CONTEXT.getName()).asBoolean());
} | java | {
"resource": ""
} |
q172683 | JMSBridgeAdd.resolveAttribute | test | private String resolveAttribute(SimpleAttributeDefinition attr, OperationContext context, ModelNode model) throws OperationFailedException {
final ModelNode node = attr.resolveModelAttribute(context, model);
return node.isDefined() ? node.asString() : null;
} | java | {
"resource": ""
} |
q172684 | WarJACCService.getPatternType | test | static int getPatternType(String urlPattern) {
int type = EXACT;
if (urlPattern.startsWith("*."))
type = EXTENSION;
else if (urlPattern.startsWith("/") && urlPattern.endsWith("/*"))
type = PREFIX;
else if (urlPattern.equals("/"))
type = DEFAULT;
return type;
} | java | {
"resource": ""
} |
q172685 | JMSConnectionFactoryDefinitionInjectionSource.targetsPooledConnectionFactory | test | static boolean targetsPooledConnectionFactory(String server, String resourceAdapter, ServiceRegistry serviceRegistry) {
// if the resourceAdapter is not defined, the default behaviour is to create a pooled-connection-factory.
if (resourceAdapter == null || resourceAdapter.isEmpty()) {
return true;
}
ServiceName activeMQServiceName = MessagingServices.getActiveMQServiceName(server);
ServiceName pcfName = JMSServices.getPooledConnectionFactoryBaseServiceName(activeMQServiceName).append(resourceAdapter);
return serviceRegistry.getServiceNames().contains(pcfName);
} | java | {
"resource": ""
} |
q172686 | JMSConnectionFactoryDefinitionInjectionSource.targetsExternalPooledConnectionFactory | test | static boolean targetsExternalPooledConnectionFactory(String resourceAdapter, ServiceRegistry serviceRegistry) {
// if the resourceAdapter is not defined, the default behaviour is to create a pooled-connection-factory.
if (resourceAdapter == null || resourceAdapter.isEmpty()) {
return false;
}
//let's look into the external-pooled-connection-factory
ServiceName pcfName = JMSServices.getPooledConnectionFactoryBaseServiceName(MessagingServices.getActiveMQServiceName("")).append(resourceAdapter);
return serviceRegistry.getServiceNames().contains(pcfName);
} | java | {
"resource": ""
} |
q172687 | JMSConnectionFactoryDefinitionInjectionSource.getActiveMQServerName | test | static String getActiveMQServerName(Map<String, String> properties) {
return properties.getOrDefault(SERVER, DEFAULT);
} | java | {
"resource": ""
} |
q172688 | PersistenceUnitSearch.defaultPersistenceUnitName | test | private static String defaultPersistenceUnitName(String persistenceUnitName, PersistenceUnitMetadataHolder holder) {
if ((persistenceUnitName == null || persistenceUnitName.length() == 0)) {
for (PersistenceUnitMetadata persistenceUnit : holder.getPersistenceUnits()) {
String defaultPU = persistenceUnit.getProperties().getProperty(Configuration.JPA_DEFAULT_PERSISTENCE_UNIT);
if(Boolean.TRUE.toString().equals(defaultPU)) {
persistenceUnitName = persistenceUnit.getPersistenceUnitName();
}
}
}
return persistenceUnitName;
} | java | {
"resource": ""
} |
q172689 | EJBSuspendHandlerService.start | test | public void start(StartContext context) {
final SuspendController suspendController = suspendControllerInjectedValue.getValue();
suspendController.registerActivity(this);
final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue.getValue();
localTransactionContext.registerCreationListener(this);
} | java | {
"resource": ""
} |
q172690 | EJBSuspendHandlerService.stop | test | public void stop(StopContext context) {
final SuspendController suspendController = suspendControllerInjectedValue.getValue();
suspendController.unRegisterActivity(this);
final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue.getValue();
localTransactionContext.removeCreationListener(this);
} | java | {
"resource": ""
} |
q172691 | EJBSuspendHandlerService.suspended | test | @Override public void suspended(ServerActivityCallback listener) {
this.suspended = true;
listenerUpdater.set(this, listener);
localTransactionContextInjectedValue.getValue().suspendRequests();
final int activeInvocationCount = activeInvocationCountUpdater.get(this);
if (activeInvocationCount == 0) {
if (gracefulTxnShutdown) {
if (activeTransactionCountUpdater.get(this) == 0) {
this.doneSuspended();
} else {
EjbLogger.ROOT_LOGGER.suspensionWaitingActiveTransactions(activeInvocationCount);
}
} else {
this.doneSuspended();
}
}
} | java | {
"resource": ""
} |
q172692 | EJBSuspendHandlerService.resume | test | @Override public void resume() {
this.suspended = false;
localTransactionContextInjectedValue.getValue().resumeRequests();
ServerActivityCallback listener = listenerUpdater.get(this);
if (listener != null) {
listenerUpdater.compareAndSet(this, listener, null);
}
deploymentRepositoryInjectedValue.getValue().resume();
} | java | {
"resource": ""
} |
q172693 | EJBSuspendHandlerService.invocationComplete | test | public void invocationComplete() {
int activeInvocations = activeInvocationCountUpdater.decrementAndGet(this);
if (suspended && activeInvocations == 0 && (!gracefulTxnShutdown || (activeTransactionCountUpdater.get(this) == 0))) {
doneSuspended();
}
} | java | {
"resource": ""
} |
q172694 | EJBSuspendHandlerService.transactionCreated | test | @Override public void transactionCreated(AbstractTransaction transaction, CreatedBy createdBy) {
activeTransactionCountUpdater.incrementAndGet(this);
try {
transaction.registerSynchronization(this);
} catch (RollbackException | IllegalStateException e) {
// it means the transaction is marked for rollback, or is prepared for commit, at this point we cannot register synchronization
decrementTransactionCount();
} catch (SystemException e) {
decrementTransactionCount();
EjbLogger.ROOT_LOGGER.debug("Unexpected exception", e);
throw new RuntimeException(e);
}
} | java | {
"resource": ""
} |
q172695 | BinderService.start | test | public void start(StartContext context) throws StartException {
final ServiceBasedNamingStore namingStore = namingStoreValue.getValue();
controller = context.getController();
namingStore.add(controller.getName());
ROOT_LOGGER.tracef("Bound resource %s into naming store %s (service name %s)", name, namingStore, controller.getName());
} | java | {
"resource": ""
} |
q172696 | BinderService.stop | test | public void stop(StopContext context) {
final ServiceBasedNamingStore namingStore = namingStoreValue.getValue();
namingStore.remove(controller.getName());
ROOT_LOGGER.tracef("Unbound resource %s into naming store %s (service name %s)", name, namingStore, context.getController().getName());
} | java | {
"resource": ""
} |
q172697 | MessagingServices.getCapabilityServiceName | test | public static ServiceName getCapabilityServiceName(String capabilityBaseName, String... dynamicParts) {
if (capabilityServiceSupport == null) {
throw new IllegalStateException();
}
if (dynamicParts == null || dynamicParts.length == 0) {
return capabilityServiceSupport.getCapabilityServiceName(capabilityBaseName);
}
return capabilityServiceSupport.getCapabilityServiceName(capabilityBaseName, dynamicParts);
} | java | {
"resource": ""
} |
q172698 | WarStructureDeploymentProcessor.createResourceRoots | test | private List<ResourceRoot> createResourceRoots(final VirtualFile deploymentRoot, final DeploymentUnit deploymentUnit) throws IOException, DeploymentUnitProcessingException {
final List<ResourceRoot> entries = new ArrayList<ResourceRoot>();
// WEB-INF classes
final VirtualFile webinfClasses = deploymentRoot.getChild(WEB_INF_CLASSES);
if (webinfClasses.exists()) {
final ResourceRoot webInfClassesRoot = new ResourceRoot(webinfClasses.getName(), webinfClasses, null);
ModuleRootMarker.mark(webInfClassesRoot);
entries.add(webInfClassesRoot);
}
// WEB-INF lib
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
final VirtualFile webinfLib = deploymentRoot.getChild(WEB_INF_LIB);
if (webinfLib.exists()) {
final List<VirtualFile> archives = webinfLib.getChildren(DEFAULT_WEB_INF_LIB_FILTER);
for (final VirtualFile archive : archives) {
try {
String relativeName = archive.getPathNameRelativeTo(deploymentRoot);
MountedDeploymentOverlay overlay = overlays.get(relativeName);
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if (archive.isFile()) {
closable = VFS.mountZip(archive, archive, TempFileProviderService.provider());
} else {
closable = null;
}
final ResourceRoot webInfArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
ModuleRootMarker.mark(webInfArchiveRoot);
entries.add(webInfArchiveRoot);
} catch (IOException e) {
throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToProcessWebInfLib(archive), e);
}
}
}
return entries;
} | java | {
"resource": ""
} |
q172699 | PersistenceProviderHandler.allDeploymentModuleClassLoaders | test | private static Set<ClassLoader> allDeploymentModuleClassLoaders(DeploymentUnit deploymentUnit) {
Set<ClassLoader> deploymentClassLoaders = new HashSet<ClassLoader>();
final DeploymentUnit topDeploymentUnit = DeploymentUtils.getTopDeploymentUnit(deploymentUnit);
final Module toplevelModule = topDeploymentUnit.getAttachment(Attachments.MODULE);
if (toplevelModule != null) {
deploymentClassLoaders.add(toplevelModule.getClassLoader());
final List<DeploymentUnit> subDeployments = topDeploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS);
for (DeploymentUnit subDeploymentUnit: subDeployments) {
final Module subDeploymentModule = subDeploymentUnit.getAttachment(Attachments.MODULE);
if (subDeploymentModule != null) {
deploymentClassLoaders.add(subDeploymentModule.getClassLoader());
}
}
}
return deploymentClassLoaders;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.