use of javax.inject.Inject in project opennms by OpenNMS.
the class BeanUtils method assertAutowiring.
/**
* Check that all fields that are marked with @Autowired are not null.
* This will identify classes that have been loaded by Spring but have
* not been autowired via {@code <context:annotation-config />}.
*/
public static <T> void assertAutowiring(T instance) {
for (Field field : instance.getClass().getDeclaredFields()) {
Autowired autowired = field.getAnnotation(Autowired.class);
Inject inject = field.getAnnotation(Inject.class);
Resource resource = field.getAnnotation(Resource.class);
if ((autowired != null && autowired.required()) || (inject != null) || (resource != null)) {
try {
field.setAccessible(true);
notNull(field.get(instance), "@Autowired/@Inject/@Resource field " + field.getName() + " cannot be null");
LOG.debug("{} is not null", field.getName());
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Illegal access to @Autowired/@Resource field " + field.getName());
}
}
}
}
use of javax.inject.Inject in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getAuthenticateHandler.
@Provides
@Named("AuthenticateHandler")
@Inject
Handler getAuthenticateHandler(@Named("InvalidRealmNames") Set<String> invalidRealms, HttpAccessAuditFilterFactory httpAuditFactory) {
invalidRealms.add(firstPathSegment("authenticate"));
org.forgerock.http.routing.Router authenticateVersionRouter = new org.forgerock.http.routing.Router();
Handler authenticateHandlerV1 = Endpoints.from(AuthenticationServiceV1.class);
Handler authenticateHandlerV2 = Endpoints.from(AuthenticationServiceV2.class);
authenticateVersionRouter.addRoute(RouteMatchers.requestResourceApiVersionMatcher(version(1, 1)), authenticateHandlerV1);
authenticateVersionRouter.addRoute(RouteMatchers.requestResourceApiVersionMatcher(version(2)), authenticateHandlerV2);
return chainOf(authenticateVersionRouter, httpAuditFactory.createFilter(AUTHENTICATION));
}
use of javax.inject.Inject in project OpenAM by OpenRock.
the class SoapSTSInstanceModule method getProperties.
/*
*/
/**
* These properties configure the web-service deployment, and are primarily referenced by the ws-security interceptors
* deployed as part of CXF. These interceptors are responsible for enforcing the security-policy bindings protecting
* the STS. To this end, various crypto objects are required, and the TokenValidators for the configured validated
* token types are plugged-in.
* @param wssValidatorFactory the factory class which will produce the wss Validator instances to enforce SecurityPolicy bindings
* @param logger for error state logging
* @return the Map that serves to configure the web-service deployment
* @throws WSSecurityException In case an unexpected TokenType is encountered, or a TokenValidator could not be created.
*/
@Provides
@Named(AMSTSConstants.STS_WEB_SERVICE_PROPERTIES)
@Inject
Map<String, Object> getProperties(WSSValidatorFactory wssValidatorFactory, Logger logger) throws WSSecurityException {
Map<String, Object> properties = new HashMap<>();
// KeystoreConfig may be null for a TLS-based SecurityPolicy binding, or for the AM-bare binding.
if (stsInstanceConfig.getKeystoreConfig() != null) {
properties.put(SecurityConstants.CALLBACK_HANDLER, new SoapSTSCallbackHandler(stsInstanceConfig.getKeystoreConfig(), logger));
Crypto crypto = CryptoFactory.getInstance(getEncryptionProperties());
properties.put(SecurityConstants.ENCRYPT_CRYPTO, crypto);
properties.put(SecurityConstants.SIGNATURE_CRYPTO, crypto);
properties.put(SecurityConstants.SIGNATURE_USERNAME, stsInstanceConfig.getKeystoreConfig().getSignatureKeyAlias());
}
properties.put("faultStackTraceEnabled", "true");
properties.put("exceptionMessageCauseEnabled", "true");
processSecurityPolicyTokenValidatorConfiguration(properties, wssValidatorFactory, logger);
return properties;
}
use of javax.inject.Inject in project ACS by ACS-Community.
the class MyStatusBar method getNotified.
@Inject
@Optional
private void getNotified(@UIEventTopic(STATUS_BAR_TOPIC_ID) MessageWithTime msgWithTime) {
if (slm != null) {
String flashMsg = msgWithTime.msg;
int timeSeconds = msgWithTime.timeSeconds;
slm.setMessage(flashMsg);
// TODO fix truncation of larger strings, e.g.
// slm.getControl().pack(true); ??
clearFlashJob();
msgRestoreJob = new Job(MyStatusBar.class.getSimpleName() + "RemoveFlashMessage") {
@Override
protected IStatus run(IProgressMonitor monitor) {
// restore the previous message
uiSync.syncExec(new Runnable() {
@Override
public void run() {
slm.setMessage(permanentMessage);
}
});
return Status.OK_STATUS;
}
};
msgRestoreJob.schedule(timeSeconds * 1000);
}
}
use of javax.inject.Inject in project che by eclipse.
the class DBInitializer method setUpInjectionManager.
@Inject
public void setUpInjectionManager(GuiceEntityListenerInjectionManager injManager, EntityManagerFactory emFactory) {
final ServerSession session = emFactory.unwrap(ServerSession.class);
session.setEntityListenerInjectionManager(injManager);
}
Aggregations