_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q172800 | EJBComponentDescription.getAllContainerInterceptors | test | public Set<InterceptorDescription> getAllContainerInterceptors() {
if (this.allContainerInterceptors == null) {
this.allContainerInterceptors = new HashSet<InterceptorDescription>();
this.allContainerInterceptors.addAll(this.classLevelContainerInterceptors);
if (!this.excludeDefaultContainerInterceptors) {
this.allContainerInterceptors.addAll(this.defaultContainerInterceptors);
}
for (List<InterceptorDescription> interceptors : this.methodLevelContainerInterceptors.values()) {
this.allContainerInterceptors.addAll(interceptors);
}
}
return this.allContainerInterceptors;
} | java | {
"resource": ""
} |
q172801 | ApplicableMethodInformation.isMethodLevel | test | public boolean isMethodLevel(MethodIntf methodIntf, Method method, MethodIntf defaultMethodIntf) {
assert methodIntf != null : "methodIntf is null";
assert method != null : "method is null";
Method classMethod = resolveRealMethod(method);
String[] methodParams = MethodInfoHelper.getCanonicalParameterTypes(classMethod);
final String methodName = classMethod.getName();
final String className = classMethod.getDeclaringClass().getName();
ArrayKey methodParamsKey = new ArrayKey((Object[]) methodParams);
T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey);
if (attr != null)
return true;
attr = get(get(perViewStyle2, methodIntf), methodName);
if (attr != null)
return true;
attr = get(perViewStyle1, methodIntf);
if (attr != null)
return false;
attr = get(get(get(style3, className), methodName), methodParamsKey);
if (attr != null)
return true;
attr = get(style2, methodName);
if (attr != null)
return true;
attr = get(style1, className);
if (attr != null)
return false;
if(defaultMethodIntf == null) {
return false;
} else {
return isMethodLevel(defaultMethodIntf, method, null);
}
} | java | {
"resource": ""
} |
q172802 | MessagingSubsystemParser.checkOnlyOneOfElements | test | protected static void checkOnlyOneOfElements(XMLExtendedStreamReader reader, Set<Element> seen, Element element1, Element element2) throws XMLStreamException {
if (!seen.contains(element1) && !seen.contains(element2)) {
throw new XMLStreamException(MessagingLogger.ROOT_LOGGER.required(element1.getLocalName(), element2.getLocalName()), reader.getLocation());
}
if (seen.contains(element1) && seen.contains(element2)) {
throw new XMLStreamException(MessagingLogger.ROOT_LOGGER.onlyOneRequired(element1.getLocalName(), element2.getLocalName()), reader.getLocation());
}
} | java | {
"resource": ""
} |
q172803 | AbstractConfigVisitorNode.getType | test | protected static Class<?> getType(ConfigVisitor visitor, String className) {
if (className != null) {
try {
return visitor.getModule().getClassLoader().loadClass(className);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
return null;
} | java | {
"resource": ""
} |
q172804 | AbstractConfigVisitorNode.getComponentType | test | static Type getComponentType(ParameterizedType type, int index) {
Type[] tp = type.getActualTypeArguments();
if (index + 1 > tp.length)
return null;
return tp[index];
} | java | {
"resource": ""
} |
q172805 | ElytronIntegrationResourceDefinitions.getElytronKeyStoreResourceDefinition | test | public static ResourceDefinition getElytronKeyStoreResourceDefinition() {
final AttributeDefinition[] attributes = new AttributeDefinition[] {LEGACY_JSSE_CONFIG};
final AbstractAddStepHandler addHandler = new BasicAddHandler<KeyStore>(attributes, KEY_STORE_RUNTIME_CAPABILITY) {
@Override
protected BasicService.ValueSupplier<KeyStore> getValueSupplier(ServiceBuilder<KeyStore> serviceBuilder, OperationContext context, ModelNode model) throws OperationFailedException {
final String legacyJSSEConfig = asStringIfDefined(context, LEGACY_JSSE_CONFIG, model);
final InjectedValue<SecurityDomainContext> securityDomainContextInjector = new InjectedValue<>();
if (legacyJSSEConfig != null) {
serviceBuilder.addDependency(SecurityDomainService.SERVICE_NAME.append(legacyJSSEConfig), SecurityDomainContext.class, securityDomainContextInjector);
}
return () -> {
final SecurityDomainContext domainContext = securityDomainContextInjector.getValue();
final JSSESecurityDomain jsseDomain = domainContext.getJSSE();
if (jsseDomain == null) {
throw SecurityLogger.ROOT_LOGGER.unableToLocateJSSEConfig(legacyJSSEConfig);
}
final KeyStore keyStore = jsseDomain.getKeyStore();
if (keyStore == null) {
throw SecurityLogger.ROOT_LOGGER.unableToLocateComponentInJSSEDomain("KeyStore", legacyJSSEConfig);
}
return keyStore;
};
}
};
return new BasicResourceDefinition(Constants.ELYTRON_KEY_STORE, addHandler, attributes, KEY_STORE_RUNTIME_CAPABILITY);
} | java | {
"resource": ""
} |
q172806 | ElytronIntegrationResourceDefinitions.getElytronKeyManagersResourceDefinition | test | public static ResourceDefinition getElytronKeyManagersResourceDefinition() {
final AttributeDefinition[] attributes = new AttributeDefinition[] {LEGACY_JSSE_CONFIG};
final AbstractAddStepHandler addHandler = new BasicAddHandler<KeyManager>(attributes, KEY_MANAGER_RUNTIME_CAPABILITY) {
@Override
protected BasicService.ValueSupplier<KeyManager> getValueSupplier(ServiceBuilder<KeyManager> serviceBuilder, OperationContext context, ModelNode model) throws OperationFailedException {
final String legacyJSSEConfig = asStringIfDefined(context, LEGACY_JSSE_CONFIG, model);
final InjectedValue<SecurityDomainContext> securityDomainContextInjector = new InjectedValue<>();
if (legacyJSSEConfig != null) {
serviceBuilder.addDependency(SecurityDomainService.SERVICE_NAME.append(legacyJSSEConfig), SecurityDomainContext.class, securityDomainContextInjector);
}
return () -> {
final SecurityDomainContext domainContext = securityDomainContextInjector.getValue();
final JSSESecurityDomain jsseDomain = domainContext.getJSSE();
if (jsseDomain == null) {
throw SecurityLogger.ROOT_LOGGER.unableToLocateJSSEConfig(legacyJSSEConfig);
}
final KeyManager[] keyManagers = jsseDomain.getKeyManagers();
if (keyManagers == null) {
throw SecurityLogger.ROOT_LOGGER.unableToLocateComponentInJSSEDomain("KeyManager", legacyJSSEConfig);
}
for (KeyManager keyManager : keyManagers) {
if (keyManager instanceof X509ExtendedKeyManager) {
return keyManager;
}
}
throw SecurityLogger.ROOT_LOGGER.expectedManagerTypeNotFound("KeyManager", X509ExtendedKeyManager.class.getSimpleName(), legacyJSSEConfig);
};
}
};
return new BasicResourceDefinition(Constants.ELYTRON_KEY_MANAGER, addHandler, attributes, KEY_MANAGER_RUNTIME_CAPABILITY);
} | java | {
"resource": ""
} |
q172807 | ElytronIntegrationResourceDefinitions.getElytronTrustManagersResourceDefinition | test | public static ResourceDefinition getElytronTrustManagersResourceDefinition() {
final AttributeDefinition[] attributes = new AttributeDefinition[] {LEGACY_JSSE_CONFIG};
final AbstractAddStepHandler addHandler = new BasicAddHandler<TrustManager>(attributes, TRUST_MANAGER_RUNTIME_CAPABILITY) {
@Override
protected BasicService.ValueSupplier<TrustManager> getValueSupplier(ServiceBuilder<TrustManager> serviceBuilder, OperationContext context, ModelNode model) throws OperationFailedException {
final String legacyJSSEConfig = asStringIfDefined(context, LEGACY_JSSE_CONFIG, model);
final InjectedValue<SecurityDomainContext> securityDomainContextInjector = new InjectedValue<>();
if (legacyJSSEConfig != null) {
serviceBuilder.addDependency(SecurityDomainService.SERVICE_NAME.append(legacyJSSEConfig), SecurityDomainContext.class, securityDomainContextInjector);
}
return () -> {
final SecurityDomainContext domainContext = securityDomainContextInjector.getValue();
final JSSESecurityDomain jsseDomain = domainContext.getJSSE();
if (jsseDomain == null) {
throw SecurityLogger.ROOT_LOGGER.unableToLocateJSSEConfig(legacyJSSEConfig);
}
final TrustManager[] trustManagers = jsseDomain.getTrustManagers();
if (trustManagers == null) {
throw SecurityLogger.ROOT_LOGGER.unableToLocateComponentInJSSEDomain("TrustManager", legacyJSSEConfig);
}
for (TrustManager trustManager : trustManagers) {
if (trustManager instanceof X509ExtendedTrustManager)
return trustManager;
}
throw SecurityLogger.ROOT_LOGGER.expectedManagerTypeNotFound("TrustManager", X509ExtendedTrustManager.class.getSimpleName(), legacyJSSEConfig);
};
}
};
return new BasicResourceDefinition(Constants.ELYTRON_TRUST_MANAGER, addHandler, attributes, TRUST_MANAGER_RUNTIME_CAPABILITY);
} | java | {
"resource": ""
} |
q172808 | CNNameParser.parse | test | public Name parse(String name) throws NamingException {
Vector comps = insStringToStringifiedComps(name);
return new CNCompoundName(comps.elements());
} | java | {
"resource": ""
} |
q172809 | CNNameParser.insStringToStringifiedComps | test | private static Vector insStringToStringifiedComps(String str)
throws InvalidNameException {
int len = str.length();
Vector components = new Vector(10);
char[] id = new char[len];
char[] kind = new char[len];
int idCount, kindCount;
boolean idMode;
for (int i = 0; i < len; ) {
idCount = kindCount = 0; // reset for new component
idMode = true; // always start off parsing id
while (i < len) {
if (str.charAt(i) == compSeparator) {
break;
} else if (str.charAt(i) == escapeChar) {
if (i + 1 >= len) {
throw IIOPLogger.ROOT_LOGGER.unescapedCharacter(str);
} else if (isMeta(str.charAt(i + 1))) {
++i; // skip escape and let meta through
if (idMode) {
id[idCount++] = str.charAt(i++);
} else {
kind[kindCount++] = str.charAt(i++);
}
} else {
throw IIOPLogger.ROOT_LOGGER.invalidEscapedCharacter(str);
}
} else if (idMode && str.charAt(i) == kindSeparator) {
// just look for the first kindSeparator
++i; // skip kind separator
idMode = false;
} else {
if (idMode) {
id[idCount++] = str.charAt(i++);
} else {
kind[kindCount++] = str.charAt(i++);
}
}
}
components.addElement(stringifyComponent(
new NameComponent(new String(id, 0, idCount),
new String(kind, 0, kindCount))));
if (i < len) {
++i; // skip separator
}
}
return components;
} | java | {
"resource": ""
} |
q172810 | CNNameParser.parseComponent | test | private static NameComponent parseComponent(String compStr)
throws InvalidNameException {
NameComponent comp = new NameComponent();
int kindSep = -1;
int len = compStr.length();
int j = 0;
char[] newStr = new char[len];
boolean escaped = false;
// Find the kind separator
for (int i = 0; i < len && kindSep < 0; i++) {
if (escaped) {
newStr[j++] = compStr.charAt(i);
escaped = false;
} else if (compStr.charAt(i) == escapeChar) {
if (i + 1 >= len) {
throw IIOPLogger.ROOT_LOGGER.unescapedCharacter(compStr);
} else if (isMeta(compStr.charAt(i + 1))) {
escaped = true;
} else {
throw IIOPLogger.ROOT_LOGGER.invalidEscapedCharacter(compStr);
}
} else if (compStr.charAt(i) == kindSeparator) {
kindSep = i;
} else {
newStr[j++] = compStr.charAt(i);
}
}
// Set id
comp.id = new String(newStr, 0, j);
// Set kind
if (kindSep < 0) {
comp.kind = ""; // no kind separator
} else {
// unescape kind
j = 0;
escaped = false;
for (int i = kindSep + 1; i < len; i++) {
if (escaped) {
newStr[j++] = compStr.charAt(i);
escaped = false;
} else if (compStr.charAt(i) == escapeChar) {
if (i + 1 >= len) {
throw IIOPLogger.ROOT_LOGGER.unescapedCharacter(compStr);
} else if (isMeta(compStr.charAt(i + 1))) {
escaped = true;
} else {
throw IIOPLogger.ROOT_LOGGER.invalidEscapedCharacter(compStr);
}
} else {
newStr[j++] = compStr.charAt(i);
}
}
comp.kind = new String(newStr, 0, j);
}
return comp;
} | java | {
"resource": ""
} |
q172811 | IRObjectImpl.shutdown | test | public void shutdown() {
POA poa = getPOA();
try {
poa.deactivate_object(poa.reference_to_id(getReference()));
} catch (UserException ex) {
IIOPLogger.ROOT_LOGGER.warnCouldNotDeactivateIRObject(ex);
}
} | java | {
"resource": ""
} |
q172812 | IRObjectImpl.servantToReference | test | protected org.omg.CORBA.Object servantToReference(Servant servant) {
byte[] id = getObjectId();
try {
repository.poa.activate_object_with_id(id, servant);
org.omg.CORBA.Object ref = repository.poa.id_to_reference(id);
return ref;
} catch (WrongPolicy ex) {
IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex);
} catch (ServantAlreadyActive ex) {
IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex);
} catch (ObjectAlreadyActive ex) {
IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex);
} catch (ObjectNotActive ex) {
IIOPLogger.ROOT_LOGGER.debug("Exception converting CORBA servant to reference", ex);
}
return null;
} | java | {
"resource": ""
} |
q172813 | ElytronSecurityManager.authenticate | test | private SecurityIdentity authenticate(final String username, final String password) {
ServerAuthenticationContext context = this.securityDomain.createNewAuthenticationContext();
PasswordGuessEvidence evidence = null;
try {
if (password == null) {
if (username == null) {
if (context.authorizeAnonymous()) {
context.succeed();
return context.getAuthorizedIdentity();
} else {
context.fail();
return null;
}
} else {
// treat a non-null user name with a null password as a auth failure
context.fail();
return null;
}
}
context.setAuthenticationName(username);
evidence = new PasswordGuessEvidence(password.toCharArray());
if (context.verifyEvidence(evidence)) {
if (context.authorize()) {
context.succeed();
return context.getAuthorizedIdentity();
}
else {
context.fail();
MessagingLogger.ROOT_LOGGER.failedAuthorization(username);
}
} else {
context.fail();
MessagingLogger.ROOT_LOGGER.failedAuthentication(username);
}
} catch (IllegalArgumentException | IllegalStateException | RealmUnavailableException e) {
context.fail();
MessagingLogger.ROOT_LOGGER.failedAuthenticationWithException(e, username, e.getMessage());
} finally {
if (evidence != null) {
evidence.destroy();
}
}
return null;
} | java | {
"resource": ""
} |
q172814 | GetDataSourceClassInfoOperationHandler.isTypeMatched | test | private static boolean isTypeMatched(Class<?> clz) {
if (clz.equals(String.class)) {
return true;
} else if (clz.equals(byte.class) || clz.equals(Byte.class)) {
return true;
} else if (clz.equals(short.class) || clz.equals(Short.class)) {
return true;
} else if (clz.equals(int.class) || clz.equals(Integer.class)) {
return true;
} else if (clz.equals(long.class) || clz.equals(Long.class)) {
return true;
} else if (clz.equals(float.class) || clz.equals(Float.class)) {
return true;
} else if (clz.equals(double.class) || clz.equals(Double.class)) {
return true;
} else if (clz.equals(boolean.class) || clz.equals(Boolean.class)) {
return true;
} else if (clz.equals(char.class) || clz.equals(Character.class)) {
return true;
} else if (clz.equals(InetAddress.class)) {
return true;
} else if (clz.equals(Class.class)) {
return true;
} else if (clz.equals(Properties.class)) {
return true;
}
return false;
} | java | {
"resource": ""
} |
q172815 | WildFlyBindingRegistry.lookup | test | @Override
public Object lookup(String name) {
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name);
ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName());
if (bindingService == null) {
return null;
}
ManagedReferenceFactory managedReferenceFactory = ManagedReferenceFactory.class.cast(bindingService.getValue());
return managedReferenceFactory.getReference().getInstance();
} | java | {
"resource": ""
} |
q172816 | WildFlyBindingRegistry.unbind | test | @Override
public void unbind(String name) {
if (name == null || name.isEmpty()) {
throw MessagingLogger.ROOT_LOGGER.cannotUnbindJndiName();
}
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name);
ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName());
if (bindingService == null) {
ROOT_LOGGER.debugf("Cannot unbind %s since no binding exists with that name", name);
return;
}
// remove the binding service
bindingService.setMode(ServiceController.Mode.REMOVE);
final StabilityMonitor monitor = new StabilityMonitor();
monitor.addController(bindingService);
try {
monitor.awaitStability();
ROOT_LOGGER.unboundJndiName(bindInfo.getAbsoluteJndiName());
} catch (InterruptedException e) {
ROOT_LOGGER.failedToUnbindJndiName(name, 5, SECONDS.toString().toLowerCase(Locale.US));
} finally {
monitor.removeController(bindingService);
}
} | java | {
"resource": ""
} |
q172817 | BeanUtils.instantiateBean | test | public static Object instantiateBean(BeanMetaDataConfig beanConfig, BeanInfo beanInfo, DeploymentReflectionIndex index, Module module) throws Throwable {
Joinpoint instantiateJoinpoint = null;
ValueConfig[] parameters = new ValueConfig[0];
String[] types = Configurator.NO_PARAMS_TYPES;
ConstructorConfig ctorConfig = beanConfig.getConstructor();
if (ctorConfig != null) {
parameters = ctorConfig.getParameters();
types = Configurator.getTypes(parameters);
String factoryClass = ctorConfig.getFactoryClass();
FactoryConfig factory = ctorConfig.getFactory();
if (factoryClass != null || factory != null) {
String factoryMethod = ctorConfig.getFactoryMethod();
if (factoryMethod == null)
throw PojoLogger.ROOT_LOGGER.missingFactoryMethod(beanConfig);
if (factoryClass != null) {
// static factory
Class<?> factoryClazz = Class.forName(factoryClass, false, module.getClassLoader());
Method method = Configurator.findMethod(index, factoryClazz, factoryMethod, types, true, true, true);
MethodJoinpoint mj = new MethodJoinpoint(method);
mj.setTarget(new ImmediateValue<Object>(null)); // null, since this is static call
mj.setParameters(parameters);
instantiateJoinpoint = mj;
} else if (factory != null) {
ReflectionJoinpoint rj = new ReflectionJoinpoint(factory.getBeanInfo(), factoryMethod, types);
// null type is ok, as this should be plain injection
rj.setTarget(new ImmediateValue<Object>(factory.getValue(null)));
rj.setParameters(parameters);
instantiateJoinpoint = rj;
}
}
}
// plain bean's ctor
if (instantiateJoinpoint == null) {
if (beanInfo == null)
throw new StartException(PojoLogger.ROOT_LOGGER.missingBeanInfo(beanConfig));
Constructor ctor = (types.length == 0) ? beanInfo.getConstructor() : beanInfo.findConstructor(types);
ConstructorJoinpoint constructorJoinpoint = new ConstructorJoinpoint(ctor);
constructorJoinpoint.setParameters(parameters);
instantiateJoinpoint = constructorJoinpoint;
}
return instantiateJoinpoint.dispatch();
} | java | {
"resource": ""
} |
q172818 | BeanUtils.configure | test | public static void configure(BeanMetaDataConfig beanConfig, BeanInfo beanInfo, Module module, Object bean, boolean nullify) throws Throwable {
Set<PropertyConfig> properties = beanConfig.getProperties();
if (properties != null) {
List<PropertyConfig> used = new ArrayList<PropertyConfig>();
for (PropertyConfig pc : properties) {
try {
configure(beanInfo, module, bean, pc, nullify);
used.add(pc);
} catch (Throwable t) {
if (nullify == false) {
for (PropertyConfig upc : used) {
try {
configure(beanInfo, module, bean,upc, true);
} catch (Throwable ignored) {
}
}
throw new StartException(t);
}
}
}
}
} | java | {
"resource": ""
} |
q172819 | BeanUtils.dispatchLifecycleJoinpoint | test | public static void dispatchLifecycleJoinpoint(BeanInfo beanInfo, Object bean, LifecycleConfig config, String defaultMethod) throws Throwable {
if (config != null && config.isIgnored())
return;
Joinpoint joinpoint = createJoinpoint(beanInfo, bean, config, defaultMethod);
if (joinpoint != null)
joinpoint.dispatch();
} | java | {
"resource": ""
} |
q172820 | NamespaceContextSelector.getCurrentSelector | test | public static NamespaceContextSelector getCurrentSelector() {
NamespaceContextSelector selector = currentSelector.peek();
if(selector != null) {
return selector;
}
return defaultSelector;
} | java | {
"resource": ""
} |
q172821 | BeanMetaDataConfig.toBeanName | test | public static ServiceName toBeanName(String name, BeanState state) {
if (state == null)
state = BeanState.INSTALLED;
return JBOSS_POJO.append(name).append(state.name());
} | java | {
"resource": ""
} |
q172822 | BeanMetaDataConfig.toInstancesName | test | public static ServiceName toInstancesName(Class<?> clazz, BeanState state) {
String clName;
ClassLoader classLoader = clazz.getClassLoader();
if (classLoader != null)
clName = classLoader.toString();
else
clName = "SystemClassLoader";
if (state == null)
state = BeanState.INSTALLED;
return JBOSS_POJO.append(clName, clazz.getName(), state.name());
} | java | {
"resource": ""
} |
q172823 | EEApplicationClasses.getClassByName | test | public EEModuleClassDescription getClassByName(String name) {
for(EEModuleDescription module : availableModules) {
final EEModuleClassDescription desc = module.getClassDescription(name);
if(desc != null) {
return desc;
}
}
return null;
} | java | {
"resource": ""
} |
q172824 | SessionBeanComponentDescriptionFactory.processAnnotations | test | @Override
protected void processAnnotations(final DeploymentUnit deploymentUnit, final CompositeIndex compositeIndex) throws DeploymentUnitProcessingException {
if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
return;
}
// Find and process any @Stateless bean annotations
final List<AnnotationInstance> slsbAnnotations = compositeIndex.getAnnotations(STATELESS_ANNOTATION);
if (!slsbAnnotations.isEmpty()) {
processSessionBeans(deploymentUnit, slsbAnnotations, SessionBeanComponentDescription.SessionBeanType.STATELESS);
}
// Find and process any @Stateful bean annotations
final List<AnnotationInstance> sfsbAnnotations = compositeIndex.getAnnotations(STATEFUL_ANNOTATION);
if (!sfsbAnnotations.isEmpty()) {
processSessionBeans(deploymentUnit, sfsbAnnotations, SessionBeanComponentDescription.SessionBeanType.STATEFUL);
}
// Find and process any @Singleton bean annotations
final List<AnnotationInstance> sbAnnotations = compositeIndex.getAnnotations(SINGLETON_ANNOTATION);
if (!sbAnnotations.isEmpty()) {
processSessionBeans(deploymentUnit, sbAnnotations, SessionBeanComponentDescription.SessionBeanType.SINGLETON);
}
} | java | {
"resource": ""
} |
q172825 | PersistenceUnitParseProcessor.postParseSteps | test | private void postParseSteps(
final VirtualFile persistence_xml,
final PersistenceUnitMetadataHolder puHolder,
final DeploymentUnit deploymentUnit ) {
for (PersistenceUnitMetadata pu : puHolder.getPersistenceUnits()) {
// set URLs
List<URL> jarfilesUrls = new ArrayList<URL>();
if (pu.getJarFiles() != null) {
for (String jar : pu.getJarFiles()) {
jarfilesUrls.add(getRelativeURL(persistence_xml, jar));
}
}
pu.setJarFileUrls(jarfilesUrls);
URL url = getPersistenceUnitURL(persistence_xml);
pu.setPersistenceUnitRootUrl(url);
String scopedPersistenceUnitName;
/**
* WFLY-5478 allow custom scoped persistence unit name hint in persistence unit definition.
* Specified scoped persistence unit name needs to be unique across application server deployments.
* Application is responsible for picking a unique name.
* Currently, a non-unique name will result in a DuplicateServiceException deployment failure:
* org.jboss.msc.service.DuplicateServiceException: Service jboss.persistenceunit.my2lccustom#test_pu.__FIRST_PHASE__ is already registered
*/
scopedPersistenceUnitName = Configuration.getScopedPersistenceUnitName(pu);
if (scopedPersistenceUnitName == null) {
scopedPersistenceUnitName = createBeanName(deploymentUnit, pu.getPersistenceUnitName());
} else {
ROOT_LOGGER.tracef("persistence unit '%s' specified a custom scoped persistence unit name hint " +
"(jboss.as.jpa.scopedname=%s). The specified name *must* be unique across all application server deployments.",
pu.getPersistenceUnitName(),
scopedPersistenceUnitName);
if (scopedPersistenceUnitName.indexOf('/') != -1) {
throw JpaLogger.ROOT_LOGGER.invalidScopedName(scopedPersistenceUnitName, '/');
}
}
pu.setScopedPersistenceUnitName(scopedPersistenceUnitName);
}
} | java | {
"resource": ""
} |
q172826 | DescriptorUtils.validateDescriptor | test | public static String validateDescriptor(String descriptor) {
if (descriptor.length() == 0) {
throw EeLogger.ROOT_LOGGER.cannotBeEmpty("descriptors");
}
if (descriptor.length() > 1) {
if (descriptor.startsWith("L")) {
if (!descriptor.endsWith(";")) {
throw EeLogger.ROOT_LOGGER.invalidDescriptor(descriptor);
}
} else if (descriptor.startsWith("[")) {
} else {
throw EeLogger.ROOT_LOGGER.invalidDescriptor(descriptor);
}
} else {
char type = descriptor.charAt(0);
switch (type) {
case 'I':
case 'Z':
case 'S':
case 'B':
case 'F':
case 'D':
case 'V':
case 'J':
case 'C':
break;
default:
throw EeLogger.ROOT_LOGGER.invalidDescriptor(descriptor);
}
}
return descriptor;
} | java | {
"resource": ""
} |
q172827 | WebMetaDataCreator.create | test | void create(final Deployment dep) {
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
WarMetaData warMD = ASHelper.getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
JBossWebMetaData jbossWebMD = warMD != null ? warMD.getMergedJBossWebMetaData() : null;
if (warMD == null) {
warMD = new WarMetaData();
}
if (jbossWebMD == null) {
jbossWebMD = new JBossWebMetaData();
warMD.setMergedJBossWebMetaData(jbossWebMD);
unit.putAttachment(WarMetaData.ATTACHMENT_KEY, warMD);
}
createWebAppDescriptor(dep, jbossWebMD);
createJBossWebAppDescriptor(dep, jbossWebMD);
dep.addAttachment(JBossWebMetaData.class, jbossWebMD);
} | java | {
"resource": ""
} |
q172828 | WebMetaDataCreator.createWebAppDescriptor | test | private void createWebAppDescriptor(final Deployment dep, final JBossWebMetaData jbossWebMD) {
WSLogger.ROOT_LOGGER.trace("Creating web.xml descriptor");
createServlets(dep, jbossWebMD);
createServletMappings(dep, jbossWebMD);
createSecurityConstraints(dep, jbossWebMD);
createLoginConfig(dep, jbossWebMD);
createSecurityRoles(dep, jbossWebMD);
} | java | {
"resource": ""
} |
q172829 | WebMetaDataCreator.getAuthMethod | test | private String getAuthMethod(final Deployment dep) {
for (final Endpoint ejbEndpoint : dep.getService().getEndpoints()) {
final String beanAuthMethod = ejb3SecurityAccessor.getAuthMethod(ejbEndpoint);
final boolean hasBeanAuthMethod = beanAuthMethod != null;
if (hasBeanAuthMethod) {
// First found auth-method defines war
// login-config/auth-method
return beanAuthMethod;
}
}
return null;
} | java | {
"resource": ""
} |
q172830 | ServiceDeploymentParsingProcessor.deploy | test | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final VirtualFile deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
if(deploymentRoot == null || !deploymentRoot.exists())
return;
VirtualFile serviceXmlFile = null;
if(deploymentRoot.isDirectory()) {
serviceXmlFile = deploymentRoot.getChild(SERVICE_DESCRIPTOR_PATH);
} else if(deploymentRoot.getName().toLowerCase(Locale.ENGLISH).endsWith(SERVICE_DESCRIPTOR_SUFFIX)) {
serviceXmlFile = deploymentRoot;
}
if(serviceXmlFile == null || !serviceXmlFile.exists())
return;
final XMLMapper xmlMapper = XMLMapper.Factory.create();
final JBossServiceXmlDescriptorParser jBossServiceXmlDescriptorParser = new JBossServiceXmlDescriptorParser(JBossDescriptorPropertyReplacement.propertyReplacer(phaseContext.getDeploymentUnit()));
xmlMapper.registerRootElement(new QName("urn:jboss:service:7.0", "server"), jBossServiceXmlDescriptorParser);
xmlMapper.registerRootElement(new QName(null, "server"), jBossServiceXmlDescriptorParser);
InputStream xmlStream = null;
try {
xmlStream = serviceXmlFile.openStream();
final XMLStreamReader reader = inputFactory.createXMLStreamReader(xmlStream);
final ParseResult<JBossServiceXmlDescriptor> result = new ParseResult<JBossServiceXmlDescriptor>();
xmlMapper.parseDocument(result, reader);
final JBossServiceXmlDescriptor xmlDescriptor = result.getResult();
if(xmlDescriptor != null)
phaseContext.getDeploymentUnit().putAttachment(JBossServiceXmlDescriptor.ATTACHMENT_KEY, xmlDescriptor);
else
throw SarLogger.ROOT_LOGGER.failedXmlParsing(serviceXmlFile);
} catch(Exception e) {
throw SarLogger.ROOT_LOGGER.failedXmlParsing(e, serviceXmlFile);
} finally {
VFSUtils.safeClose(xmlStream);
}
} | java | {
"resource": ""
} |
q172831 | DeploymentDescriptorMethodProcessor.handleStatelessSessionBean | test | private void handleStatelessSessionBean(final EJBComponentDescription component, final Module module, final DeploymentReflectionIndex reflectionIndex) throws ClassNotFoundException, DeploymentUnitProcessingException {
final Class<?> componentClass = ClassLoadingUtils.loadClass(component.getComponentClassName(), module);
final MethodIdentifier ejbCreateId = MethodIdentifier.getIdentifier(void.class, "ejbCreate");
final Method ejbCreate = ClassReflectionIndexUtil.findMethod(reflectionIndex, componentClass, ejbCreateId);
if (ejbCreate != null) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
builder.setPostConstruct(ejbCreateId);
component.addInterceptorMethodOverride(ejbCreate.getDeclaringClass().getName(), builder.build());
}
final MethodIdentifier ejbRemoveId = MethodIdentifier.getIdentifier(void.class, "ejbRemove");
final Method ejbRemove = ClassReflectionIndexUtil.findMethod(reflectionIndex, componentClass, ejbRemoveId);
if (ejbRemove != null) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
builder.setPreDestroy(ejbRemoveId);
component.addInterceptorMethodOverride(ejbRemove.getDeclaringClass().getName(), builder.build());
}
} | java | {
"resource": ""
} |
q172832 | DynamicStubFactoryFactory.makeStubClass | test | public static Class<?> makeStubClass(final Class<?> myClass) {
final String stubClassName = myClass + "_Stub";
ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
if (cl == null) {
cl = myClass.getClassLoader();
}
if (cl == null) {
throw EjbLogger.ROOT_LOGGER.couldNotFindClassLoaderForStub(stubClassName);
}
Class<?> theClass;
try {
theClass = cl.loadClass(stubClassName);
} catch (ClassNotFoundException e) {
try {
final ClassFile clazz = IIOPStubCompiler.compile(myClass, stubClassName);
theClass = clazz.define(cl, myClass.getProtectionDomain());
} catch (Throwable ex) {
//there is a possibility that another thread may have defined the same class in the meantime
try {
theClass = cl.loadClass(stubClassName);
} catch (ClassNotFoundException e1) {
EjbLogger.ROOT_LOGGER.dynamicStubCreationFailed(stubClassName, ex);
throw ex;
}
}
}
return theClass;
} | java | {
"resource": ""
} |
q172833 | RepositoryImpl.getAnonymousObjectId | test | protected byte[] getAnonymousObjectId(long n) {
String s = anonOidPrefix + Long.toString(n);
return s.getBytes(StandardCharsets.UTF_8);
} | java | {
"resource": ""
} |
q172834 | PersistenceProviderResolverImpl.getPersistenceProviders | test | @Override
public List<PersistenceProvider> getPersistenceProviders() {
List<PersistenceProvider> providersCopy = new ArrayList<>(providers.size());
/**
* Add the application specified providers first so they are found before the global providers
*/
synchronized(persistenceProviderPerClassLoader) {
if (persistenceProviderPerClassLoader.size() > 0) {
// get the deployment or subdeployment classloader
ClassLoader deploymentClassLoader = findParentModuleCl(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
ROOT_LOGGER.tracef("get application level Persistence Provider for classloader %s" , deploymentClassLoader);
// collect persistence providers associated with deployment/each sub-deployment
List<Class<? extends PersistenceProvider>> deploymentSpecificPersistenceProviders = persistenceProviderPerClassLoader.get(deploymentClassLoader);
ROOT_LOGGER.tracef("got application level Persistence Provider list %s" , deploymentSpecificPersistenceProviders);
if (deploymentSpecificPersistenceProviders != null) {
for (Class<? extends PersistenceProvider> providerClass : deploymentSpecificPersistenceProviders) {
try {
ROOT_LOGGER.tracef("application has its own Persistence Provider %s", providerClass.getName());
providersCopy.add(providerClass.newInstance());
} catch (InstantiationException e) {
throw JpaLogger.ROOT_LOGGER.couldNotCreateInstanceProvider(e, providerClass.getName());
} catch (IllegalAccessException e) {
throw JpaLogger.ROOT_LOGGER.couldNotCreateInstanceProvider(e, providerClass.getName());
}
}
}
}
}
// add global persistence providers last (so application packaged providers have priority)
for (Class<?> providerClass : providers) {
try {
providersCopy.add((PersistenceProvider) providerClass.newInstance());
ROOT_LOGGER.tracef("returning global (module) Persistence Provider %s", providerClass.getName());
} catch (InstantiationException e) {
throw JpaLogger.ROOT_LOGGER.couldNotCreateInstanceProvider(e, providerClass.getName());
} catch (IllegalAccessException e) {
throw JpaLogger.ROOT_LOGGER.couldNotCreateInstanceProvider(e, providerClass.getName());
}
}
return providersCopy;
} | java | {
"resource": ""
} |
q172835 | PersistenceProviderResolverImpl.clearCachedDeploymentSpecificProviders | test | public void clearCachedDeploymentSpecificProviders(Set<ClassLoader> deploymentClassLoaders) {
synchronized(persistenceProviderPerClassLoader) {
for (ClassLoader deploymentClassLoader: deploymentClassLoaders) {
persistenceProviderPerClassLoader.remove(deploymentClassLoader);
}
}
} | java | {
"resource": ""
} |
q172836 | PersistenceProviderResolverImpl.addDeploymentSpecificPersistenceProvider | test | public void addDeploymentSpecificPersistenceProvider(PersistenceProvider persistenceProvider, Set<ClassLoader> deploymentClassLoaders) {
synchronized(persistenceProviderPerClassLoader) {
for (ClassLoader deploymentClassLoader: deploymentClassLoaders) {
List<Class<? extends PersistenceProvider>> list = persistenceProviderPerClassLoader.get(deploymentClassLoader);
ROOT_LOGGER.tracef("getting persistence provider list (%s) for deployment (%s)", list, deploymentClassLoader );
if (list == null) {
list = new ArrayList<>();
persistenceProviderPerClassLoader.put(deploymentClassLoader, list);
ROOT_LOGGER.tracef("saving new persistence provider list (%s) for deployment (%s)", list, deploymentClassLoader );
}
list.add(persistenceProvider.getClass());
ROOT_LOGGER.tracef("added new persistence provider (%s) to provider list (%s)", persistenceProvider.getClass().getName(), list);
}
}
} | java | {
"resource": ""
} |
q172837 | PersistenceProviderResolverImpl.findParentModuleCl | test | private ClassLoader findParentModuleCl(ClassLoader classLoader) {
ClassLoader c = classLoader;
while (c != null && !(c instanceof ModuleClassLoader)) {
c = c.getParent();
}
return c;
} | java | {
"resource": ""
} |
q172838 | SarModuleDependencyProcessor.deploy | test | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final JBossServiceXmlDescriptor serviceXmlDescriptor = deploymentUnit.getAttachment(JBossServiceXmlDescriptor.ATTACHMENT_KEY);
if(serviceXmlDescriptor == null) {
return; // Skip deployments with out a service xml descriptor
}
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_MODULES_ID, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_AS_SYSTEM_JMX_ID, true, false, false, false));
// depend on Properties editor module which uses ServiceLoader approach to load the appropriate org.jboss.common.beans.property.finder.PropertyEditorFinder
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), PROPERTIES_EDITOR_MODULE_ID, false, false, true, false));
// All SARs require the ability to register MBeans.
moduleSpecification.addPermissionFactory(REGISTER_PERMISSION_FACTORY);
} | java | {
"resource": ""
} |
q172839 | PersistenceUnitServiceHandler.addPuService | test | private static void addPuService(final DeploymentPhaseContext phaseContext, final ArrayList<PersistenceUnitMetadataHolder> puList,
final boolean startEarly, final Platform platform)
throws DeploymentUnitProcessingException {
if (puList.size() > 0) {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
final ModuleClassLoader classLoader = module.getClassLoader();
for (PersistenceUnitMetadataHolder holder : puList) {
setAnnotationIndexes(holder, deploymentUnit);
for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) {
// only start the persistence unit if JPA_CONTAINER_MANAGED is true
String jpaContainerManaged = pu.getProperties().getProperty(Configuration.JPA_CONTAINER_MANAGED);
boolean deployPU = (jpaContainerManaged == null? true : Boolean.parseBoolean(jpaContainerManaged));
if (deployPU) {
final PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder = getPersistenceProviderDeploymentHolder(deploymentUnit);
final PersistenceProvider provider = lookupProvider(pu, persistenceProviderDeploymentHolder, deploymentUnit);
final PersistenceProviderAdaptor adaptor = getPersistenceProviderAdaptor(pu, persistenceProviderDeploymentHolder, deploymentUnit, provider, platform);
final boolean twoPhaseBootStrapCapable = (adaptor instanceof TwoPhaseBootstrapCapable) && Configuration.allowTwoPhaseBootstrap(pu);
if (startEarly) {
if (twoPhaseBootStrapCapable) {
deployPersistenceUnitPhaseOne(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, adaptor);
}
else if (false == Configuration.needClassFileTransformer(pu)) {
// will start later when startEarly == false
ROOT_LOGGER.tracef("persistence unit %s in deployment %s is configured to not need class transformer to be set, no class rewriting will be allowed",
pu.getPersistenceUnitName(), deploymentUnit.getName());
}
else {
// we need class file transformer to work, don't allow cdi bean manager to be access since that
// could cause application classes to be loaded (workaround by setting jboss.as.jpa.classtransformer to false). WFLY-1463
final boolean allowCdiBeanManagerAccess = false;
deployPersistenceUnit(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor, allowCdiBeanManagerAccess);
}
}
else { // !startEarly
if (twoPhaseBootStrapCapable) {
deployPersistenceUnitPhaseTwo(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor);
} else if (false == Configuration.needClassFileTransformer(pu)) {
final boolean allowCdiBeanManagerAccess = true;
// PUs that have Configuration.JPA_CONTAINER_CLASS_TRANSFORMER = false will start during INSTALL phase
deployPersistenceUnit(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor, allowCdiBeanManagerAccess);
}
}
}
else {
ROOT_LOGGER.tracef("persistence unit %s in deployment %s is not container managed (%s is set to false)",
pu.getPersistenceUnitName(), deploymentUnit.getName(), Configuration.JPA_CONTAINER_MANAGED);
}
}
}
}
} | java | {
"resource": ""
} |
q172840 | PersistenceUnitServiceHandler.setAnnotationIndexes | test | private static void setAnnotationIndexes(
final PersistenceUnitMetadataHolder puHolder,
DeploymentUnit deploymentUnit ) {
final Map<URL, Index> annotationIndexes = new HashMap<>();
do {
for (ResourceRoot root : DeploymentUtils.allResourceRoots(deploymentUnit)) {
final Index index = root.getAttachment(Attachments.ANNOTATION_INDEX);
if (index != null) {
try {
ROOT_LOGGER.tracef("adding '%s' to annotation index map", root.getRoot().toURL());
annotationIndexes.put(root.getRoot().toURL(), index);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
deploymentUnit = deploymentUnit.getParent(); // get annotation indexes for top level also
}
while (deploymentUnit != null);
for (PersistenceUnitMetadata pu : puHolder.getPersistenceUnits()) {
pu.setAnnotationIndex(annotationIndexes); // hold onto the annotation index for Persistence Provider use during deployment
}
} | java | {
"resource": ""
} |
q172841 | PersistenceUnitServiceHandler.getPersistenceProviderAdaptor | test | private static PersistenceProviderAdaptor getPersistenceProviderAdaptor(
final PersistenceUnitMetadata pu,
final PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder,
final DeploymentUnit deploymentUnit,
final PersistenceProvider provider,
final Platform platform) throws
DeploymentUnitProcessingException {
String adapterClass = pu.getProperties().getProperty(Configuration.ADAPTER_CLASS);
/**
* use adapter packaged in application deployment.
*/
if (persistenceProviderDeploymentHolder != null && adapterClass != null) {
List<PersistenceProviderAdaptor> persistenceProviderAdaptors = persistenceProviderDeploymentHolder.getAdapters();
for(PersistenceProviderAdaptor persistenceProviderAdaptor:persistenceProviderAdaptors) {
if(adapterClass.equals(persistenceProviderAdaptor.getClass().getName())) {
return persistenceProviderAdaptor;
}
}
}
String adaptorModule = pu.getProperties().getProperty(Configuration.ADAPTER_MODULE);
PersistenceProviderAdaptor adaptor;
adaptor = getPerDeploymentSharedPersistenceProviderAdaptor(deploymentUnit, adaptorModule, provider);
if (adaptor == null) {
try {
// will load the persistence provider adaptor (integration classes). if adaptorModule is null
// the noop adaptor is returned (can be used against any provider but the integration classes
// are handled externally via properties or code in the persistence provider).
if (adaptorModule != null) { // legacy way of loading adapter module
adaptor = PersistenceProviderAdaptorLoader.loadPersistenceAdapterModule(adaptorModule, platform, createManager(deploymentUnit));
}
else {
adaptor = PersistenceProviderAdaptorLoader.loadPersistenceAdapter(provider, platform, createManager(deploymentUnit));
}
} catch (ModuleLoadException e) {
throw JpaLogger.ROOT_LOGGER.persistenceProviderAdaptorModuleLoadError(e, adaptorModule);
}
adaptor = savePerDeploymentSharedPersistenceProviderAdaptor(deploymentUnit, adaptorModule, adaptor, provider);
}
if (adaptor == null) {
throw JpaLogger.ROOT_LOGGER.failedToGetAdapter(pu.getPersistenceProviderClassName());
}
return adaptor;
} | java | {
"resource": ""
} |
q172842 | PersistenceUnitServiceHandler.savePerDeploymentSharedPersistenceProviderAdaptor | test | private static PersistenceProviderAdaptor savePerDeploymentSharedPersistenceProviderAdaptor(DeploymentUnit deploymentUnit, String adaptorModule, PersistenceProviderAdaptor adaptor, PersistenceProvider provider) {
if (deploymentUnit.getParent() != null) {
deploymentUnit = deploymentUnit.getParent();
}
synchronized (deploymentUnit) {
Map<String,PersistenceProviderAdaptor> map = deploymentUnit.getAttachment(providerAdaptorMapKey);
String key;
if (adaptorModule != null) {
key = adaptorModule; // handle legacy adapter module
}
else {
key = provider.getClass().getName();
}
PersistenceProviderAdaptor current = map.get(key);
// saved if not already set by another thread
if (current == null) {
map.put(key, adaptor);
current = adaptor;
}
return current;
}
} | java | {
"resource": ""
} |
q172843 | PersistenceUnitServiceHandler.lookupProvider | test | private static PersistenceProvider lookupProvider(
PersistenceUnitMetadata pu,
PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder,
DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
/**
* check if the deployment is already associated with the specified persistence provider
*/
Map<String, PersistenceProvider> providerMap = persistenceProviderDeploymentHolder != null ?
persistenceProviderDeploymentHolder.getProviders() : null;
if (providerMap != null) {
synchronized (providerMap) {
if(providerMap.containsKey(pu.getPersistenceProviderClassName())){
ROOT_LOGGER.tracef("deployment %s is using %s", deploymentUnit.getName(), pu.getPersistenceProviderClassName());
return providerMap.get(pu.getPersistenceProviderClassName());
}
}
}
String configuredPersistenceProviderModule = pu.getProperties().getProperty(Configuration.PROVIDER_MODULE);
String persistenceProviderClassName = pu.getPersistenceProviderClassName();
if (persistenceProviderClassName == null) {
persistenceProviderClassName = Configuration.PROVIDER_CLASS_DEFAULT;
}
/**
* locate persistence provider in specified static module
*/
if (configuredPersistenceProviderModule != null) {
List<PersistenceProvider> providers;
if (Configuration.PROVIDER_MODULE_APPLICATION_SUPPLIED.equals(configuredPersistenceProviderModule)) {
try {
// load the persistence provider from the application deployment
final ModuleClassLoader classLoader = deploymentUnit.getAttachment(Attachments.MODULE).getClassLoader();
PersistenceProvider provider = PersistenceProviderLoader.loadProviderFromDeployment(classLoader, persistenceProviderClassName);
providers = new ArrayList<>();
providers.add(provider);
PersistenceProviderDeploymentHolder.savePersistenceProviderInDeploymentUnit(deploymentUnit, providers, null);
return provider;
} catch (ClassNotFoundException e) {
throw JpaLogger.ROOT_LOGGER.cannotDeployApp(e, persistenceProviderClassName);
} catch (InstantiationException e) {
throw JpaLogger.ROOT_LOGGER.cannotDeployApp(e, persistenceProviderClassName);
} catch (IllegalAccessException e) {
throw JpaLogger.ROOT_LOGGER.cannotDeployApp(e, persistenceProviderClassName);
}
} else {
try {
providers = PersistenceProviderLoader.loadProviderModuleByName(configuredPersistenceProviderModule);
PersistenceProviderDeploymentHolder.savePersistenceProviderInDeploymentUnit(deploymentUnit, providers, null);
PersistenceProvider provider = getProviderByName(pu, providers);
if (provider != null) {
return provider;
}
} catch (ModuleLoadException e) {
throw JpaLogger.ROOT_LOGGER.cannotLoadPersistenceProviderModule(e, configuredPersistenceProviderModule, persistenceProviderClassName);
}
}
}
// try to determine the static module name based on the persistence provider class name
String providerNameDerivedFromClassName = Configuration.getProviderModuleNameFromProviderClassName(persistenceProviderClassName);
// see if the providerNameDerivedFromClassName has been loaded yet
PersistenceProvider provider = getProviderByName(pu);
// if we haven't loaded the provider yet, try loading now
if (provider == null && providerNameDerivedFromClassName != null) {
try {
List<PersistenceProvider> providers = PersistenceProviderLoader.loadProviderModuleByName(providerNameDerivedFromClassName);
PersistenceProviderDeploymentHolder.savePersistenceProviderInDeploymentUnit(deploymentUnit, providers, null);
provider = getProviderByName(pu, providers);
} catch (ModuleLoadException e) {
throw JpaLogger.ROOT_LOGGER.cannotLoadPersistenceProviderModule(e, providerNameDerivedFromClassName, persistenceProviderClassName);
}
}
if (provider == null)
throw JpaLogger.ROOT_LOGGER.persistenceProviderNotFound(persistenceProviderClassName);
return provider;
} | java | {
"resource": ""
} |
q172844 | JandexAnnotationProvider.getAnnotatedClasses | test | @Override
public Map<Class<? extends Annotation>, Set<Class<?>>> getAnnotatedClasses(final Set uris) {
return annotations; // TODO: Should this be limited by URI
} | java | {
"resource": ""
} |
q172845 | AbstractMetaDataBuilderEJB.create | test | final EJBArchiveMetaData create(final Deployment dep) {
if (WSLogger.ROOT_LOGGER.isTraceEnabled()) {
WSLogger.ROOT_LOGGER.tracef("Building JBoss agnostic meta data for EJB webservice deployment: %s", dep.getSimpleName());
}
final EJBArchiveMetaData.Builder ejbArchiveMDBuilder = new EJBArchiveMetaData.Builder();
this.buildEnterpriseBeansMetaData(dep, ejbArchiveMDBuilder);
this.buildWebservicesMetaData(dep, ejbArchiveMDBuilder);
return ejbArchiveMDBuilder.build();
} | java | {
"resource": ""
} |
q172846 | AbstractMetaDataBuilderEJB.buildEnterpriseBeanMetaData | test | protected void buildEnterpriseBeanMetaData(final List<EJBMetaData> wsEjbsMD, final EJBEndpoint ejbEndpoint, final JBossWebservicesMetaData jbossWebservicesMD) {
final SLSBMetaData.Builder wsEjbMDBuilder = new SLSBMetaData.Builder();
// set EJB name and class
wsEjbMDBuilder.setEjbName(ejbEndpoint.getName());
wsEjbMDBuilder.setEjbClass(ejbEndpoint.getClassName());
final JBossPortComponentMetaData portComponentMD = getPortComponent(ejbEndpoint.getName(), jbossWebservicesMD);
if (portComponentMD != null) {
// set port component meta data
wsEjbMDBuilder.setPortComponentName(portComponentMD.getPortComponentName());
wsEjbMDBuilder.setPortComponentURI(portComponentMD.getPortComponentURI());
}
// set security meta data
// auth method
final String authMethod = getAuthMethod(ejbEndpoint, portComponentMD);
// transport guarantee
final String transportGuarantee = getTransportGuarantee(ejbEndpoint, portComponentMD);
// secure wsdl access
final boolean secureWsdlAccess = isSecureWsdlAccess(ejbEndpoint, portComponentMD);
final String realmName = getRealmName(ejbEndpoint, portComponentMD);
// propagate
wsEjbMDBuilder.setSecurityMetaData(new EJBSecurityMetaData(authMethod, realmName, transportGuarantee, secureWsdlAccess));
wsEjbsMD.add(wsEjbMDBuilder.build());
} | java | {
"resource": ""
} |
q172847 | LogStoreParticipantRecoveryHandler.refreshParticipant | test | void refreshParticipant(OperationContext context) {
context.addStep(refreshHandler, OperationContext.Stage.MODEL, true);
} | java | {
"resource": ""
} |
q172848 | WorkCacheManager.getAnalysis | test | ContainerAnalysis getAnalysis(final Class cls) throws RMIIIOPViolationException {
ContainerAnalysis ret = null;
boolean created = false;
try {
synchronized (this) {
ret = lookupDone(cls);
if (ret != null) {
return ret;
}
// is it work-in-progress?
final ContainerAnalysis inProgress = workInProgress.get(new InProgressKey(cls, Thread.currentThread()));
if (inProgress != null) {
return inProgress; // return unfinished
// Do not wait for the other thread: We may deadlock
// Double work is better that deadlock...
}
ret = createWorkInProgress(cls);
}
created = true;
// Do the work
doTheWork(cls, ret);
} finally {
// We did it
synchronized (this) {
if(created) {
workInProgress.remove(new InProgressKey(cls, Thread.currentThread()));
workDone.put(cls, new SoftReference<ContainerAnalysis>(ret));
ClassLoader classLoader = cls.getClassLoader();
if (classLoader != null) {
Set<Class<?>> classes = classesByLoader.get(classLoader);
if (classes == null) {
classesByLoader.put(classLoader, classes = new HashSet<Class<?>>());
}
classes.add(cls);
}
}
notifyAll();
}
}
return ret;
} | java | {
"resource": ""
} |
q172849 | WorkCacheManager.lookupDone | test | private ContainerAnalysis lookupDone(Class cls) {
SoftReference ref = (SoftReference) workDone.get(cls);
if (ref == null)
return null;
ContainerAnalysis ret = (ContainerAnalysis) ref.get();
if (ret == null)
workDone.remove(cls); // clear map entry if soft ref. was cleared.
return ret;
} | java | {
"resource": ""
} |
q172850 | WorkCacheManager.createWorkInProgress | test | private ContainerAnalysis createWorkInProgress(final Class cls) {
final ContainerAnalysis analysis;
try {
analysis = (ContainerAnalysis) constructor.newInstance(cls);
} catch (InstantiationException ex) {
throw new RuntimeException(ex.toString());
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex.toString());
} catch (InvocationTargetException ex) {
throw new RuntimeException(ex.toString());
}
workInProgress.put(new InProgressKey(cls, Thread.currentThread()), analysis);
return analysis;
} | java | {
"resource": ""
} |
q172851 | ContainerAnalysis.getIDLModuleName | test | public String getIDLModuleName() {
if (idlModuleName == null) {
String pkgName = cls.getPackage().getName();
StringBuffer b = new StringBuffer();
while (!"".equals(pkgName)) {
int idx = pkgName.indexOf('.');
String n = (idx == -1) ? pkgName : pkgName.substring(0, idx);
b.append("::").append(Util.javaToIDLName(n));
pkgName = (idx == -1) ? "" : pkgName.substring(idx + 1);
}
idlModuleName = b.toString();
}
return idlModuleName;
} | java | {
"resource": ""
} |
q172852 | ContainerAnalysis.toHexString | test | protected String toHexString(int i) {
String s = Integer.toHexString(i).toUpperCase(Locale.ENGLISH);
if (s.length() < 8)
return "00000000".substring(0, 8 - s.length()) + s;
else
return s;
} | java | {
"resource": ""
} |
q172853 | ContainerAnalysis.toHexString | test | protected String toHexString(long l) {
String s = Long.toHexString(l).toUpperCase(Locale.ENGLISH);
if (s.length() < 16)
return "0000000000000000".substring(0, 16 - s.length()) + s;
else
return s;
} | java | {
"resource": ""
} |
q172854 | ContainerAnalysis.isAccessor | test | protected boolean isAccessor(Method m) {
Class returnType = m.getReturnType();
// JBAS-4473, look for get<name>()
String name = m.getName();
if (!(name.startsWith("get") && name.length() > "get".length()))
if (!(name.startsWith("is") && name.length() > "is".length())
|| !(returnType == Boolean.TYPE))
return false;
if (returnType == Void.TYPE)
return false;
if (m.getParameterTypes().length != 0)
return false;
return hasNonAppExceptions(m);
} | java | {
"resource": ""
} |
q172855 | ContainerAnalysis.isMutator | test | protected boolean isMutator(Method m) {
// JBAS-4473, look for set<name>()
String name = m.getName();
if (!(name.startsWith("set") && name.length() > "set".length()))
return false;
if (m.getReturnType() != Void.TYPE)
return false;
if (m.getParameterTypes().length != 1)
return false;
return hasNonAppExceptions(m);
} | java | {
"resource": ""
} |
q172856 | ContainerAnalysis.hasNonAppExceptions | test | protected boolean hasNonAppExceptions(Method m) {
Class[] ex = m.getExceptionTypes();
for (int i = 0; i < ex.length; ++i)
if (!java.rmi.RemoteException.class.isAssignableFrom(ex[i]))
return false;
return true;
} | java | {
"resource": ""
} |
q172857 | ContainerAnalysis.attributeReadName | test | protected String attributeReadName(String name) {
if (name.startsWith("get"))
name = name.substring(3);
else if (name.startsWith("is"))
name = name.substring(2);
else
throw IIOPLogger.ROOT_LOGGER.notAnAccessor(name);
return name;
} | java | {
"resource": ""
} |
q172858 | ContainerAnalysis.attributeWriteName | test | protected String attributeWriteName(String name) {
if (name.startsWith("set"))
name = name.substring(3);
else
throw IIOPLogger.ROOT_LOGGER.notAnAccessor(name);
return name;
} | java | {
"resource": ""
} |
q172859 | ContainerAnalysis.fixupOverloadedOperationNames | test | protected void fixupOverloadedOperationNames()
throws RMIIIOPViolationException {
for (int i = 0; i < methods.length; ++i) {
if ((m_flags[i] & M_OVERLOADED) == 0)
continue;
// Find the operation
OperationAnalysis oa = null;
String javaName = methods[i].getName();
for (int opIdx = 0; oa == null && opIdx < operations.length; ++opIdx)
if (operations[opIdx].getMethod().equals(methods[i]))
oa = operations[opIdx];
if (oa == null)
continue; // This method is not mapped.
// Calculate new IDL name
ParameterAnalysis[] params = oa.getParameters();
StringBuffer b = new StringBuffer(oa.getIDLName());
if (params.length == 0)
b.append("__");
for (int j = 0; j < params.length; ++j) {
String s = params[j].getTypeIDLName();
if (s.startsWith("::"))
s = s.substring(2);
if (s.startsWith("_")) {
// remove leading underscore in IDL escaped identifier
s = s.substring(1);
}
b.append('_');
while (!"".equals(s)) {
int idx = s.indexOf("::");
b.append('_');
if (idx == -1) {
b.append(s);
s = "";
} else {
b.append(s.substring(0, idx));
if (s.length() > idx + 2 && s.charAt(idx + 2) == '_') {
// remove leading underscore in IDL escaped identifier
s = s.substring(idx + 3);
} else {
s = s.substring(idx + 2);
}
}
}
}
// Set new IDL name
oa.setIDLName(b.toString());
}
} | java | {
"resource": ""
} |
q172860 | ContainerAnalysis.fixupCaseNames | test | protected void fixupCaseNames()
throws RMIIIOPViolationException {
ArrayList entries = getContainedEntries();
boolean[] clash = new boolean[entries.size()];
String[] upperNames = new String[entries.size()];
for (int i = 0; i < entries.size(); ++i) {
AbstractAnalysis aa = (AbstractAnalysis) entries.get(i);
clash[i] = false;
upperNames[i] = aa.getIDLName().toUpperCase(Locale.ENGLISH);
for (int j = 0; j < i; ++j) {
if (upperNames[i].equals(upperNames[j])) {
clash[i] = true;
clash[j] = true;
}
}
}
for (int i = 0; i < entries.size(); ++i) {
if (!clash[i])
continue;
AbstractAnalysis aa = (AbstractAnalysis) entries.get(i);
boolean noUpper = true;
String name = aa.getIDLName();
StringBuffer b = new StringBuffer(name);
b.append('_');
for (int j = 0; j < name.length(); ++j) {
if (!Character.isUpperCase(name.charAt(j)))
continue;
if (noUpper)
noUpper = false;
else
b.append('_');
b.append(j);
}
aa.setIDLName(b.toString());
}
} | java | {
"resource": ""
} |
q172861 | ContainerAnalysis.escapeIRName | test | protected String escapeIRName(String name) {
StringBuffer b = new StringBuffer();
for (int i = 0; i < name.length(); ++i) {
char c = name.charAt(i);
if (c < 256)
b.append(c);
else
b.append("\\U").append(toHexString((int) c));
}
return b.toString();
} | java | {
"resource": ""
} |
q172862 | XTSSubsystemParser.parseXTSEnvironmentElement | test | private void parseXTSEnvironmentElement(XMLExtendedStreamReader reader, ModelNode subsystem) throws XMLStreamException {
processAttributes(reader, (index, attribute) -> {
final String value = reader.getAttributeValue(index);
switch (attribute) {
case URL:
ENVIRONMENT_URL.parseAndSetParameter(value, subsystem, reader);
break;
default:
throw ParseUtils.unexpectedAttribute(reader, index);
}
});
// Handle elements
ParseUtils.requireNoContent(reader);
} | java | {
"resource": ""
} |
q172863 | XTSSubsystemParser.parseDefaultContextPropagationElement | test | private void parseDefaultContextPropagationElement(XMLExtendedStreamReader reader, ModelNode subsystem) throws XMLStreamException {
processAttributes(reader, (index, attribute) -> {
final String value = reader.getAttributeValue(index);
switch (attribute) {
case ENABLED:
if (value == null || (!value.toLowerCase().equals("true") && !value.toLowerCase().equals("false"))) {
throw ParseUtils.invalidAttributeValue(reader, index);
}
DEFAULT_CONTEXT_PROPAGATION.parseAndSetParameter(value, subsystem, reader);
break;
default:
throw ParseUtils.unexpectedAttribute(reader, index);
}
});
// Handle elements
ParseUtils.requireNoContent(reader);
} | java | {
"resource": ""
} |
q172864 | XTSSubsystemParser.processAttributes | test | private void processAttributes(final XMLExtendedStreamReader reader, AttributeProcessor<Integer, Attribute> attributeProcessorCallback) throws XMLStreamException {
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
ParseUtils.requireNoNamespaceAttribute(reader, i);
// final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
attributeProcessorCallback.process(i, attribute);
}
} | java | {
"resource": ""
} |
q172865 | PersistenceProviderLoader.loadProviderModuleByName | test | public static List<PersistenceProvider> loadProviderModuleByName(String moduleName) throws ModuleLoadException {
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName));
final ServiceLoader<PersistenceProvider> serviceLoader =
module.loadService(PersistenceProvider.class);
List<PersistenceProvider> result = new ArrayList<>();
if (serviceLoader != null) {
for (PersistenceProvider provider1 : serviceLoader) {
// persistence provider jar may contain multiple provider service implementations
// save each provider
PersistenceProviderResolverImpl.getInstance().addPersistenceProvider(provider1);
result.add(provider1);
}
}
return result;
} | java | {
"resource": ""
} |
q172866 | ManagementHelper.createAddOperation | test | static AbstractAddStepHandler createAddOperation(final String childType, final boolean allowSibling, Collection<? extends AttributeDefinition> attributes) {
return new ActiveMQReloadRequiredHandlers.AddStepHandler(attributes) {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
super.execute(context, operation);
if (!allowSibling) {
context.addStep(checkNoOtherSibling(childType), MODEL);
}
}
};
} | java | {
"resource": ""
} |
q172867 | EjbDependencyDeploymentUnitProcessor.deploy | test | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
// get hold of the deployment unit
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
//always add EE API
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_API, false, false, true, false));
// previously exported by EJB_API prior to WFLY-5922 TODO WFLY-5967 look into moving this to WS subsystem
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAX_RPC_API, false, false, true, false));
//we always give them the EJB client
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_CLIENT, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_NAMING_CLIENT, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_IIOP_CLIENT, false, false, false, false));
//we always have to add this, as even non-ejb deployments may still lookup IIOP ejb's
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_SUBSYSTEM, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HTTP_EJB, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HTTP_NAMING, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HTTP_TRANSACTION, false, false, true, false));
if (IIOPDeploymentMarker.isIIOPDeployment(deploymentUnit)) {
//needed for dynamic IIOP stubs
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IIOP_OPENJDK, false, false, false, false));
}
// fetch the EjbJarMetaData
//TODO: remove the app client bit after the next EJB release
if (!isEjbDeployment(deploymentUnit) && !DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) {
// nothing to do
return;
}
// FIXME: still not the best way to do it
//this must be the first dep listed in the module
if (Boolean.getBoolean("org.jboss.as.ejb3.EMBEDDED"))
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.CLASSPATH, false, false, false, false));
} | java | {
"resource": ""
} |
q172868 | WebSubsystemParser.writeAttribute | test | private boolean writeAttribute(XMLExtendedStreamWriter writer, SimpleAttributeDefinition attribute, ModelNode node,
boolean startWriten, String origin) throws XMLStreamException {
if (attribute.isMarshallable(node, false)) {
if (!startWriten) {
startWriten = true;
writer.writeStartElement(origin);
}
attribute.marshallAsAttribute(node, false, writer);
}
return startWriten;
} | java | {
"resource": ""
} |
q172869 | MethodIntfHelper.of | test | public static MethodIntf of(final InterceptorContext invocation) {
//for timer invocations there is no view, so the methodInf is attached directly
//to the context. Otherwise we retrieve it from the invoked view
MethodIntf methodIntf = invocation.getPrivateData(MethodIntf.class);
if (methodIntf == null) {
final ComponentView componentView = invocation.getPrivateData(ComponentView.class);
if (componentView != null) {
methodIntf = componentView.getPrivateData(MethodIntf.class);
} else {
methodIntf = MethodIntf.BEAN;
}
}
return methodIntf;
} | java | {
"resource": ""
} |
q172870 | StatefulSessionComponent.createSessionRemote | test | public SessionID createSessionRemote() {
ControlPoint controlPoint = getControlPoint();
if(controlPoint == null) {
return createSession();
} else {
try {
RunResult result = controlPoint.beginRequest();
if (result == RunResult.REJECTED) {
throw EjbLogger.ROOT_LOGGER.containerSuspended();
}
try {
return createSession();
} finally {
controlPoint.requestComplete();
}
} catch (EJBComponentUnavailableException | ComponentIsStoppedException e) {
throw e;
} catch (Exception e) {
throw new EJBException(e);
}
}
} | java | {
"resource": ""
} |
q172871 | JMSServerControlHandler.inferDestinationName | test | private String inferDestinationName(String address) {
if (address.startsWith(JMS_QUEUE_PREFIX)) {
return address.substring(JMS_QUEUE_PREFIX.length());
} else if (address.startsWith(JMS_TOPIC_PREFIX)) {
return address.substring(JMS_TOPIC_PREFIX.length());
} else {
return address;
}
} | java | {
"resource": ""
} |
q172872 | WSEndpointHandlersMapping.registerEndpointHandlers | test | public void registerEndpointHandlers(final String endpointClass, final Set<String> endpointHandlers) {
if ((endpointClass == null) || (endpointHandlers == null)) {
throw new IllegalArgumentException();
}
endpointHandlersMap.put(endpointClass, Collections.unmodifiableSet(endpointHandlers));
} | java | {
"resource": ""
} |
q172873 | WildFlyJobXmlResolver.getJobXmlNames | test | Set<String> getJobXmlNames(final String jobName) {
if (jobNames.containsKey(jobName)) {
return Collections.unmodifiableSet(jobNames.get(jobName));
}
return Collections.emptySet();
} | java | {
"resource": ""
} |
q172874 | WildFlyJobXmlResolver.init | test | private void init(final ClassLoader classLoader) {
// Load the user defined resolvers
for (JobXmlResolver resolver : ServiceLoader.load(JobXmlResolver.class, classLoader)) {
jobXmlResolvers.add(resolver);
for (String jobXml : resolver.getJobXmlNames(classLoader)) {
addJob(jobXml, resolver.resolveJobName(jobXml, classLoader));
}
}
// Load the default names
for (Map.Entry<String, VirtualFile> entry : jobXmlFiles.entrySet()) {
try {
// Parsing the entire job XML seems excessive to just get the job name. There are two reasons for this:
// 1) If an error occurs during parsing there's no real need to consider this a valid job
// 2) Using the implementation parser seems less error prone for future-proofing
final Job job = JobParser.parseJob(entry.getValue().openStream(), classLoader, new XMLResolver() {
// this is essentially what JBeret does, but it's ugly. JBeret might need an API to handle this
@Override
public Object resolveEntity(final String publicID, final String systemID, final String baseURI, final String namespace) throws XMLStreamException {
try {
return (jobXmlFiles.containsKey(systemID) ? jobXmlFiles.get(systemID).openStream() : null);
} catch (IOException e) {
throw new XMLStreamException(e);
}
}
});
addJob(entry.getKey(), job.getId());
} catch (XMLStreamException | IOException e) {
// Report the possible error as we don't want to fail the deployment. The job may never be run.
BatchLogger.LOGGER.invalidJobXmlFile(entry.getKey());
}
}
} | java | {
"resource": ""
} |
q172875 | JbossAuthorizationManager.requestURI | test | protected String requestURI(HttpServerExchange request) {
String uri = request.getRelativePath();
if (uri == null || uri.equals("/")) {
uri = "";
}
return uri;
} | java | {
"resource": ""
} |
q172876 | CNCtx.createUsingURL | test | public static ResolveResult createUsingURL(String url, Hashtable env)
throws NamingException {
CNCtx ctx = new CNCtx();
if (env != null) {
env = (Hashtable) env.clone();
}
ctx._env = env;
String rest = ctx.initUsingUrl(env != null ? (org.omg.CORBA.ORB) env.get("java.naming.corba.orb") : null,
url, env);
// rest is the INS name
// Return the parsed form to prevent subsequent lookup
// from parsing the string as a composite name
// The caller should be aware that a toString() of the name
// will yield its INS syntax, rather than a composite syntax
return new ResolveResult(ctx, parser.parse(rest));
} | java | {
"resource": ""
} |
q172877 | CNCtx.lookup | test | public java.lang.Object lookup(String name) throws NamingException {
return lookup(new CompositeName(name));
} | java | {
"resource": ""
} |
q172878 | CNCtx.bind | test | public void bind(String name, java.lang.Object obj) throws NamingException {
bind(new CompositeName(name), obj);
} | java | {
"resource": ""
} |
q172879 | CNCtx.callUnbind | test | private void callUnbind(NameComponent[] path) throws NamingException {
if (_nc == null)
throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString());
try {
_nc.unbind(path);
} catch (NotFound e) {
// If leaf is the one missing, return success
// as per JNDI spec
if (leafNotFound(e, path[path.length - 1])) {
// do nothing
} else {
throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path);
}
} catch (Exception e) {
throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path);
}
} | java | {
"resource": ""
} |
q172880 | CNCtx.listBindings | test | public NamingEnumeration listBindings(Name name)
throws NamingException {
if (_nc == null)
throw IIOPLogger.ROOT_LOGGER.notANamingContext(name.toString());
if (name.size() > 0) {
try {
java.lang.Object obj = lookup(name);
if (obj instanceof CNCtx) {
return new org.wildfly.iiop.openjdk.naming.jndi.CNBindingEnumeration(
(CNCtx) obj, true, _env);
} else {
throw new NotContextException(name.toString());
}
} catch (NamingException ne) {
throw ne;
} catch (BAD_PARAM e) {
NamingException ne =
new NotContextException(name.toString());
ne.setRootCause(e);
throw ne;
}
}
return new org.wildfly.iiop.openjdk.naming.jndi.CNBindingEnumeration(this, false, _env);
} | java | {
"resource": ""
} |
q172881 | CNCtx.callDestroy | test | private void callDestroy(NamingContext nc)
throws NamingException {
if (_nc == null)
throw IIOPLogger.ROOT_LOGGER.notANamingContext(nc.toString());
try {
nc.destroy();
} catch (Exception e) {
throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, null);
}
} | java | {
"resource": ""
} |
q172882 | CNCtx.destroySubcontext | test | public void destroySubcontext(Name name)
throws NamingException {
if (_nc == null)
throw IIOPLogger.ROOT_LOGGER.notANamingContext(name.toString());
NamingContext the_nc = _nc;
NameComponent[] path = org.wildfly.iiop.openjdk.naming.jndi.CNNameParser.nameToCosName(name);
if (name.size() > 0) {
try {
javax.naming.Context ctx =
(javax.naming.Context) callResolve(path);
CNCtx cnc = (CNCtx) ctx;
the_nc = cnc._nc;
cnc.close(); //remove the reference to the context
} catch (ClassCastException e) {
throw new NotContextException(name.toString());
} catch (CannotProceedException e) {
javax.naming.Context cctx = getContinuationContext(e);
cctx.destroySubcontext(e.getRemainingName());
return;
} catch (NameNotFoundException e) {
// If leaf is the one missing, return success
// as per JNDI spec
if (e.getRootCause() instanceof NotFound &&
leafNotFound((NotFound) e.getRootCause(),
path[path.length - 1])) {
return; // leaf missing OK
}
throw e;
} catch (NamingException e) {
throw e;
}
}
callDestroy(the_nc);
callUnbind(path);
} | java | {
"resource": ""
} |
q172883 | CNCtx.callBindNewContext | test | private javax.naming.Context callBindNewContext(NameComponent[] path)
throws NamingException {
if (_nc == null)
throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString());
try {
NamingContext nctx = _nc.bind_new_context(path);
return new CNCtx(_orb, nctx, _env, makeFullName(path));
} catch (Exception e) {
throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path);
}
} | java | {
"resource": ""
} |
q172884 | CNCtx.createSubcontext | test | public javax.naming.Context createSubcontext(String name)
throws NamingException {
return createSubcontext(new CompositeName(name));
} | java | {
"resource": ""
} |
q172885 | CNCtx.lookupLink | test | public java.lang.Object lookupLink(String name) throws NamingException {
return lookupLink(new CompositeName(name));
} | java | {
"resource": ""
} |
q172886 | CNCtx.addToEnvironment | test | public java.lang.Object addToEnvironment(String propName,
java.lang.Object propValue)
throws NamingException {
if (_env == null) {
_env = new Hashtable(7, 0.75f);
} else {
// copy-on-write
_env = (Hashtable) _env.clone();
}
return _env.put(propName, propValue);
} | java | {
"resource": ""
} |
q172887 | CNCtx.removeFromEnvironment | test | public java.lang.Object removeFromEnvironment(String propName)
throws NamingException {
if (_env != null && _env.get(propName) != null) {
// copy-on-write
_env = (Hashtable) _env.clone();
return _env.remove(propName);
}
return null;
} | java | {
"resource": ""
} |
q172888 | AbstractProtocolResourceDefinition.addTransformations | test | @SuppressWarnings("deprecation")
static void addTransformations(ModelVersion version, ResourceTransformationDescriptionBuilder builder) {
if (JGroupsModel.VERSION_5_0_0.requiresTransformation(version)) {
builder.getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.UNDEFINED, Attribute.STATISTICS_ENABLED.getDefinition())
.addRejectCheck(RejectAttributeChecker.DEFINED, Attribute.STATISTICS_ENABLED.getDefinition())
.end();
}
if (JGroupsModel.VERSION_3_0_0.requiresTransformation(version)) {
AttributeConverter typeConverter = new AttributeConverter.DefaultAttributeConverter() {
@Override
protected void convertAttribute(PathAddress address, String name, ModelNode value, TransformationContext context) {
if (!value.isDefined()) {
value.set(address.getLastElement().getValue());
}
}
};
builder.getAttributeBuilder()
.setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(Attribute.MODULE.getDefinition().getDefaultValue()), Attribute.MODULE.getDefinition())
.addRejectCheck(RejectAttributeChecker.DEFINED, Attribute.MODULE.getDefinition())
.setValueConverter(typeConverter, DeprecatedAttribute.TYPE.getDefinition())
.end();
builder.addRawOperationTransformationOverride(MapOperations.MAP_GET_DEFINITION.getName(), new SimpleOperationTransformer(new LegacyPropertyMapGetOperationTransformer()));
for (String opName : Operations.getAllWriteAttributeOperationNames()) {
builder.addOperationTransformationOverride(opName)
.inheritResourceAttributeDefinitions()
.setCustomOperationTransformer(new LegacyPropertyWriteOperationTransformer());
}
}
PropertyResourceDefinition.buildTransformation(version, builder);
} | java | {
"resource": ""
} |
q172889 | DsXmlParser.parseCredential | test | @Override
protected Credential parseCredential(XMLStreamReader reader) throws XMLStreamException, ParserException,
ValidateException {
String userName = null;
String password = null;
String securityDomain = null;
boolean elytronEnabled = false;
String authenticationContext = null;
while (reader.hasNext()) {
switch (reader.nextTag()) {
case END_ELEMENT: {
if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.SECURITY ||
Recovery.Tag.forName(reader.getLocalName()) == Recovery.Tag.RECOVER_CREDENTIAL) {
return new CredentialImpl(userName, password, elytronEnabled? authenticationContext: securityDomain,
elytronEnabled, null);
} else {
if (Credential.Tag.forName(reader.getLocalName()) == Credential.Tag.UNKNOWN) {
throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
}
case START_ELEMENT: {
switch (Credential.Tag.forName(reader.getLocalName())) {
case PASSWORD: {
password = elementAsString(reader);
if (propertyResolver != null && password != null) {
String resolvedPassword = propertyResolver.resolve(password);
if (resolvedPassword != null)
password = resolvedPassword;
}
break;
}
case USER_NAME: {
userName = elementAsString(reader);
break;
}
case SECURITY_DOMAIN: {
securityDomain = elementAsString(reader);
break;
}
case ELYTRON_ENABLED: {
Boolean value = elementAsBoolean(reader);
elytronEnabled = value == null? true : value;
break;
}
case AUTHENTICATION_CONTEXT: {
authenticationContext = elementAsString(reader);
break;
}
default:
throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
throw new ParserException(bundle.unexpectedEndOfDocument());
} | java | {
"resource": ""
} |
q172890 | JNDIBasedSecurityManagement.removeSecurityDomain | test | public void removeSecurityDomain(String securityDomain) {
securityMgrMap.remove(securityDomain);
auditMgrMap.remove(securityDomain);
authMgrMap.remove(securityDomain);
authzMgrMap.remove(securityDomain);
idmMgrMap.remove(securityDomain);
mappingMgrMap.remove(securityDomain);
jsseMap.remove(securityDomain);
} | java | {
"resource": ""
} |
q172891 | JNDIBasedSecurityManagement.lookUpJNDI | test | private Object lookUpJNDI(String contextName) {
Object result = null;
try {
Context ctx = new InitialContext();
if (contextName.startsWith(SecurityConstants.JAAS_CONTEXT_ROOT))
result = ctx.lookup(contextName);
else
result = ctx.lookup(SecurityConstants.JAAS_CONTEXT_ROOT + contextName);
} catch (Exception e) {
SecurityLogger.ROOT_LOGGER.tracef("Look up of JNDI for %s failed with %s", contextName, e.getLocalizedMessage());
return null;
}
return result;
} | java | {
"resource": ""
} |
q172892 | ModularReference.create | test | public static ModularReference create(final Class<?> type, final Class<?> factoryClass) {
return create(type.getName(), factoryClass);
} | java | {
"resource": ""
} |
q172893 | ModularReference.create | test | public static ModularReference create(final String className, final Class<?> factoryClass) {
return new ModularReference(className, factoryClass.getName(), Module.forClass(factoryClass).getIdentifier());
} | java | {
"resource": ""
} |
q172894 | ModularReference.create | test | public static ModularReference create(final Class<?> type, final RefAddr addr, final Class<?> factoryClass) {
return create(type.getName(), addr, factoryClass);
} | java | {
"resource": ""
} |
q172895 | IDLTypeImpl.getIDLType | test | static LocalIDLType getIDLType(TypeCode typeCode, RepositoryImpl repository) {
TCKind tcKind = typeCode.kind();
if (PrimitiveDefImpl.isPrimitiveTCKind(tcKind))
return new PrimitiveDefImpl(typeCode, repository);
if (tcKind == TCKind.tk_sequence)
return repository.getSequenceImpl(typeCode);
if (tcKind == TCKind.tk_value || tcKind == TCKind.tk_value_box ||
tcKind == TCKind.tk_alias || tcKind == TCKind.tk_struct ||
tcKind == TCKind.tk_union || tcKind == TCKind.tk_enum ||
tcKind == TCKind.tk_objref) {
try {
return (LocalIDLType) repository._lookup_id(typeCode.id());
} catch (BadKind ex) {
throw IIOPLogger.ROOT_LOGGER.badKindForTypeCode(tcKind.value());
}
}
throw IIOPLogger.ROOT_LOGGER.badKindForTypeCode(tcKind.value());
} | java | {
"resource": ""
} |
q172896 | SecurityDomainResourceDefinition.waitForService | test | private static void waitForService(final ServiceController<?> controller) throws OperationFailedException {
if (controller.getState() == ServiceController.State.UP) return;
final StabilityMonitor monitor = new StabilityMonitor();
monitor.addController(controller);
try {
monitor.awaitStability(100, MILLISECONDS);
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
throw SecurityLogger.ROOT_LOGGER.interruptedWaitingForSecurityDomain(controller.getName().getSimpleName());
} finally {
monitor.removeController(controller);
}
if (controller.getState() != ServiceController.State.UP) {
throw SecurityLogger.ROOT_LOGGER.requiredSecurityDomainServiceNotAvailable(controller.getName().getSimpleName());
}
} | java | {
"resource": ""
} |
q172897 | VaultSession.computeMaskedPassword | test | private String computeMaskedPassword() throws Exception {
// Create the PBE secret key
SecretKeyFactory factory = SecretKeyFactory.getInstance(VAULT_ENC_ALGORITHM);
char[] password = "somearbitrarycrazystringthatdoesnotmatter".toCharArray();
PBEParameterSpec cipherSpec = new PBEParameterSpec(salt.getBytes(CHARSET), iterationCount);
PBEKeySpec keySpec = new PBEKeySpec(password);
SecretKey cipherKey = factory.generateSecret(keySpec);
String maskedPass = PBEUtils.encode64(keystorePassword.getBytes(CHARSET), VAULT_ENC_ALGORITHM, cipherKey, cipherSpec);
return PicketBoxSecurityVault.PASS_MASK_PREFIX + maskedPass;
} | java | {
"resource": ""
} |
q172898 | VaultSession.initSecurityVault | test | private void initSecurityVault() throws Exception {
try {
this.vault = SecurityVaultFactory.get();
this.vault.init(getVaultOptionsMap());
handshake();
} catch (SecurityVaultException e) {
throw SecurityLogger.ROOT_LOGGER.securityVaultException(e);
}
} | java | {
"resource": ""
} |
q172899 | VaultSession.startVaultSession | test | public void startVaultSession(String vaultAlias) throws Exception {
if (vaultAlias == null) {
throw SecurityLogger.ROOT_LOGGER.vaultAliasNotSpecified();
}
this.keystoreMaskedPassword = (org.jboss.security.Util.isPasswordCommand(keystorePassword))
? keystorePassword
: computeMaskedPassword();
this.vaultAlias = vaultAlias;
initSecurityVault();
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.