当前位置: 首页>>代码示例>>Java>>正文


Java InjectedValue类代码示例

本文整理汇总了Java中org.jboss.msc.value.InjectedValue的典型用法代码示例。如果您正苦于以下问题:Java InjectedValue类的具体用法?Java InjectedValue怎么用?Java InjectedValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InjectedValue类属于org.jboss.msc.value包,在下文中一共展示了InjectedValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void start(StartContext context) throws StartException {
    try {
        NamespaceContextSelector selector = _namespaceSelector.getValue();
        NamespaceContextSelector.pushCurrentSelector(selector);
        LOG.info("Starting SwitchYard service");
        List<Component> components = new ArrayList<Component>();
        for (InjectedValue<Component> component : _components) {
            components.add(component.getValue());
        }
        _switchyardDeployment.setNamespaceContextSelector(selector);
        _switchyardDeployment.start(components);
    } catch (Exception e) {
        try {
            _switchyardDeployment.stop();
        } catch (Exception ex) {
            LOG.error(ex);
        }
        throw new StartException(e);
    } finally {
        NamespaceContextSelector.popCurrentSelector();
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:25,代码来源:SwitchYardService.java

示例2: performRuntime

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    ServiceTarget serviceTarget = context.getServiceTarget();
    RuntimeCapability<Void> runtimeCapability = SECURITY_REALM_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName realmName = runtimeCapability.getCapabilityServiceName(SecurityRealm.class);

    final InjectedValue<KeyStore> keyStore = new InjectedValue<KeyStore>();
    TrivialService<SecurityRealm> keyStoreRealmService = new TrivialService<SecurityRealm>(() -> new KeyStoreBackedSecurityRealm(keyStore.getValue()));

    ServiceBuilder<SecurityRealm> serviceBuilder = serviceTarget.addService(realmName, keyStoreRealmService);

    String keyStoreCapabilityName = RuntimeCapability.buildDynamicCapabilityName(KEY_STORE_CAPABILITY, KEYSTORE.resolveModelAttribute(context, model).asString());
    ServiceName keyStoreServiceName = context.getCapabilityServiceName(keyStoreCapabilityName, KeyStore.class);
    KEY_STORE_UTIL.addInjection(serviceBuilder, keyStore, keyStoreServiceName);
    commonDependencies(serviceBuilder)
        .setInitialMode(Mode.ACTIVE)
        .install();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:KeyStoreRealmDefinition.java

示例3: performRuntime

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    ServiceTarget serviceTarget = context.getServiceTarget();
    RuntimeCapability<Void> runtimeCapability = SECURITY_REALM_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName realmName = runtimeCapability.getCapabilityServiceName(SecurityRealm.class);

    String authenticationRealm = AUTHENTICATION_REALM.resolveModelAttribute(context, model).asString();
    String authorizationRealm = AUTHORIZATION_REALM.resolveModelAttribute(context, model).asString();

    final InjectedValue<SecurityRealm> authenticationRealmValue = new InjectedValue<SecurityRealm>();
    final InjectedValue<SecurityRealm> authorizationRealmValue = new InjectedValue<SecurityRealm>();

    TrivialService<SecurityRealm> aggregateRealmService = new TrivialService<SecurityRealm>( () -> new AggregateSecurityRealm(authenticationRealmValue.getValue(), authorizationRealmValue.getValue()));

    ServiceBuilder<SecurityRealm> serviceBuilder = serviceTarget.addService(realmName, aggregateRealmService);

    addRealmDependency(context, serviceBuilder, authenticationRealm, authenticationRealmValue);
    addRealmDependency(context, serviceBuilder, authorizationRealm, authorizationRealmValue);

    commonDependencies(serviceBuilder)
        .setInitialMode(Mode.ACTIVE)
        .install();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:25,代码来源:AggregateRealmDefinition.java

示例4: createService

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
private TrivialService<SecurityRealm> createService(String realmName, int maxEntries, long maxAge, InjectedValue<SecurityRealm> injector) {
    return new TrivialService<>((TrivialService.ValueSupplier<SecurityRealm>) () -> {
        SecurityRealm securityRealm = injector.getValue();

        if (securityRealm instanceof CacheableSecurityRealm) {
            RealmIdentityCache cache = createRealmIdentityCache(maxEntries, maxAge);
            CacheableSecurityRealm cacheableRealm = CacheableSecurityRealm.class.cast(securityRealm);

            if (securityRealm instanceof ModifiableSecurityRealm) {
                return new CachingModifiableSecurityRealm(cacheableRealm, cache);
            }

            return new CachingSecurityRealm(cacheableRealm, cache);
        }

        throw ElytronSubsystemMessages.ROOT_LOGGER.realmDoesNotSupportCache(realmName);
    });
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:CachingRealmDefinition.java

示例5: getLogicalPermissionMapper

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
static ResourceDefinition getLogicalPermissionMapper() {
    AttributeDefinition[] attributes = new AttributeDefinition[] {LOGICAL_OPERATION, LEFT, RIGHT};
    TrivialAddHandler<PermissionMapper> add = new TrivialAddHandler<PermissionMapper>(PermissionMapper.class, attributes, PERMISSION_MAPPER_RUNTIME_CAPABILITY) {

        @Override
        protected ValueSupplier<PermissionMapper> getValueSupplier(ServiceBuilder<PermissionMapper> serviceBuilder,
                OperationContext context, ModelNode model) throws OperationFailedException {

            final InjectedValue<PermissionMapper> leftPermissionMapperInjector = new InjectedValue<>();
            final InjectedValue<PermissionMapper> rightPermissionMapperInjector = new InjectedValue<>();

            LogicalMapperOperation operation = LogicalMapperOperation.valueOf(LogicalMapperOperation.class, LOGICAL_OPERATION.resolveModelAttribute(context, model).asString().toUpperCase(Locale.ENGLISH));

            serviceBuilder.addDependency(context.getCapabilityServiceName(RuntimeCapability.buildDynamicCapabilityName(PERMISSION_MAPPER_CAPABILITY, LEFT.resolveModelAttribute(context, model).asString()),
                    PermissionMapper.class), PermissionMapper.class, leftPermissionMapperInjector);

            serviceBuilder.addDependency(context.getCapabilityServiceName(RuntimeCapability.buildDynamicCapabilityName(PERMISSION_MAPPER_CAPABILITY, RIGHT.resolveModelAttribute(context, model).asString()),
                    PermissionMapper.class), PermissionMapper.class, rightPermissionMapperInjector);

            return () -> operation.create(leftPermissionMapperInjector.getValue(), rightPermissionMapperInjector.getValue());
        }
    };

    return new TrivialResourceDefinition(ElytronDescriptionConstants.LOGICAL_PERMISSION_MAPPER, add, attributes, PERMISSION_MAPPER_RUNTIME_CAPABILITY);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:PermissionMapperDefinitions.java

示例6: addPlugInAuthorizationService

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
private void addPlugInAuthorizationService(OperationContext context, ModelNode model, String realmName,
                                           ServiceTarget serviceTarget, ServiceBuilder<?> realmBuilder,
                                           InjectedValue<SubjectSupplementalService> injector) throws OperationFailedException {

    ServiceName plugInServiceName = PlugInSubjectSupplemental.ServiceUtil.createServiceName(realmName);
    final String pluginName = PlugInAuthorizationResourceDefinition.NAME.resolveModelAttribute(context, model).asString();
    final Map<String, String> properties = resolveProperties(context, model);
    PlugInSubjectSupplemental plugInSubjectSupplemental = new PlugInSubjectSupplemental(realmName, pluginName, properties);

    ServiceBuilder<?> plugInBuilder = serviceTarget.addService(plugInServiceName, plugInSubjectSupplemental);
    PlugInLoaderService.ServiceUtil.addDependency(plugInBuilder, plugInSubjectSupplemental.getPlugInLoaderServiceValue(), realmName);

    plugInBuilder.setInitialMode(ON_DEMAND).install();

    SubjectSupplementalService.ServiceUtil.addDependency(realmBuilder, injector, plugInServiceName);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:SecurityRealmAddHandler.java

示例7: performRuntime

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    String securityDomain = SECURITY_DOMAIN.resolveModelAttribute(context, model).asString();
    final InjectedValue<SecurityDomain> securityDomainInjected = new InjectedValue<>();

    final IdentityService service = new IdentityService(securityIdentitySupplier);

    ServiceBuilder<Void> serviceBuilder = context.getServiceTarget().addService(MANAGEMENT_IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName(), service)
            .setInitialMode(Mode.ACTIVE);

    serviceBuilder.addDependency(context.getCapabilityServiceName(RuntimeCapability.buildDynamicCapabilityName(SECURITY_DOMAIN_CAPABILITY, securityDomain), SecurityDomain.class), SecurityDomain.class, securityDomainInjected);

    service.setConfiguredSecurityDomain(securityDomainInjected);
    serviceBuilder.install();
    //Let's verify that the IdentityService is correctly started.
    context.addStep((OperationContext context1, ModelNode operation1) -> {
        try {
            ServiceController<?> controller = context1.getServiceRegistry(false).getRequiredService(MANAGEMENT_IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName());
            if (controller == null || State.UP != controller.getState()) {
                context.setRollbackOnly();
            }
        } catch (ServiceNotFoundException ex) {
            context.setRollbackOnly();
        }
    }, OperationContext.Stage.VERIFY);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:27,代码来源:AccessIdentityResourceDefinition.java

示例8: activate

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
	try {
		SingletonPolicy policy = (SingletonPolicy) context.getServiceRegistry()
				.getRequiredService(parse(SINGLETON_POLICY.getName())).awaitValue();
		InjectedValue<ServerEnvironment> env = new InjectedValue<>();
		HAService service = new HAService(env);
		policy.createSingletonServiceBuilder(SERVICE_NAME, service).build(context.getServiceTarget())
				.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, env).install();
	} catch (InterruptedException e) {
		throw new ServiceRegistryException(e);
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:14,代码来源:HAServicePolicyActivator.java

示例9: install

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
private static void install(ServiceTarget target, SingletonServiceBuilderFactory factory, ServiceName name,
		int quorum) {
	InjectedValue<ServerEnvironment> env = new InjectedValue<>();
	HAService service = new HAService(env);
	factory.createSingletonServiceBuilder(name, service)
			.electionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(),
					new NamePreference(PREFERRED_NODE)))
			.requireQuorum(quorum).build(target).addDependency(SERVICE_NAME, ServerEnvironment.class, env)
			.install();
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:11,代码来源:HAServiceActivator.java

示例10: getSubjectFactoryInjector

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
public InjectedValue<SubjectFactory> getSubjectFactoryInjector() {
    return subjectFactory;
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:4,代码来源:Neo4jClientConnectionService.java

示例11: getHandlerInjectorFor

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
public Injector<HttpHandler> getHandlerInjectorFor(String serviceName) {
    InjectedValue<HttpHandler> injector = proxyHandlerMap.get(serviceName);
    if (injector == null) {
        injector = new InjectedValue<>();
        proxyHandlerMap.put(serviceName, injector);
    }
    return injector;
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology,代码行数:9,代码来源:TopologyProxyService.java

示例12: getComponent

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
/**
 * Injection point for Component.
 * 
 * @return the component added
 */
public InjectedValue<Component> getComponent() {
    InjectedValue<Component> component = new InjectedValue<Component>();
    if (!_components.contains(component)) {
        _components.add(component);
    }
    return component;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:13,代码来源:SwitchYardService.java

示例13: getSocketBinding

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
/**
 * Injection point for SocketBindings.
 * 
 * @param name the name of the SocketBinding
 * @return the SocketBinding
 */
public InjectedValue<SocketBinding> getSocketBinding(String name) {
    InjectedValue<SocketBinding> binding = _socketBindings.get(name);
    if (binding == null) {
        binding = new InjectedValue<SocketBinding>();
        _socketBindings.put(name, binding);
    }
    return binding;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:15,代码来源:SwitchYardInjectorService.java

示例14: getAddress

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
/**
 * Return the address.
 * 
 * @return An address string
 */
public String getAddress() {
    String schema = "http";
    String hostAddress = "127.0.0.1";
    int port = 8080;

    ListenerService listener = ServerUtil.getDefaultListener();
    if (listener != null) {
        if (listener instanceof HttpsListenerService) {
            schema = "https";
        } else if (listener instanceof HttpListenerService) {
            schema = "http";
        } else {
            ExtensionLogger.ROOT_LOGGER.defaultListenerIsNotHttpListener(listener.getClass().getName());
            schema = "http";
        }

        InjectedValue<SocketBinding> inject = listener.getBinding();
        if (inject != null) {
            SocketBinding binding = inject.getValue();
            InetAddress address = binding.getAddress();
            hostAddress = address.getHostAddress();
            port = binding.getAbsolutePort();
        }else {
            Set<String> aliases = ServerUtil.getDefaultHostAliases();
            if (aliases != null && !aliases.isEmpty()) {
                hostAddress = aliases.iterator().next();
            }
            ExtensionLogger.ROOT_LOGGER.noSocketBindingDefinitionFound(hostAddress, Integer.toString(port));
        }
    } else {
        ExtensionLogger.ROOT_LOGGER.noDefaultListenerDefined(schema, hostAddress, Integer.toString(port));
    }

    return schema + "://" + hostAddress + ":" + port + "/" + _contextName;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:41,代码来源:RemoteEndpointListener.java

示例15: performRuntime

import org.jboss.msc.value.InjectedValue; //导入依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    ServiceTarget serviceTarget = context.getServiceTarget();
    RuntimeCapability<Void> runtimeCapability = REALM_MAPPER_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName realmMapperName = runtimeCapability.getCapabilityServiceName(RealmMapper.class);

    final String pattern = PATTERN_CAPTURE_GROUP.resolveModelAttribute(context, model).asString();
    String delegateRealmMapper = DELEGATE_REALM_MAPPER.resolveModelAttribute(context, model).asStringOrNull();

    final InjectedValue<RealmMapper> delegateRealmMapperInjector = new InjectedValue<RealmMapper>();

    TrivialService<RealmMapper> realmMapperService = new TrivialService<RealmMapper>(() -> {
        RealmMapper delegate = delegateRealmMapperInjector.getOptionalValue();
        Pattern compiledPattern = Pattern.compile(pattern);
        if (delegate == null) {
            return new SimpleRegexRealmMapper(compiledPattern);
        } else {
            return new SimpleRegexRealmMapper(compiledPattern, delegate);
        }
    });

    ServiceBuilder<RealmMapper> realmMapperBuilder = serviceTarget.addService(realmMapperName, realmMapperService);

    if (delegateRealmMapper != null) {
        String delegateCapabilityName = RuntimeCapability.buildDynamicCapabilityName(REALM_MAPPER_CAPABILITY, delegateRealmMapper);
        ServiceName delegateServiceName = context.getCapabilityServiceName(delegateCapabilityName, RealmMapper.class);

        realmMapperBuilder.addDependency(delegateServiceName, RealmMapper.class, delegateRealmMapperInjector);
    }

    commonDependencies(realmMapperBuilder)
        .setInitialMode(Mode.LAZY)
        .install();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:36,代码来源:RealmMapperDefinitions.java


注:本文中的org.jboss.msc.value.InjectedValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。