use of javax.inject.Named in project oxAuth by GluuFederation.
the class AppInitializer method createLdapAuthEntryManager.
@Produces
@ApplicationScoped
@Named(LDAP_AUTH_ENTRY_MANAGER_NAME)
public List<LdapEntryManager> createLdapAuthEntryManager() {
List<LdapEntryManager> ldapAuthEntryManagers = new ArrayList<LdapEntryManager>();
if (this.ldapAuthConfigs.size() == 0) {
return ldapAuthEntryManagers;
}
for (int i = 0; i < this.ldapAuthConfigs.size(); i++) {
LdapEntryManager ldapAuthEntryManager = new LdapEntryManager(new OperationsFacade(this.authConnectionProviders.get(i), this.authBindConnectionProviders.get(i)));
log.debug("Created {}#{}: {}", new Object[] { LDAP_AUTH_ENTRY_MANAGER_NAME, i, ldapAuthEntryManager });
ldapAuthEntryManagers.add(ldapAuthEntryManager);
}
return ldapAuthEntryManagers;
}
use of javax.inject.Named in project AngularBeans by bessemHmidi.
the class CommonUtils method getBeanName.
public static String getBeanName(Class targetClass) {
if (targetClass.isAnnotationPresent(Named.class)) {
Named named = (Named) targetClass.getAnnotation(Named.class);
if (!named.value().isEmpty()) {
return named.value();
}
}
String name = Introspector.decapitalize(targetClass.getSimpleName());
beanNamesHolder.put(name, targetClass);
return name;
}
use of javax.inject.Named in project oxTrust by GluuFederation.
the class AppInitializer method createCentralLdapEntryManager.
@Produces
@ApplicationScoped
@Named(LDAP_CENTRAL_ENTRY_MANAGER_NAME)
@CentralLdap
public LdapEntryManager createCentralLdapEntryManager() {
if (!((configurationFactory.getLdapCentralConfiguration() != null) && configurationFactory.getAppConfiguration().isUpdateApplianceStatus())) {
return new LdapEntryManager();
}
FileConfiguration ldapCentralConfig = configurationFactory.getLdapCentralConfiguration();
Properties centralConnectionProperties = (Properties) ldapCentralConfig.getProperties();
EncryptionService securityService = encryptionServiceInstance.get();
Properties decryptedCentralConnectionProperties = securityService.decryptProperties(centralConnectionProperties);
LdapEntryManager centralLdapEntryManager = this.ldapEntryManagerFactory.createEntryManager(decryptedCentralConnectionProperties);
log.info("Created {}: {}", new Object[] { LDAP_CENTRAL_ENTRY_MANAGER_NAME, centralLdapEntryManager.getOperationService() });
return centralLdapEntryManager;
}
use of javax.inject.Named in project oxTrust by GluuFederation.
the class AppInitializer method initUmaMetadataConfiguration.
@Produces
@ApplicationScoped
@Named("umaMetadataConfiguration")
public UmaMetadata initUmaMetadataConfiguration() throws OxIntializationException {
String umaConfigurationEndpoint = getUmaConfigurationEndpoint();
if (StringHelper.isEmpty(umaConfigurationEndpoint)) {
return null;
}
UmaMetadataService metaDataConfigurationService = UmaClientFactory.instance().createMetadataService(umaConfigurationEndpoint);
UmaMetadata metadataConfiguration = metaDataConfigurationService.getMetadata();
if (metadataConfiguration == null) {
throw new OxIntializationException("UMA meta data configuration is invalid!");
}
return metadataConfiguration;
}
use of javax.inject.Named in project kernel by exoplatform.
the class SpringContainer method getComponentInstance.
/**
* {@inheritDoc}
*/
@Override
public <T> T getComponentInstance(Object componentKey, Class<T> bindType, boolean autoRegistration) {
T result = super.getComponentInstance(componentKey, bindType, autoRegistration);
if (ctx != null && result == null) {
if (componentKey instanceof Class<?> && !((Class<?>) componentKey).isAnnotation()) {
return bindType.cast(getInstanceOfType((Class<?>) componentKey));
} else if (!(componentKey instanceof String) && !(componentKey instanceof Class<?>)) {
return null;
}
String beanName = keyToBeanName(componentKey);
if (ctx.containsBean(beanName) && bindType.isAssignableFrom(ctx.getType(beanName))) {
return bindType.cast(ctx.getBean(beanName));
}
String[] names = ctx.getBeanNamesForType(bindType);
if (names != null && names.length > 0) {
for (int i = 0, length = names.length; i < length; i++) {
String name = names[i];
if (componentKey instanceof String) {
Named n = ctx.findAnnotationOnBean(name, Named.class);
if (n != null && componentKey.equals(n.value())) {
return bindType.cast(ctx.getBean(name));
}
} else {
@SuppressWarnings("unchecked") Annotation a = ctx.findAnnotationOnBean(name, (Class<? extends Annotation>) componentKey);
if (a != null) {
return bindType.cast(ctx.getBean(name));
}
}
}
}
}
return result;
}
Aggregations