_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q172900 | VaultSession.attributeCreatedDisplay | test | private void attributeCreatedDisplay(String vaultBlock, String attributeName) {
System.out.println(SecurityLogger.ROOT_LOGGER.vaultAttributeCreateDisplay(vaultBlock, attributeName, securedAttributeConfigurationString(vaultBlock, attributeName)));
} | java | {
"resource": ""
} |
q172901 | VaultSession.vaultConfigurationDisplay | test | public void vaultConfigurationDisplay() {
final String configuration = vaultConfiguration();
System.out.println(SecurityLogger.ROOT_LOGGER.vaultConfigurationTitle());
System.out.println("********************************************");
System.out.println("For standalone mode:");
System.out.println(configuration);
System.out.println("********************************************");
System.out.println("For domain mode:");
System.out.println("/host=the_host" + configuration);
System.out.println("********************************************");
} | java | {
"resource": ""
} |
q172902 | VaultSession.vaultConfiguration | test | public String vaultConfiguration() {
StringBuilder sb = new StringBuilder();
sb.append("/core-service=vault:add(vault-options=[");
sb.append("(\"KEYSTORE_URL\" => \"").append(keystoreURL).append("\")").append(",");
sb.append("(\"KEYSTORE_PASSWORD\" => \"").append(keystoreMaskedPassword).append("\")").append(",");
sb.append("(\"KEYSTORE_ALIAS\" => \"").append(vaultAlias).append("\")").append(",");
sb.append("(\"SALT\" => \"").append(salt).append("\")").append(",");
sb.append("(\"ITERATION_COUNT\" => \"").append(iterationCount).append("\")").append(",");
sb.append("(\"ENC_FILE_DIR\" => \"").append(encryptionDirectory).append("\")");
sb.append("])");
return sb.toString();
} | java | {
"resource": ""
} |
q172903 | ConnectorServices.notNull | test | public static <T> T notNull(T value) {
if (value == null)
throw ConnectorLogger.ROOT_LOGGER.serviceNotStarted();
return value;
} | java | {
"resource": ""
} |
q172904 | ConnectorServices.getDeploymentServiceName | test | public static synchronized ServiceName getDeploymentServiceName(final String raName, final Activation raxml) {
if (raName == null)
throw ConnectorLogger.ROOT_LOGGER.undefinedVar("RaName");
ServiceName serviceName = null;
ModifiableResourceAdapter ra = (ModifiableResourceAdapter) raxml;
if (ra != null && ra.getId() != null) {
serviceName = getDeploymentServiceName(raName,ra.getId());
} else {
serviceName = getDeploymentServiceName(raName,(String)null);
}
ROOT_LOGGER.tracef("ConnectorServices: getDeploymentServiceName(%s,%s) -> %s", raName, raxml,serviceName);
return serviceName;
} | java | {
"resource": ""
} |
q172905 | ConstantAnalysis.insertValue | test | public void insertValue(Any any) {
if (type == String.class)
any.insert_wstring((String) value); // 1.3.5.10 Map to wstring
else
Util.insertAnyPrimitive(any, value);
} | java | {
"resource": ""
} |
q172906 | JndiPermission.implies | test | public boolean implies(final JndiPermission permission) {
return permission != null && ((actionBits & permission.actionBits) == permission.actionBits) && impliesPath(permission.getName());
} | java | {
"resource": ""
} |
q172907 | JndiPermission.getActions | test | public String getActions() {
final String actionString = this.actionString;
if (actionString != null) {
return actionString;
}
int actionBits = this.actionBits;
if (actionBits == ACTION_ALL) {
return this.actionString = "*";
}
int m = Integer.lowestOneBit(actionBits);
if (m != 0) {
StringBuilder b = new StringBuilder();
b.append(getAction(m));
actionBits &= ~m;
while (actionBits != 0) {
m = Integer.lowestOneBit(actionBits);
b.append(',').append(getAction(m));
actionBits &= ~m;
}
return this.actionString = b.toString();
} else {
return this.actionString = "";
}
} | java | {
"resource": ""
} |
q172908 | ServiceMBeanSupport.getName | test | public String getName() {
final String s = log.getName();
final int i = s.lastIndexOf(".");
return i != -1 ? s.substring(i + 1, s.length()) : s;
} | java | {
"resource": ""
} |
q172909 | ServiceMBeanSupport.sendStateChangeNotification | test | private void sendStateChangeNotification(int oldState, int newState, String msg, Throwable t) {
long now = System.currentTimeMillis();
AttributeChangeNotification stateChangeNotification = new AttributeChangeNotification(this,
getNextNotificationSequenceNumber(), now, msg, "State", "java.lang.Integer", new Integer(oldState),
new Integer(newState));
stateChangeNotification.setUserData(t);
sendNotification(stateChangeNotification);
} | java | {
"resource": ""
} |
q172910 | RemoteToCorba.getStateToBind | test | public Object getStateToBind(Object orig, Name name, Context ctx,
Hashtable<?, ?> env) throws NamingException {
if (orig instanceof org.omg.CORBA.Object) {
// Already a CORBA object, just use it
return null;
}
if (orig instanceof Remote) {
// Turn remote object into org.omg.CORBA.Object
try {
// Returns null if JRMP; let next factory try
// CNCtx will eventually throw IllegalArgumentException if
// no CORBA object gotten
return
CorbaUtils.remoteToCorba((Remote) orig, ((CNCtx) ctx)._orb);
} catch (ClassNotFoundException e) {
// RMI-IIOP library not available
throw IIOPLogger.ROOT_LOGGER.unavailableRMIPackages();
}
}
return null; // pass and let next state factory try
} | java | {
"resource": ""
} |
q172911 | ValueConfig.getValue | test | public Object getValue(Type type) {
if (type == null || (type instanceof Class)) {
return getClassValue((Class) type);
} else if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
return getPtValue(pt);
} else {
throw PojoLogger.ROOT_LOGGER.unknownType(type);
}
} | java | {
"resource": ""
} |
q172912 | ComponentDescription.getContextServiceName | test | public ServiceName getContextServiceName() {
if (contextServiceName != null) return contextServiceName;
if (getNamingMode() == ComponentNamingMode.CREATE) {
return ContextNames.contextServiceNameOfComponent(getApplicationName(), getModuleName(), getComponentName());
} else if (getNamingMode() == ComponentNamingMode.USE_MODULE) {
return ContextNames.contextServiceNameOfModule(getApplicationName(), getModuleName());
} else {
throw new IllegalStateException();
}
} | java | {
"resource": ""
} |
q172913 | ComponentDescription.getAllInterceptors | test | public Set<InterceptorDescription> getAllInterceptors() {
if (allInterceptors == null) {
allInterceptors = new HashSet<InterceptorDescription>();
allInterceptors.addAll(classInterceptors);
if (!excludeDefaultInterceptors) {
allInterceptors.addAll(defaultInterceptors);
}
for (List<InterceptorDescription> interceptors : methodInterceptors.values()) {
allInterceptors.addAll(interceptors);
}
}
return allInterceptors;
} | java | {
"resource": ""
} |
q172914 | ComponentDescription.addMethodInterceptor | test | public void addMethodInterceptor(MethodIdentifier method, InterceptorDescription description) {
//we do not add method level interceptors to the set of interceptor classes,
//as their around invoke annotations
List<InterceptorDescription> interceptors = methodInterceptors.get(method);
if (interceptors == null) {
methodInterceptors.put(method, interceptors = new ArrayList<InterceptorDescription>());
}
final String name = description.getInterceptorClassName();
// add the interceptor class to the EEModuleDescription
interceptors.add(description);
this.allInterceptors = null;
} | java | {
"resource": ""
} |
q172915 | ComponentDescription.addDependency | test | public void addDependency(ServiceName serviceName) {
if (serviceName == null) {
throw EeLogger.ROOT_LOGGER.nullVar("serviceName", "component", componentName);
}
dependencies.add(serviceName);
} | java | {
"resource": ""
} |
q172916 | ComponentConfiguration.getComponentInterceptors | test | public List<InterceptorFactory> getComponentInterceptors(Method method) {
Map<Method, OrderedItemContainer<List<InterceptorFactory>>> map = componentInterceptors;
OrderedItemContainer<List<InterceptorFactory>> interceptors = map.get(method);
if (interceptors == null) {
return Collections.emptyList();
}
List<List<InterceptorFactory>> sortedItems = interceptors.getSortedItems();
List<InterceptorFactory> ret = new ArrayList<>();
for(List<InterceptorFactory> item : sortedItems) {
ret.addAll(item);
}
return ret;
} | java | {
"resource": ""
} |
q172917 | ComponentConfiguration.getAroundTimeoutInterceptors | test | public List<InterceptorFactory> getAroundTimeoutInterceptors(Method method) {
Map<Method, OrderedItemContainer<InterceptorFactory>> map = timeoutInterceptors;
OrderedItemContainer<InterceptorFactory> interceptors = map.get(method);
if (interceptors == null) {
return Collections.emptyList();
}
return interceptors.getSortedItems();
} | java | {
"resource": ""
} |
q172918 | ComponentConfiguration.addTimeoutViewInterceptor | test | public void addTimeoutViewInterceptor(final Method method, InterceptorFactory factory, int priority) {
OrderedItemContainer<InterceptorFactory> interceptors = timeoutInterceptors.get(method);
if (interceptors == null) {
timeoutInterceptors.put(method, interceptors = new OrderedItemContainer<InterceptorFactory>());
}
interceptors.add(factory, priority);
} | java | {
"resource": ""
} |
q172919 | ComponentConfiguration.addAroundConstructInterceptor | test | public void addAroundConstructInterceptor(InterceptorFactory interceptorFactory, int priority) {
aroundConstructInterceptors.add(Collections.singletonList(interceptorFactory), priority);
} | java | {
"resource": ""
} |
q172920 | ComponentConfiguration.addPostConstructInterceptor | test | public void addPostConstructInterceptor(InterceptorFactory interceptorFactory, int priority) {
postConstructInterceptors.add(Collections.singletonList(interceptorFactory), priority);
} | java | {
"resource": ""
} |
q172921 | ComponentConfiguration.addPreDestroyInterceptor | test | public void addPreDestroyInterceptor(InterceptorFactory interceptorFactory, int priority) {
preDestroyInterceptors.add(Collections.singletonList(interceptorFactory), priority);
} | java | {
"resource": ""
} |
q172922 | ComponentConfiguration.addPrePassivateInterceptor | test | public void addPrePassivateInterceptor(InterceptorFactory interceptorFactory, int priority) {
prePassivateInterceptors.add(Collections.singletonList(interceptorFactory), priority);
} | java | {
"resource": ""
} |
q172923 | ComponentConfiguration.addPostActivateInterceptor | test | public void addPostActivateInterceptor(InterceptorFactory interceptorFactory, int priority) {
postActivateInterceptors.add(Collections.singletonList(interceptorFactory), priority);
} | java | {
"resource": ""
} |
q172924 | ComponentConfiguration.setComponentCreateServiceFactory | test | public void setComponentCreateServiceFactory(final ComponentCreateServiceFactory componentCreateServiceFactory) {
if (componentCreateServiceFactory == null) {
throw EeLogger.ROOT_LOGGER.nullVar("componentCreateServiceFactory", "component", getComponentName());
}
this.componentCreateServiceFactory = componentCreateServiceFactory;
} | java | {
"resource": ""
} |
q172925 | PooledConnectionFactoryRemove.removeJNDIAliases | test | protected void removeJNDIAliases(OperationContext context, List<ModelNode> entries) {
if (entries.size() > 1) {
for (int i = 1; i < entries.size() ; i++) {
ContextNames.BindInfo aliasBindInfo = ContextNames.bindInfoFor(entries.get(i).asString());
context.removeService(aliasBindInfo.getBinderServiceName());
}
}
} | java | {
"resource": ""
} |
q172926 | EJBClientConfiguratorService.accept | test | public void accept(final EJBClientContext.Builder builder) {
final EJBTransportProvider remoteTransportProvider = this.remoteTransportProvider;
if (remoteTransportProvider != null) {
builder.addTransportProvider(remoteTransportProvider);
builder.addTransportProvider(remoteHttpTransportProvider);
}
} | java | {
"resource": ""
} |
q172927 | ContextNames.contextServiceNameOfComponent | test | public static ServiceName contextServiceNameOfComponent(String app, String module, String comp) {
return COMPONENT_CONTEXT_SERVICE_NAME.append(app, module, comp);
} | java | {
"resource": ""
} |
q172928 | ContextNames.contextServiceNameOfModule | test | public static ServiceName contextServiceNameOfModule(String app, String module) {
return MODULE_CONTEXT_SERVICE_NAME.append(app, module);
} | java | {
"resource": ""
} |
q172929 | ContextNames.bindInfoForEnvEntry | test | public static BindInfo bindInfoForEnvEntry(String app, String module, String comp, boolean useCompNamespace, final String envEntryName) {
if (envEntryName.startsWith("java:")) {
if (useCompNamespace) {
return bindInfoFor(app, module, comp, envEntryName);
} else {
if (envEntryName.startsWith("java:comp")) {
return bindInfoFor(app, module, module, "java:module" + envEntryName.substring("java:comp".length()));
} else {
return bindInfoFor(app, module, module, envEntryName);
}
}
} else {
if (useCompNamespace) {
return bindInfoFor(app, module, comp, "java:comp/env/" + envEntryName);
} else {
return bindInfoFor(app, module, module, "java:module/env/" + envEntryName);
}
}
} | java | {
"resource": ""
} |
q172930 | ContextNames.bindInfoFor | test | public static BindInfo bindInfoFor(final String jndiName) {
// TODO: handle non java: schemes
String bindName;
if (jndiName.startsWith("java:")) {
bindName = jndiName.substring(5);
} else if (!jndiName.startsWith("jboss") && !jndiName.startsWith("global") && !jndiName.startsWith("/")) {
bindName = "/" + jndiName;
} else {
bindName = jndiName;
}
final ServiceName parentContextName;
if(bindName.startsWith("jboss/exported/")) {
parentContextName = EXPORTED_CONTEXT_SERVICE_NAME;
bindName = bindName.substring(15);
} else if (bindName.startsWith("jboss/")) {
parentContextName = JBOSS_CONTEXT_SERVICE_NAME;
bindName = bindName.substring(6);
} else if (bindName.startsWith("global/")) {
parentContextName = GLOBAL_CONTEXT_SERVICE_NAME;
bindName = bindName.substring(7);
} else if (bindName.startsWith("/")) {
parentContextName = JAVA_CONTEXT_SERVICE_NAME;
bindName = bindName.substring(1);
} else {
throw NamingLogger.ROOT_LOGGER.illegalContextInName(jndiName);
}
return new BindInfo(parentContextName, bindName);
} | java | {
"resource": ""
} |
q172931 | DefaultAuthenticationCacheFactory.getCache | test | public ConcurrentMap<Principal, DomainInfo> getCache() {
return new LRUCache<>(1000, (key, value) -> {
if (value != null) {
value.logout();
}
});
} | java | {
"resource": ""
} |
q172932 | ValueDefImpl.getValueMembers | test | private ValueMember[] getValueMembers() {
if (valueMembers != null)
return valueMembers;
LocalContained[] c = _contents(DefinitionKind.dk_ValueMember, false);
valueMembers = new ValueMember[c.length];
for (int i = 0; i < c.length; ++i) {
ValueMemberDefImpl vmdi = (ValueMemberDefImpl) c[i];
valueMembers[i] = new ValueMember(vmdi.name(), vmdi.id(),
((LocalContained) vmdi.defined_in).id(),
vmdi.version(),
vmdi.type(), vmdi.type_def(),
vmdi.access());
}
return valueMembers;
} | java | {
"resource": ""
} |
q172933 | ValueDefImpl.getValueMembersForTypeCode | test | private ValueMember[] getValueMembersForTypeCode() {
LocalContained[] c = _contents(DefinitionKind.dk_ValueMember, false);
ValueMember[] vms = new ValueMember[c.length];
for (int i = 0; i < c.length; ++i) {
ValueMemberDefImpl vmdi = (ValueMemberDefImpl) c[i];
vms[i] = new ValueMember(vmdi.name(),
null, // ignore id
null, // ignore defined_in
null, // ignore version
vmdi.type(),
null, // ignore type_def
vmdi.access());
}
return vms;
} | java | {
"resource": ""
} |
q172934 | AbstractFederationSubsystemReader.createSubsystemRoot | test | private ModelNode createSubsystemRoot() {
ModelNode subsystemAddress = new ModelNode();
subsystemAddress.add(ModelDescriptionConstants.SUBSYSTEM, FederationExtension.SUBSYSTEM_NAME);
subsystemAddress.protect();
return Util.getEmptyOperation(ADD, subsystemAddress);
} | java | {
"resource": ""
} |
q172935 | AbstractFederationSubsystemReader.parseConfig | test | protected ModelNode parseConfig(XMLExtendedStreamReader reader, ModelElement xmlElement, String key, ModelNode lastNode,
List<SimpleAttributeDefinition> attributes, List<ModelNode> addOperations) throws XMLStreamException {
if (!reader.getLocalName().equals(xmlElement.getName())) {
return null;
}
ModelNode modelNode = Util.getEmptyOperation(ADD, null);
int attributeCount = reader.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
String attributeLocalName = reader.getAttributeLocalName(i);
if (ModelElement.forName(attributeLocalName) == null) {
throw unexpectedAttribute(reader, i);
}
}
for (SimpleAttributeDefinition simpleAttributeDefinition : attributes) {
String attributeValue = reader.getAttributeValue("", simpleAttributeDefinition.getXmlName());
simpleAttributeDefinition.parseAndSetParameter(attributeValue, modelNode, reader);
}
String name = xmlElement.getName();
if (key != null) {
name = key;
if (modelNode.hasDefined(key)) {
name = modelNode.get(key).asString();
} else {
String attributeValue = reader.getAttributeValue("", key);
if (attributeValue != null) {
name = attributeValue;
}
}
}
modelNode.get(ModelDescriptionConstants.OP_ADDR).set(lastNode.clone().get(OP_ADDR).add(xmlElement.getName(), name));
addOperations.add(modelNode);
return modelNode;
} | java | {
"resource": ""
} |
q172936 | NamingService.start | test | public void start(StartContext context) throws StartException {
ROOT_LOGGER.startingService();
try {
NamingContext.setActiveNamingStore(namingStore.getValue());
} catch (Throwable t) {
throw new StartException(NamingLogger.ROOT_LOGGER.failedToStart("naming service"), t);
}
} | java | {
"resource": ""
} |
q172937 | WeldComponentIntegrationProcessor.addWeldIntegration | test | private void addWeldIntegration(final Iterable<ComponentIntegrator> componentIntegrators, final ComponentInterceptorSupport componentInterceptorSupport, final ServiceTarget target, final ComponentConfiguration configuration, final ComponentDescription description, final Class<?> componentClass, final String beanName, final ServiceName weldServiceName, final ServiceName weldStartService, final ServiceName beanManagerService, final Set<Class<?>> interceptorClasses, final ClassLoader classLoader, final String beanDeploymentArchiveId) {
final ServiceName serviceName = configuration.getComponentDescription().getServiceName().append("WeldInstantiator");
final ServiceBuilder<?> builder = target.addService(serviceName);
builder.requires(weldStartService);
configuration.setInstanceFactory(WeldManagedReferenceFactory.INSTANCE);
configuration.getStartDependencies().add(new DependencyConfigurator<ComponentStartService>() {
@Override
public void configureDependency(final ServiceBuilder<?> serviceBuilder, ComponentStartService service) throws DeploymentUnitProcessingException {
serviceBuilder.requires(serviceName);
}
});
boolean isComponentIntegrationPerformed = false;
for (ComponentIntegrator componentIntegrator : componentIntegrators) {
Supplier<ServiceName> bindingServiceNameSupplier = () -> {
if (componentInterceptorSupport == null) {
throw WeldLogger.DEPLOYMENT_LOGGER.componentInterceptorSupportNotAvailable(componentClass);
}
return addWeldInterceptorBindingService(target, configuration, componentClass, beanName, weldServiceName, weldStartService,
beanDeploymentArchiveId, componentInterceptorSupport);
};
DefaultInterceptorIntegrationAction integrationAction = (bindingServiceName) -> {
if (componentInterceptorSupport == null) {
throw WeldLogger.DEPLOYMENT_LOGGER.componentInterceptorSupportNotAvailable(componentClass);
}
addJsr299BindingsCreateInterceptor(configuration, description, beanName, weldServiceName, builder, bindingServiceName,
componentInterceptorSupport);
addCommonLifecycleInterceptionSupport(configuration, builder, bindingServiceName, beanManagerService, componentInterceptorSupport);
configuration.addComponentInterceptor(
new UserInterceptorFactory(factory(InterceptionType.AROUND_INVOKE, builder, bindingServiceName, componentInterceptorSupport),
factory(InterceptionType.AROUND_TIMEOUT, builder, bindingServiceName, componentInterceptorSupport)),
InterceptorOrder.Component.CDI_INTERCEPTORS, false);
};
if (componentIntegrator.integrate(beanManagerService, configuration, description, builder, bindingServiceNameSupplier, integrationAction,
componentInterceptorSupport)) {
isComponentIntegrationPerformed = true;
break;
}
} | java | {
"resource": ""
} |
q172938 | BatchServiceNames.jobOperatorServiceName | test | public static ServiceName jobOperatorServiceName(final String deploymentRuntimeName, final String subdeploymentName) {
return Services.deploymentUnitName(deploymentRuntimeName, subdeploymentName).append("batch").append("job-operator");
} | java | {
"resource": ""
} |
q172939 | EEApplicationDescription.addComponent | test | public void addComponent(final ComponentDescription description, final VirtualFile deploymentRoot) {
for (final ViewDescription viewDescription : description.getViews()) {
List<ViewInformation> viewComponents = componentsByViewName.get(viewDescription.getViewClassName());
if (viewComponents == null) {
viewComponents = new ArrayList<ViewInformation>(1);
componentsByViewName.put(viewDescription.getViewClassName(), viewComponents);
}
viewComponents.add(new ViewInformation(viewDescription, deploymentRoot, description.getComponentName()));
}
List<Description> components = componentsByName.get(description.getComponentName());
if (components == null) {
componentsByName.put(description.getComponentName(), components = new ArrayList<Description>(1));
}
components.add(new Description(description, deploymentRoot));
} | java | {
"resource": ""
} |
q172940 | EEApplicationDescription.addMessageDestination | test | public void addMessageDestination(final String name, final String resolvedName, final VirtualFile deploymentRoot) {
List<MessageDestinationMapping> components = messageDestinationJndiMapping.get(name);
if (components == null) {
messageDestinationJndiMapping.put(name, components = new ArrayList<MessageDestinationMapping>(1));
}
components.add(new MessageDestinationMapping(resolvedName, deploymentRoot));
} | java | {
"resource": ""
} |
q172941 | EEApplicationDescription.getComponentsForViewName | test | public Set<ViewDescription> getComponentsForViewName(final String viewType, final VirtualFile deploymentRoot) {
final List<ViewInformation> info = componentsByViewName.get(viewType);
if (info == null) {
return Collections.<ViewDescription>emptySet();
}
final Set<ViewDescription> ret = new HashSet<ViewDescription>();
final Set<ViewDescription> currentDep = new HashSet<ViewDescription>();
for (ViewInformation i : info) {
if (deploymentRoot.equals(i.deploymentRoot)) {
currentDep.add(i.viewDescription);
}
ret.add(i.viewDescription);
}
if(!currentDep.isEmpty()) {
return currentDep;
}
return ret;
} | java | {
"resource": ""
} |
q172942 | EEApplicationDescription.getComponents | test | public Set<ComponentDescription> getComponents(final String componentName, final VirtualFile deploymentRoot) {
if (componentName.contains("#")) {
final String[] parts = componentName.split("#");
String path = parts[0];
if (!path.startsWith("../")) {
path = "../" + path;
}
final VirtualFile virtualPath = deploymentRoot.getChild(path);
final String name = parts[1];
final List<Description> info = componentsByName.get(name);
if (info == null) {
return Collections.emptySet();
}
final Set<ComponentDescription> ret = new HashSet<ComponentDescription>();
for (Description i : info) {
//now we need to check the path
if (virtualPath.equals(i.deploymentRoot)) {
ret.add(i.componentDescription);
}
}
return ret;
} else {
final List<Description> info = componentsByName.get(componentName);
if (info == null) {
return Collections.emptySet();
}
final Set<ComponentDescription> all = new HashSet<ComponentDescription>();
final Set<ComponentDescription> thisDeployment = new HashSet<ComponentDescription>();
for (Description i : info) {
all.add(i.componentDescription);
if (i.deploymentRoot.equals(deploymentRoot)) {
thisDeployment.add(i.componentDescription);
}
}
//if there are multiple e
if (all.size() > 1) {
return thisDeployment;
}
return all;
}
} | java | {
"resource": ""
} |
q172943 | EEApplicationDescription.getComponents | test | public Set<ViewDescription> getComponents(final String componentName, final String viewName, final VirtualFile deploymentRoot) {
final List<ViewInformation> info = componentsByViewName.get(viewName);
if (info == null) {
return Collections.<ViewDescription>emptySet();
}
if (componentName.contains("#")) {
final String[] parts = componentName.split("#");
String path = parts[0];
if (!path.startsWith("../")) {
path = "../" + path;
}
final VirtualFile virtualPath = deploymentRoot.getChild(path);
final String name = parts[1];
final Set<ViewDescription> ret = new HashSet<ViewDescription>();
for (ViewInformation i : info) {
if (i.beanName.equals(name)) {
//now we need to check the path
if (virtualPath.equals(i.deploymentRoot)) {
ret.add(i.viewDescription);
}
}
}
return ret;
} else {
final Set<ViewDescription> all = new HashSet<ViewDescription>();
final Set<ViewDescription> thisDeployment = new HashSet<ViewDescription>();
for (ViewInformation i : info) {
if (i.beanName.equals(componentName)) {
all.add(i.viewDescription);
if (i.deploymentRoot.equals(deploymentRoot)) {
thisDeployment.add(i.viewDescription);
}
}
}
if (all.size() > 1) {
return thisDeployment;
}
return all;
}
} | java | {
"resource": ""
} |
q172944 | EEApplicationDescription.resolveMessageDestination | test | public Set<String> resolveMessageDestination(final String messageDestName, final VirtualFile deploymentRoot) {
if (messageDestName.contains("#")) {
final String[] parts = messageDestName.split("#");
String path = parts[0];
if (!path.startsWith("../")) {
path = "../" + path;
}
final VirtualFile virtualPath = deploymentRoot.getChild(path);
final String name = parts[1];
final Set<String> ret = new HashSet<String>();
final List<MessageDestinationMapping> data = messageDestinationJndiMapping.get(name);
if (data != null) {
for (final MessageDestinationMapping i : data) {
//now we need to check the path
if (virtualPath.equals(i.deploymentRoot)) {
ret.add(i.jndiName);
}
}
}
return ret;
} else {
final Set<String> all = new HashSet<String>();
final Set<String> thisDeployment = new HashSet<String>();
final List<MessageDestinationMapping> data = messageDestinationJndiMapping.get(messageDestName);
if (data != null) {
for (final MessageDestinationMapping i : data) {
all.add(i.jndiName);
if (i.deploymentRoot.equals(deploymentRoot)) {
thisDeployment.add(i.jndiName);
}
}
}
if (all.size() > 1) {
return thisDeployment;
}
return all;
}
} | java | {
"resource": ""
} |
q172945 | MessagingTransformers.buildTransformers2_1_0 | test | private static void buildTransformers2_1_0(ResourceTransformationDescriptionBuilder builder) {
ResourceTransformationDescriptionBuilder hornetqServer = builder.addChildResource(pathElement(HORNETQ_SERVER));
ResourceTransformationDescriptionBuilder addressSetting = hornetqServer.addChildResource(AddressSettingDefinition.PATH);
rejectDefinedAttributeWithDefaultValue(addressSetting, MAX_REDELIVERY_DELAY, REDELIVERY_MULTIPLIER);
ResourceTransformationDescriptionBuilder bridge = hornetqServer.addChildResource(BridgeDefinition.PATH);
bridge.getAttributeBuilder().setValueConverter(new DoubleToBigDecimalConverter(), RETRY_INTERVAL_MULTIPLIER);
ResourceTransformationDescriptionBuilder clusterConnection = hornetqServer.addChildResource(ClusterConnectionDefinition.PATH);
clusterConnection.getAttributeBuilder().setValueConverter(new DoubleToBigDecimalConverter(), RETRY_INTERVAL_MULTIPLIER);
ResourceTransformationDescriptionBuilder connectionFactory = hornetqServer.addChildResource(ConnectionFactoryDefinition.PATH);
connectionFactory.getAttributeBuilder().setValueConverter(new DoubleToBigDecimalConverter(), RETRY_INTERVAL_MULTIPLIER);
ResourceTransformationDescriptionBuilder pooledConnectionFactory = hornetqServer.addChildResource(PooledConnectionFactoryDefinition.PATH);
pooledConnectionFactory.getAttributeBuilder().setValueConverter(new DoubleToBigDecimalConverter(), RETRY_INTERVAL_MULTIPLIER);
} | java | {
"resource": ""
} |
q172946 | MessagingTransformers.rejectDefinedAttributeWithDefaultValue | test | private static void rejectDefinedAttributeWithDefaultValue(ResourceTransformationDescriptionBuilder builder, AttributeDefinition... attrs) {
for (AttributeDefinition attr : attrs) {
builder.getAttributeBuilder()
.setDiscard(new DiscardAttributeValueChecker(attr.getDefaultValue()), attr)
.addRejectCheck(DEFINED, attr);
}
} | java | {
"resource": ""
} |
q172947 | MessagingTransformers.renameAttribute | test | private static void renameAttribute(ResourceTransformationDescriptionBuilder builder,
AttributeDefinition attribute, AttributeDefinition alias) {
builder.getAttributeBuilder().addRename(attribute, alias.getName());
} | java | {
"resource": ""
} |
q172948 | ConnectionSecurityContext.popIdentity | test | public static void popIdentity(final ContextStateCache stateCache) {
RemotingContext.setConnection(stateCache.getConnection());
SecurityContextAssociation.setSecurityContext(stateCache.getSecurityContext());
} | java | {
"resource": ""
} |
q172949 | JSFModuleIdFactory.loadIdsManually | test | private void loadIdsManually() {
implIds.put("main", ModuleIdentifier.create(IMPL_MODULE));
apiIds.put("main", ModuleIdentifier.create(API_MODULE));
injectionIds.put("main", ModuleIdentifier.create(INJECTION_MODULE));
allVersions.add("main");
activeVersions.add("main");
} | java | {
"resource": ""
} |
q172950 | JSFModuleIdFactory.checkVersionIntegrity | test | private void checkVersionIntegrity() {
activeVersions.addAll(allVersions);
for (String version : allVersions) {
if (!apiIds.containsKey(version)) {
JSFLogger.ROOT_LOGGER.missingJSFModule(version, API_MODULE);
activeVersions.remove(version);
}
if (!implIds.containsKey(version)) {
JSFLogger.ROOT_LOGGER.missingJSFModule(version, IMPL_MODULE);
activeVersions.remove(version);
}
if (!injectionIds.containsKey(version)) {
JSFLogger.ROOT_LOGGER.missingJSFModule(version, INJECTION_MODULE);
activeVersions.remove(version);
}
}
} | java | {
"resource": ""
} |
q172951 | JSFModuleIdFactory.computeSlot | test | String computeSlot(String jsfVersion) {
if (jsfVersion == null) return defaultSlot;
if (JsfVersionMarker.JSF_2_0.equals(jsfVersion)) return defaultSlot;
return jsfVersion;
} | java | {
"resource": ""
} |
q172952 | InterfaceRepository.getConstantTypeCode | test | private TypeCode getConstantTypeCode(Class cls)
throws IRConstructionException {
if (cls == null)
throw IIOPLogger.ROOT_LOGGER.invalidNullClass();
TypeCode ret = constantTypeCodeMap.get(cls);
if (ret == null)
throw IIOPLogger.ROOT_LOGGER.badClassForConstant(cls.getName());
return ret;
} | java | {
"resource": ""
} |
q172953 | InterfaceRepository.addTypeCode | test | private void addTypeCode(Class cls, TypeCode typeCode)
throws IRConstructionException {
if (cls == null)
throw IIOPLogger.ROOT_LOGGER.invalidNullClass();
TypeCode tc = (TypeCode) typeCodeMap.get(cls);
if (tc != null)
throw IIOPLogger.ROOT_LOGGER.duplicateTypeCodeForClass(cls.getName());
typeCodeMap.put(cls, typeCode);
} | java | {
"resource": ""
} |
q172954 | InterfaceRepository.ensurePackageExists | test | private ModuleDefImpl ensurePackageExists(LocalContainer c,
String previous,
String remainder)
throws IRConstructionException {
if ("".equals(remainder))
return (ModuleDefImpl) c; // done
int idx = remainder.indexOf('.');
String base;
if (idx == -1)
base = remainder;
else
base = remainder.substring(0, idx);
base = Util.javaToIDLName(base);
if (previous.equals(""))
previous = base;
else
previous = previous + "/" + base;
if (idx == -1)
remainder = "";
else
remainder = remainder.substring(idx + 1);
LocalContainer next = null;
LocalContained contained = (LocalContained) c._lookup(base);
if (contained instanceof LocalContainer)
next = (LocalContainer) contained;
else if (contained != null)
throw IIOPLogger.ROOT_LOGGER.collisionWhileCreatingPackage();
if (next == null) {
String id = "IDL:" + previous + ":1.0";
// Create module
ModuleDefImpl m = new ModuleDefImpl(id, base, "1.0", c, impl);
c.add(base, m);
if (idx == -1)
return m; // done
next = (LocalContainer) c._lookup(base); // Better be there now...
} else // Check that next _is_ a module
if (next.def_kind() != DefinitionKind.dk_Module)
throw IIOPLogger.ROOT_LOGGER.collisionWhileCreatingPackage();
return ensurePackageExists(next, previous, remainder);
} | java | {
"resource": ""
} |
q172955 | InterfaceRepository.addInterfaces | test | private String[] addInterfaces(ContainerAnalysis ca)
throws RMIIIOPViolationException, IRConstructionException {
InterfaceAnalysis[] interfaces = ca.getInterfaces();
List base_interfaces = new ArrayList();
for (int i = 0; i < interfaces.length; ++i) {
InterfaceDefImpl idi = addInterface(interfaces[i]);
base_interfaces.add(idi.id());
}
String[] strArr = new String[base_interfaces.size()];
return (String[]) base_interfaces.toArray(strArr);
} | java | {
"resource": ""
} |
q172956 | InterfaceRepository.addAbstractBaseValuetypes | test | private String[] addAbstractBaseValuetypes(ContainerAnalysis ca)
throws RMIIIOPViolationException, IRConstructionException {
ValueAnalysis[] abstractValuetypes = ca.getAbstractBaseValuetypes();
List abstract_base_valuetypes = new ArrayList();
for (int i = 0; i < abstractValuetypes.length; ++i) {
ValueDefImpl vdi = addValue(abstractValuetypes[i]);
abstract_base_valuetypes.add(vdi.id());
}
String[] strArr = new String[abstract_base_valuetypes.size()];
return (String[]) abstract_base_valuetypes.toArray(strArr);
} | java | {
"resource": ""
} |
q172957 | InterfaceRepository.addClass | test | private void addClass(Class cls)
throws RMIIIOPViolationException, IRConstructionException {
if (cls.isPrimitive())
return; // No need to add primitives.
if (cls.isArray()) {
// Add array mapping
addArray(cls);
} else if (cls.isInterface()) {
if (!RmiIdlUtil.isAbstractValueType(cls)) {
// Analyse the interface
InterfaceAnalysis ia = InterfaceAnalysis.getInterfaceAnalysis(cls);
// Add analyzed interface (which may be abstract)
addInterface(ia);
} else {
// Analyse the value
ValueAnalysis va = ValueAnalysis.getValueAnalysis(cls);
// Add analyzed value
addValue(va);
}
} else if (Exception.class.isAssignableFrom(cls)) { // Exception type.
// Analyse the exception
ExceptionAnalysis ea = ExceptionAnalysis.getExceptionAnalysis(cls);
// Add analyzed exception
addException(ea);
} else { // Got to be a value type.
// Analyse the value
ValueAnalysis va = ValueAnalysis.getValueAnalysis(cls);
// Add analyzed value
addValue(va);
}
} | java | {
"resource": ""
} |
q172958 | InterfaceRepository.addInterface | test | private InterfaceDefImpl addInterface(InterfaceAnalysis ia)
throws RMIIIOPViolationException, IRConstructionException {
InterfaceDefImpl iDef;
Class cls = ia.getCls();
// Lookup: Has it already been added?
iDef = (InterfaceDefImpl) interfaceMap.get(cls);
if (iDef != null)
return iDef; // Yes, just return it.
// Get module to add interface to.
ModuleDefImpl m = ensurePackageExists(cls.getPackage().getName());
// Add superinterfaces
String[] base_interfaces = addInterfaces(ia);
// Create the interface
String base = cls.getName();
base = base.substring(base.lastIndexOf('.') + 1);
base = Util.javaToIDLName(base);
iDef = new InterfaceDefImpl(ia.getRepositoryId(),
base, "1.0", m,
base_interfaces, impl);
addTypeCode(cls, iDef.type());
m.add(base, iDef);
interfaceMap.put(cls, iDef); // Remember we mapped this.
// Fill in constants
addConstants(iDef, ia);
// Add attributes
addAttributes(iDef, ia);
// Fill in operations
addOperations(iDef, ia);
return iDef;
} | java | {
"resource": ""
} |
q172959 | InterfaceRepository.addValue | test | private ValueDefImpl addValue(ValueAnalysis va)
throws RMIIIOPViolationException, IRConstructionException {
ValueDefImpl vDef;
Class cls = va.getCls();
// Lookup: Has it already been added?
vDef = (ValueDefImpl) valueMap.get(cls);
if (vDef != null)
return vDef; // Yes, just return it.
// Get module to add value to.
ModuleDefImpl m = ensurePackageExists(cls.getPackage().getName());
// Add implemented interfaces
String[] supported_interfaces = addInterfaces(va);
// Add abstract base valuetypes
String[] abstract_base_valuetypes = addAbstractBaseValuetypes(va);
// Add superclass
ValueDefImpl superValue = null;
ValueAnalysis superAnalysis = va.getSuperAnalysis();
if (superAnalysis != null)
superValue = addValue(superAnalysis);
// Create the value
String base = cls.getName();
base = base.substring(base.lastIndexOf('.') + 1);
base = Util.javaToIDLName(base);
TypeCode baseTypeCode;
if (superValue == null)
baseTypeCode = orb.get_primitive_tc(TCKind.tk_null);
else
baseTypeCode = superValue.type();
vDef = new ValueDefImpl(va.getRepositoryId(), base, "1.0",
m,
va.isAbstractValue(),
va.isCustom(),
supported_interfaces,
abstract_base_valuetypes,
baseTypeCode,
impl);
addTypeCode(cls, vDef.type());
m.add(base, vDef);
valueMap.put(cls, vDef); // Remember we mapped this.
// Fill in constants.
addConstants(vDef, va);
// Add value members
ValueMemberAnalysis[] vmas = va.getMembers();
for (int i = 0; i < vmas.length; ++i) {
ValueMemberDefImpl vmDef;
String vmid = va.getMemberRepositoryId(vmas[i].getJavaName());
String vmName = vmas[i].getIDLName();
Class vmCls = vmas[i].getCls();
TypeCode typeCode = getTypeCode(vmCls);
boolean vmPublic = vmas[i].isPublic();
vmDef = new ValueMemberDefImpl(vmid, vmName, "1.0",
typeCode, vmPublic, vDef, impl);
vDef.add(vmName, vmDef);
}
// Add attributes
addAttributes(vDef, va);
// TODO: Fill in operations.
return vDef;
} | java | {
"resource": ""
} |
q172960 | InterfaceRepository.addException | test | private ExceptionDefImpl addException(ExceptionAnalysis ea)
throws RMIIIOPViolationException, IRConstructionException {
ExceptionDefImpl eDef;
Class cls = ea.getCls();
// Lookup: Has it already been added?
eDef = (ExceptionDefImpl) exceptionMap.get(cls);
if (eDef != null)
return eDef; // Yes, just return it.
// 1.3.7.1: map to value
ValueDefImpl vDef = addValue(ea);
// 1.3.7.2: map to exception
ModuleDefImpl m = ensurePackageExists(cls.getPackage().getName());
String base = cls.getName();
base = base.substring(base.lastIndexOf('.') + 1);
if (base.endsWith("Exception"))
base = base.substring(0, base.length() - 9);
base = Util.javaToIDLName(base + "Ex");
StructMember[] members = new StructMember[1];
members[0] = new StructMember("value", vDef.type(), null/*ignored*/);
TypeCode typeCode
= orb.create_exception_tc(ea.getExceptionRepositoryId(),
base, members);
eDef = new ExceptionDefImpl(ea.getExceptionRepositoryId(), base, "1.0",
typeCode, vDef, m, impl);
m.add(base, eDef);
exceptionMap.put(cls, eDef); // Remember we mapped this.
return eDef;
} | java | {
"resource": ""
} |
q172961 | JPAAnnotationProcessor.getClassLevelInjectionType | test | private String getClassLevelInjectionType(final AnnotationInstance annotation) {
boolean isPC = annotation.name().local().equals("PersistenceContext");
return isPC ? ENTITY_MANAGER_CLASS : ENTITY_MANAGERFACTORY_CLASS;
} | java | {
"resource": ""
} |
q172962 | WeldSubsystemAdd.checkJtsEnabled | test | private boolean checkJtsEnabled(final OperationContext context) {
try {
final ModelNode jtsNode = context.readResourceFromRoot(PathAddress.pathAddress("subsystem", "transactions"), false)
.getModel().get("jts");
return jtsNode.isDefined() ? jtsNode.asBoolean() : false;
} catch (NoSuchResourceException ex) {
return false;
}
} | java | {
"resource": ""
} |
q172963 | NamingStoreService.start | test | public void start(final StartContext context) throws StartException {
if(store == null) {
final ServiceRegistry serviceRegistry = context.getController().getServiceContainer();
final ServiceName serviceNameBase = context.getController().getName();
final ServiceTarget serviceTarget = context.getChildTarget();
store = readOnly ? new ServiceBasedNamingStore(serviceRegistry, serviceNameBase) : new WritableServiceBasedNamingStore(serviceRegistry, serviceNameBase, serviceTarget);
}
} | java | {
"resource": ""
} |
q172964 | NamingStoreService.stop | test | public void stop(StopContext context) {
if(store != null) {
try {
store.close();
store = null;
} catch (NamingException e) {
throw NamingLogger.ROOT_LOGGER.failedToDestroyRootContext(e);
}
}
} | java | {
"resource": ""
} |
q172965 | AllowedMethodsInformation.checkAllowed | test | public static void checkAllowed(final MethodType methodType) {
final InterceptorContext context = CurrentInvocationContext.get();
if (context == null) {
return;
}
final Component component = context.getPrivateData(Component.class);
if (!(component instanceof EJBComponent)) {
return;
}
final InvocationType invocationType = context.getPrivateData(InvocationType.class);
((EJBComponent) component).getAllowedMethodsInformation().realCheckPermission(methodType, invocationType);
} | java | {
"resource": ""
} |
q172966 | AllowedMethodsInformation.checkTransactionSync | test | private void checkTransactionSync(MethodType methodType) {
//first we have to check the synchronization status
//as the sync is not affected by the current invocation
final CurrentSynchronizationCallback.CallbackType currentSync = CurrentSynchronizationCallback.get();
if (currentSync != null) {
if (deniedSyncMethods.contains(new DeniedSyncMethodKey(currentSync, methodType))) {
throwException(methodType, currentSync);
}
}
} | java | {
"resource": ""
} |
q172967 | WebComponentProcessor.getAllComponentClasses | test | private Set<String> getAllComponentClasses(DeploymentUnit deploymentUnit, CompositeIndex index, WarMetaData metaData, TldsMetaData tldsMetaData) {
final Set<String> classes = new HashSet<String>();
getAllComponentClasses(metaData.getMergedJBossWebMetaData(), classes);
if (tldsMetaData == null)
return classes;
if (tldsMetaData.getSharedTlds(deploymentUnit) != null)
for (TldMetaData tldMetaData : tldsMetaData.getSharedTlds(deploymentUnit)) {
getAllComponentClasses(tldMetaData, classes);
}
if (tldsMetaData.getTlds() != null)
for (Map.Entry<String, TldMetaData> tldMetaData : tldsMetaData.getTlds().entrySet()) {
getAllComponentClasses(tldMetaData.getValue(), classes);
}
getAllAsyncListenerClasses(index, classes);
return classes;
} | java | {
"resource": ""
} |
q172968 | TimerServiceImpl.getWaitingOnTxCompletionTimers | test | private Map<String, TimerImpl> getWaitingOnTxCompletionTimers() {
Map<String, TimerImpl> timers = null;
if (getTransaction() != null) {
timers = (Map<String, TimerImpl>) tsr.getResource(waitingOnTxCompletionKey);
}
return timers == null ? Collections.<String, TimerImpl>emptyMap() : timers;
} | java | {
"resource": ""
} |
q172969 | TransportConfigOperationHandlers.getExtraParameters | test | private static Map<String, Object> getExtraParameters(final Set<String> allowedKeys, final Map<String, Object> parameters) {
Map<String, Object> extraParameters = new HashMap<>();
for(Map.Entry<String, Object> parameter : parameters.entrySet()) {
if(!allowedKeys.contains(parameter.getKey())) {
extraParameters.put(parameter.getKey(), parameter.getValue());
}
}
for (String extraParam : extraParameters.keySet()) {
parameters.remove(extraParam);
}
return extraParameters;
} | java | {
"resource": ""
} |
q172970 | TransportConfigOperationHandlers.getParameters | test | public static Map<String, Object> getParameters(final OperationContext context, final ModelNode config, final Map<String, String> mapping) throws OperationFailedException {
Map<String, String> fromModel = CommonAttributes.PARAMS.unwrap(context, config);
Map<String, Object> parameters = new HashMap<>();
for (Map.Entry<String, String> entry : fromModel.entrySet()) {
parameters.put(mapping.getOrDefault(entry.getKey(), entry.getKey()), entry.getValue());
}
return parameters;
} | java | {
"resource": ""
} |
q172971 | Configurator.toClass | test | public static Class<?> toClass(Type type) {
if (type instanceof Class) {
return (Class) type;
} else if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
return toClass(pt.getRawType());
} else {
throw PojoLogger.ROOT_LOGGER.unknownType(type);
}
} | java | {
"resource": ""
} |
q172972 | Configurator.convertValue | test | @SuppressWarnings("unchecked")
public static Object convertValue(Class<?> clazz, Object value, boolean replaceProperties, boolean trim) throws Throwable {
if (clazz == null)
return value;
if (value == null)
return null;
Class<?> valueClass = value.getClass();
// If we have a string, trim and replace any system properties when requested
if (valueClass == String.class) {
String string = (String) value;
if (trim)
string = string.trim();
if (replaceProperties)
value = PropertiesValueResolver.replaceProperties(string);
}
if (clazz.isAssignableFrom(valueClass))
return value;
// First see if this is an Enum
if (clazz.isEnum()) {
Class<? extends Enum> eclazz = clazz.asSubclass(Enum.class);
return Enum.valueOf(eclazz, value.toString());
}
// Next look for a property editor
if (valueClass == String.class) {
PropertyEditor editor = PropertyEditorManager.findEditor(clazz);
if (editor != null) {
editor.setAsText((String) value);
return editor.getValue();
}
}
// Try a static clazz.valueOf(value)
try {
Method method = clazz.getMethod("valueOf", valueClass);
int modifiers = method.getModifiers();
if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers)
&& clazz.isAssignableFrom(method.getReturnType()))
return method.invoke(null, value);
} catch (Exception ignored) {
}
if (valueClass == String.class) {
try {
Constructor constructor = clazz.getConstructor(valueClass);
if (Modifier.isPublic(constructor.getModifiers()))
return constructor.newInstance(value);
} catch (Exception ignored) {
}
}
return value;
} | java | {
"resource": ""
} |
q172973 | Configurator.getTypes | test | public static String[] getTypes(ValueConfig[] values) {
if (values == null || values.length == 0)
return NO_PARAMS_TYPES;
String[] types = new String[values.length];
for (int i =0; i < types.length; i++)
types[i] = values[i].getType();
return types;
} | java | {
"resource": ""
} |
q172974 | Configurator.simpleCheck | test | protected static boolean simpleCheck(String[] typeNames, Class<?>[] typeInfos) {
return typeNames != null && typeInfos != null && typeNames.length == typeInfos.length;
} | java | {
"resource": ""
} |
q172975 | CNBindingEnumeration.next | test | public java.lang.Object next() throws NamingException {
if (more && counter >= _bindingList.value.length) {
getMore();
}
if (more && counter < _bindingList.value.length) {
org.omg.CosNaming.Binding bndg = _bindingList.value[counter];
counter++;
return mapBinding(bndg);
} else {
throw new NoSuchElementException();
}
} | java | {
"resource": ""
} |
q172976 | CNBindingEnumeration.getMore | test | private boolean getMore() throws NamingException {
try {
more = _bindingIter.next_n(batchsize, _bindingList);
counter = 0; // reset
} catch (Exception e) {
more = false;
NamingException ne = IIOPLogger.ROOT_LOGGER.errorGettingBindingList();
ne.setRootCause(e);
throw ne;
}
return more;
} | java | {
"resource": ""
} |
q172977 | CNBindingEnumeration.mapBinding | test | private javax.naming.Binding mapBinding(org.omg.CosNaming.Binding bndg)
throws NamingException {
java.lang.Object obj = _ctx.callResolve(bndg.binding_name);
Name cname = org.wildfly.iiop.openjdk.naming.jndi.CNNameParser.cosNameToName(bndg.binding_name);
try {
obj = NamingManager.getObjectInstance(obj, cname, _ctx, _env);
} catch (NamingException e) {
throw e;
} catch (Exception e) {
NamingException ne = IIOPLogger.ROOT_LOGGER.errorGeneratingObjectViaFactory();
ne.setRootCause(e);
throw ne;
}
// Use cname.toString() instead of bindingName because the name
// in the binding should be a composite name
String cnameStr = cname.toString();
javax.naming.Binding jbndg = new javax.naming.Binding(cnameStr, obj);
NameComponent[] comps = _ctx.makeFullName(bndg.binding_name);
String fullName = org.wildfly.iiop.openjdk.naming.jndi.CNNameParser.cosNameToInsString(comps);
jbndg.setNameInNamespace(fullName);
return jbndg;
} | java | {
"resource": ""
} |
q172978 | CDIExtension.observeResources | test | public void observeResources(@Observes @WithAnnotations({Health.class}) ProcessAnnotatedType<? extends HealthCheck> event) {
AnnotatedType<? extends HealthCheck> annotatedType = event.getAnnotatedType();
Class<? extends HealthCheck> javaClass = annotatedType.getJavaClass();
MicroProfileHealthLogger.LOGGER.infof("Discovered health check procedure %s", javaClass);
delegates.add(annotatedType);
} | java | {
"resource": ""
} |
q172979 | CDIExtension.close | test | public void close(@Observes final BeforeShutdown bs) {
healthCheckInstances.forEach(healthCheck -> {
healthReporter.removeHealthCheck(healthCheck.get());
healthCheck.preDestroy().dispose();
});
healthCheckInstances.clear();
} | java | {
"resource": ""
} |
q172980 | EjbIIOPService.referenceForLocator | test | public org.omg.CORBA.Object referenceForLocator(final EJBLocator<?> locator) {
final EJBComponent ejbComponent = ejbComponentInjectedValue.getValue();
try {
final String earApplicationName = ejbComponent.getEarApplicationName() == null ? "" : ejbComponent.getEarApplicationName();
if (locator.getBeanName().equals(ejbComponent.getComponentName()) &&
locator.getAppName().equals(earApplicationName) &&
locator.getModuleName().equals(ejbComponent.getModuleName()) &&
locator.getDistinctName().equals(ejbComponent.getDistinctName())) {
if (locator instanceof EJBHomeLocator) {
return (org.omg.CORBA.Object) ejbHome;
} else if (locator instanceof StatelessEJBLocator) {
return beanReferenceFactory.createReference(beanRepositoryIds[0]);
} else if (locator instanceof StatefulEJBLocator) {
final Marshaller marshaller = factory.createMarshaller(configuration);
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
marshaller.start(new OutputStreamByteOutput(stream));
marshaller.writeObject(((StatefulEJBLocator<?>) locator).getSessionId());
marshaller.finish();
return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
} else if (locator instanceof EntityEJBLocator) {
final Marshaller marshaller = factory.createMarshaller(configuration);
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
marshaller.start(new OutputStreamByteOutput(stream));
marshaller.writeObject(((EntityEJBLocator<?>) locator).getPrimaryKey());
marshaller.finish();
return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
}
throw EjbLogger.ROOT_LOGGER.unknownEJBLocatorType(locator);
} else {
throw EjbLogger.ROOT_LOGGER.incorrectEJBLocatorForBean(locator, ejbComponent.getComponentName());
}
} catch (Exception e) {
throw EjbLogger.ROOT_LOGGER.couldNotCreateCorbaObject(e, locator);
}
} | java | {
"resource": ""
} |
q172981 | EjbIIOPService.handleForLocator | test | public Object handleForLocator(final EJBLocator<?> locator) {
final org.omg.CORBA.Object reference = referenceForLocator(locator);
if(locator instanceof EJBHomeLocator) {
return new HomeHandleImplIIOP(orb.getValue().object_to_string(reference));
}
return new HandleImplIIOP(orb.getValue().object_to_string(reference));
} | java | {
"resource": ""
} |
q172982 | ModelNodes.asEnum | test | public static <E extends Enum<E>> E asEnum(ModelNode value, Class<E> targetClass) {
return Enum.valueOf(targetClass, value.asString());
} | java | {
"resource": ""
} |
q172983 | Utils.skip | test | public static void skip(InputStream is, long amount) throws IOException {
long leftToSkip = amount;
long amountSkipped = 0;
while(leftToSkip > 0 && amountSkipped >= 0){
amountSkipped = is.skip(leftToSkip);
leftToSkip -= amountSkipped;
}
} | java | {
"resource": ""
} |
q172984 | Messaging13SubsystemParser.checkNotBothElements | test | protected static void checkNotBothElements(XMLExtendedStreamReader reader, Set<Element> seen, Element element1, Element element2) throws XMLStreamException {
if (seen.contains(element1) && seen.contains(element2)) {
throw new XMLStreamException(MessagingLogger.ROOT_LOGGER.onlyOneRequired(element1.getLocalName(), element2.getLocalName()), reader.getLocation());
}
} | java | {
"resource": ""
} |
q172985 | EEModuleDescription.addComponent | test | public void addComponent(ComponentDescription description) {
final String componentName = description.getComponentName();
final String componentClassName = description.getComponentClassName();
if (componentName == null) {
throw EeLogger.ROOT_LOGGER.nullVar("componentName", "module", moduleName);
}
if (componentClassName == null) {
throw EeLogger.ROOT_LOGGER.nullVar("componentClassName","module", moduleName);
}
if (componentsByName.containsKey(componentName)) {
throw EeLogger.ROOT_LOGGER.componentAlreadyDefined(componentName);
}
componentsByName.put(componentName, description);
List<ComponentDescription> list = componentsByClassName.get(componentClassName);
if (list == null) {
componentsByClassName.put(componentClassName, list = new ArrayList<ComponentDescription>(1));
}
list.add(description);
} | java | {
"resource": ""
} |
q172986 | ModuleGroupSingletonProvider.addClassLoaders | test | public static void addClassLoaders(ClassLoader topLevel, Set<ClassLoader> allClassLoaders) {
deploymentClassLoaders.put(topLevel, allClassLoaders);
} | java | {
"resource": ""
} |
q172987 | InMemoryNamingStore.unbind | test | public void unbind(final Name name) throws NamingException {
if (isLastComponentEmpty(name)) {
throw emptyNameException();
}
writeLock.lock();
try {
root.accept(new UnbindVisitor(name));
} finally {
writeLock.unlock();
}
} | java | {
"resource": ""
} |
q172988 | InMemoryNamingStore.lookup | test | public Object lookup(final Name name) throws NamingException {
if (isEmpty(name)) {
final Name emptyName = new CompositeName("");
return new NamingContext(emptyName, this, new Hashtable<String, Object>());
}
return root.accept(new LookupVisitor(name));
} | java | {
"resource": ""
} |
q172989 | InMemoryNamingStore.list | test | public List<NameClassPair> list(final Name name) throws NamingException {
final Name nodeName = name.isEmpty() ? new CompositeName("") : name;
return root.accept(new ListVisitor(nodeName));
} | java | {
"resource": ""
} |
q172990 | InMemoryNamingStore.listBindings | test | public List<Binding> listBindings(final Name name) throws NamingException {
final Name nodeName = name.isEmpty() ? new CompositeName("") : name;
return root.accept(new ListBindingsVisitor(nodeName));
} | java | {
"resource": ""
} |
q172991 | ConcurrentContext.addFactory | test | public synchronized void addFactory(ContextHandleFactory factory) {
final String factoryName = factory.getName();
if(factoryMap.containsKey(factoryName)) {
throw EeLogger.ROOT_LOGGER.factoryAlreadyExists(this, factoryName);
}
factoryMap.put(factoryName, factory);
final Comparator<ContextHandleFactory> comparator = new Comparator<ContextHandleFactory>() {
@Override
public int compare(ContextHandleFactory o1, ContextHandleFactory o2) {
return Integer.compare(o1.getChainPriority(),o2.getChainPriority());
}
};
SortedSet<ContextHandleFactory> sortedSet = new TreeSet<>(comparator);
sortedSet.addAll(factoryMap.values());
factoryOrderedList = new ArrayList<>(sortedSet);
} | java | {
"resource": ""
} |
q172992 | ConcurrentContext.saveContext | test | public SetupContextHandle saveContext(ContextService contextService, Map<String, String> contextObjectProperties) {
final List<SetupContextHandle> handles = new ArrayList<>(factoryOrderedList.size());
for (ContextHandleFactory factory : factoryOrderedList) {
handles.add(factory.saveContext(contextService, contextObjectProperties));
}
return new ChainedSetupContextHandle(this, handles);
} | java | {
"resource": ""
} |
q172993 | WebMigrateOperation.createIoSubsystem | test | private void createIoSubsystem(OperationContext context, Map<PathAddress, ModelNode> migrationOperations, PathAddress baseAddress) {
Resource root = context.readResourceFromRoot(baseAddress, false);
if (root.getChildrenNames(SUBSYSTEM).contains(IOExtension.SUBSYSTEM_NAME)) {
// subsystem is already added, do nothing
return;
}
//these addresses will be fixed later, no need to use the base address
PathAddress address = pathAddress(pathElement(SUBSYSTEM, IOExtension.SUBSYSTEM_NAME));
migrationOperations.put(address, createAddOperation(address));
address = pathAddress(pathElement(SUBSYSTEM, IOExtension.SUBSYSTEM_NAME), pathElement("worker", "default"));
migrationOperations.put(address, createAddOperation(address));
address = pathAddress(pathElement(SUBSYSTEM, IOExtension.SUBSYSTEM_NAME), pathElement("buffer-pool", "default"));
migrationOperations.put(address, createAddOperation(address));
} | java | {
"resource": ""
} |
q172994 | WebMigrateOperation.createWelcomeContentHandler | test | private void createWelcomeContentHandler(Map<PathAddress, ModelNode> migrationOperations) {
PathAddress address = pathAddress(pathElement(SUBSYSTEM, UndertowExtension.SUBSYSTEM_NAME), pathElement(Constants.CONFIGURATION, Constants.HANDLER));
migrationOperations.put(address, createAddOperation(address));
address = pathAddress(pathElement(SUBSYSTEM, UndertowExtension.SUBSYSTEM_NAME), pathElement(Constants.CONFIGURATION, Constants.HANDLER), pathElement(Constants.FILE, "welcome-content"));
final ModelNode add = createAddOperation(address);
add.get(Constants.PATH).set(new ModelNode(new ValueExpression("${jboss.home.dir}/welcome-content")));
migrationOperations.put(address, add);
} | java | {
"resource": ""
} |
q172995 | StrictMaxPool.get | test | public T get() {
try {
boolean acquired = semaphore.tryAcquire(timeout, timeUnit);
if (!acquired)
throw EjbLogger.ROOT_LOGGER.failedToAcquirePermit(timeout, timeUnit);
} catch (InterruptedException e) {
throw EjbLogger.ROOT_LOGGER.acquireSemaphoreInterrupted();
}
T bean = pool.poll();
if( bean !=null) {
//we found a bean instance in the pool, return it
return bean;
}
try {
// Pool is empty, create an instance
bean = create();
} finally {
if (bean == null) {
semaphore.release();
}
}
return bean;
} | java | {
"resource": ""
} |
q172996 | InterfaceAnalysis.calculateOperationAnalysisMap | test | protected void calculateOperationAnalysisMap() {
operationAnalysisMap = new HashMap();
OperationAnalysis oa;
// Map the operations
for (int i = 0; i < operations.length; ++i) {
oa = operations[i];
operationAnalysisMap.put(oa.getIDLName(), oa);
}
// Map the attributes
for (int i = 0; i < attributes.length; ++i) {
AttributeAnalysis attr = attributes[i];
oa = attr.getAccessorAnalysis();
// Not having an accessor analysis means that
// the attribute is not in a remote interface
if (oa != null) {
operationAnalysisMap.put(oa.getIDLName(), oa);
oa = attr.getMutatorAnalysis();
if (oa != null)
operationAnalysisMap.put(oa.getIDLName(), oa);
}
}
} | java | {
"resource": ""
} |
q172997 | MetricCollector.collectResourceMetrics | test | public MetricRegistration collectResourceMetrics(final Resource resource,
ImmutableManagementResourceRegistration managementResourceRegistration,
Function<PathAddress, PathAddress> resourceAddressResolver) {
MetricRegistration registration = new MetricRegistration();
collectResourceMetrics0(resource, managementResourceRegistration, EMPTY_ADDRESS, resourceAddressResolver, registration);
return registration;
} | java | {
"resource": ""
} |
q172998 | EndpointPublisherImpl.doPrepare | test | protected DeploymentUnit doPrepare(String context, ClassLoader loader,
Map<String, String> urlPatternToClassNameMap, JBossWebMetaData jbwmd, WebservicesMetaData metadata, JBossWebservicesMetaData jbwsMetadata) {
ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
WSEndpointDeploymentUnit unit = new WSEndpointDeploymentUnit(loader, context, urlPatternToClassNameMap, jbwmd, metadata, jbwsMetadata);
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
WSDeploymentBuilder.getInstance().build(unit);
return unit;
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader);
}
} | java | {
"resource": ""
} |
q172999 | EndpointPublisherImpl.doDeploy | test | protected void doDeploy(ServiceTarget target, DeploymentUnit unit) {
List<DeploymentAspect> aspects = getDeploymentAspects();
ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
Deployment dep = null;
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
dep.addAttachment(ServiceTarget.class, target);
DeploymentAspectManager dam = new DeploymentAspectManagerImpl();
dam.setDeploymentAspects(aspects);
dam.deploy(dep);
} finally {
if (dep != null) {
dep.removeAttachment(ServiceTarget.class);
}
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader);
}
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.