@Override public ServiceName getParentExternalContext(ServiceName serviceName) { final ServiceName lower = externalContexts.lower(serviceName); return lower != null && lower.isParentOf(serviceName) ? lower : null; } }
static String getCacheName(ServiceName deploymentUnitServiceName, String beanManagerFactoryName) { List<String> parts = new ArrayList<>(3); if (Services.JBOSS_DEPLOYMENT_SUB_UNIT.isParentOf(deploymentUnitServiceName)) { parts.add(deploymentUnitServiceName.getParent().getSimpleName()); } parts.add(deploymentUnitServiceName.getSimpleName()); parts.add(beanManagerFactoryName); return String.join("/", parts); }
private List<ServiceName> listChildren(final ServiceName name, boolean isContextBinding) throws NamingException { final ConcurrentSkipListSet<ServiceName> boundServices = this.boundServices; if (!isContextBinding && boundServices.contains(name)) { throw NamingLogger.ROOT_LOGGER.cannotListNonContextBinding(); } final NavigableSet<ServiceName> tail = boundServices.tailSet(name); final List<ServiceName> children = new ArrayList<ServiceName>(); for (ServiceName next : tail) { if (name.isParentOf(next)) { if (!name.equals(next)) { children.add(next); } } else { break; } } return children; }
private Name setBaseName() throws NamingException { if (serviceNameBase.equals(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME) || ContextNames.EXPORTED_CONTEXT_SERVICE_NAME.isParentOf(serviceNameBase)) { return new CompositeName("java:jboss/exported"); || ContextNames.JBOSS_CONTEXT_SERVICE_NAME.isParentOf(serviceNameBase)) { return new CompositeName("java:jboss"); || ContextNames.APPLICATION_CONTEXT_SERVICE_NAME.isParentOf(serviceNameBase)) { return new CompositeName("java:app"); || ContextNames.MODULE_CONTEXT_SERVICE_NAME.isParentOf(serviceNameBase)) { return new CompositeName("java:module"); || ContextNames.COMPONENT_CONTEXT_SERVICE_NAME.isParentOf(serviceNameBase)) { return new CompositeName("java:comp"); || ContextNames.GLOBAL_CONTEXT_SERVICE_NAME.isParentOf(serviceNameBase)) { return new CompositeName("java:global"); || ContextNames.JAVA_CONTEXT_SERVICE_NAME.isParentOf(serviceNameBase)) { return new CompositeName("java:");
private void addConfigSourcesFromServices(ConfigBuilder builder, ServiceRegistry serviceRegistry, ClassLoader classloader) { List<ServiceName> serviceNames = serviceRegistry.getServiceNames(); for (ServiceName serviceName: serviceNames) { if (ServiceNames.CONFIG_SOURCE.isParentOf(serviceName)) { ServiceController<?> service = serviceRegistry.getService(serviceName); ConfigSource configSource = ConfigSource.class.cast(service.getValue()); builder.withSources(configSource); } else if (ServiceNames.CONFIG_SOURCE_PROVIDER.isParentOf(serviceName)) { ServiceController<?> service = serviceRegistry.getService(serviceName); ConfigSourceProvider configSourceProvider = ConfigSourceProvider.class.cast(service.getValue()); for (ConfigSource configSource : configSourceProvider.getConfigSources(classloader)) { builder.withSources(configSource); } } } }
final ServiceName floor = boundServices.floor(lookupName); boolean isContextBinding = false; if (floor != null && floor.isParentOf(lookupName)) {
final ServiceName floor = boundServices.floor(lookupName); boolean isContextBinding = false; if (floor != null && floor.isParentOf(lookupName)) {
if (obj == null) { final ServiceName lower = boundServices.lower(lookupName); if (lower != null && lower.isParentOf(lookupName)) { if (ceiling != null && lookupName.isParentOf(ceiling)) { if (lookupName.equals(ceiling)) {
if (parentName.isParentOf(subServiceName) && !subServiceName.getSimpleName().equals(ConnectorServices.STATISTICS_SUFFIX)) { builder.requires(subServiceName);
if (raServiceName.isParentOf(name)) { context.removeService(name);
if (xaDataSourceConfigServiceName.append("xa-datasource-properties").isParentOf(name)) { final ServiceController<?> xaConfigPropertyController = registry.getService(name); XaDataSourcePropertiesService xaPropService = (XaDataSourcePropertiesService) xaConfigPropertyController.getService(); if (dataSourceCongServiceName.append("connection-properties").isParentOf(name)) { final ServiceController<?> connPropServiceController = registry.getService(name); ConnectionPropertiesService connPropService = (ConnectionPropertiesService) connPropServiceController.getService();
String configCacheName = this.configuration.getCacheName(); ServiceName configServiceName = ServiceName.parse((configCacheName != null) ? configCacheName : DEFAULT_CACHE_CONTAINER); if (!baseServiceName.isParentOf(configServiceName)) { configServiceName = baseServiceName.append(configServiceName);
@SuppressWarnings({ "rawtypes", "unchecked" }) public void transition(ServiceController controller, Transition transition) { if(!typeToTrack.isParentOf(controller.getName())) { return; } if(transition.getAfter().getState().equals(State.UP)) { serviceCollection.add((S) controller.getValue()); } else { serviceCollection.remove(controller.getValue()); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) public void transition(ServiceController controller, Transition transition) { if(!typeToTrack.isParentOf(controller.getName())) { return; } if(transition.getAfter().getState().equals(State.UP)) { serviceCollection.add((S) controller.getValue()); } else { serviceCollection.remove(controller.getValue()); } }
@SuppressWarnings({ "rawtypes", "unchecked" }) public void transition(ServiceController controller, Transition transition) { if(!typeToTrack.isParentOf(controller.getName())) { return; } if(transition.getAfter().getState().equals(State.UP)) { serviceCollection.add((S) controller.getValue()); } else { serviceCollection.remove(controller.getValue()); } }
/** * Determine whether this service name is the same as, or a parent of, the given service name. * * @param other the other name * @return {@code true} if this service name is a parent */ public boolean isParentOf(ServiceName other) { return other != null && (equals(other) || isParentOf(other.parent)); }
/** * Determine whether this service name is the same as, or a parent of, the given service name. * * @param other the other name * @return {@code true} if this service name is a parent */ public boolean isParentOf(ServiceName other) { return other != null && (equals(other) || isParentOf(other.parent)); }
private ServiceName getCacheServiceName(ReplicationConfig config) { ServiceName baseServiceName = EmbeddedCacheManagerService.getServiceName(null); String cacheName = (config != null) ? config.getCacheName() : null; ServiceName serviceName = ServiceName.parse((cacheName != null) ? cacheName : DEFAULT_CACHE_CONTAINER); if (!baseServiceName.isParentOf(serviceName)) { serviceName = baseServiceName.append(serviceName); } return (serviceName.length() < 4) ? serviceName.append(CacheContainer.DEFAULT_CACHE_NAME) : serviceName; }
protected void removeServices(final OperationContext context, final String realmName, final ModelNode model) throws OperationFailedException { // KISS -- Just remove the service and all child services. ServiceName realmServiceName = SecurityRealmService.ServiceUtil.createServiceName(realmName); ServiceRegistry serviceRegistry = context.getServiceRegistry(false); List<ServiceName> allNames = serviceRegistry.getServiceNames(); for (ServiceName current : allNames) { if (realmServiceName.isParentOf(current)) { context.removeService(current); } } }
static String getCacheName(ServiceName deploymentUnitServiceName) { if (Services.JBOSS_DEPLOYMENT_SUB_UNIT.isParentOf(deploymentUnitServiceName)) { return deploymentUnitServiceName.getParent().getSimpleName() + "/" + deploymentUnitServiceName.getSimpleName(); } return deploymentUnitServiceName.getSimpleName(); }