Search in sources :

Example 96 with PostConstruct

use of javax.annotation.PostConstruct in project deltaspike by apache.

the class Initializer method create.

@PostConstruct
public void create() {
    // Create user john
    User john = new User("john");
    john.setEmail("john@acme.com");
    john.setFirstName("John");
    john.setLastName("User");
    IdentityManager identityManager = this.partitionManager.createIdentityManager();
    identityManager.add(john);
    identityManager.updateCredential(john, new Password("123456"));
}
Also used : IdentityManager(org.picketlink.idm.IdentityManager) User(org.picketlink.idm.model.basic.User) Password(org.picketlink.idm.credential.Password) PostConstruct(javax.annotation.PostConstruct)

Example 97 with PostConstruct

use of javax.annotation.PostConstruct in project oxTrust by GluuFederation.

the class BuildVersionService method initalize.

@PostConstruct
public void initalize() {
    try {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = factory.newDocumentBuilder();
        Document doc = dBuilder.parse((getClass().getResourceAsStream("/META-INF/beans.xml")));
        doc.getDocumentElement().normalize();
        log.info("Root element :" + doc.getDocumentElement().getNodeName());
        NodeList nList = doc.getElementsByTagName("bean");
        if (doc.hasChildNodes()) {
            readBuildDetails(nList);
        }
    } catch (Exception ex) {
        log.error("Failed to obtain build version", ex);
    }
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) NodeList(org.w3c.dom.NodeList) Document(org.w3c.dom.Document) PostConstruct(javax.annotation.PostConstruct)

Example 98 with PostConstruct

use of javax.annotation.PostConstruct in project CzechIdMng by bcvsolutions.

the class AuditableListener method register.

/**
 * Register listener to hibernate
 */
@PostConstruct
public void register() {
    LOG.debug("Registering auditor listener [{}]", AuditableListener.class.getSimpleName());
    SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) entityManagerFactory.getSessionFactory();
    EventListenerRegistry registry = sessionFactoryImpl.getServiceRegistry().getService(EventListenerRegistry.class);
    registry.getEventListenerGroup(EventType.PRE_INSERT).appendListener(this);
    registry.getEventListenerGroup(EventType.PRE_UPDATE).appendListener(this);
    LOG.debug("Registered auditor listener [{}]", AuditableListener.class.getSimpleName());
}
Also used : SessionFactoryImpl(org.hibernate.internal.SessionFactoryImpl) EventListenerRegistry(org.hibernate.event.service.spi.EventListenerRegistry) PostConstruct(javax.annotation.PostConstruct)

Example 99 with PostConstruct

use of javax.annotation.PostConstruct in project cas by apereo.

the class CasSamlSPInCommonConfiguration method init.

@PostConstruct
public void init() {
    final SamlRegisteredService service = SamlSPUtils.newSamlServiceProviderService(casProperties.getSamlSp().getInCommon(), samlRegisteredServiceCachingMetadataResolver);
    if (service != null) {
        SamlSPUtils.saveService(service, servicesManager);
        LOGGER.info("Launching background thread to load the InCommon metadata. Depending on bandwidth, this might take a while...");
        new Thread(() -> {
            LOGGER.debug("Loading InCommon metadata at [{}]...", service.getMetadataLocation());
            samlRegisteredServiceCachingMetadataResolver.resolve(service);
        }).start();
    }
}
Also used : SamlRegisteredService(org.apereo.cas.support.saml.services.SamlRegisteredService) PostConstruct(javax.annotation.PostConstruct)

Example 100 with PostConstruct

use of javax.annotation.PostConstruct in project cxf by apache.

the class ResourceInjector method invokePostConstruct.

public void invokePostConstruct() {
    boolean accessible = false;
    for (Method method : getPostConstructMethods()) {
        PostConstruct pc = method.getAnnotation(PostConstruct.class);
        if (pc != null) {
            try {
                ReflectionUtil.setAccessible(method);
                method.invoke(target);
            } catch (IllegalAccessException e) {
                LOG.log(Level.WARNING, "INJECTION_COMPLETE_NOT_VISIBLE", method);
            } catch (InvocationTargetException e) {
                LOG.log(Level.WARNING, "INJECTION_COMPLETE_THREW_EXCEPTION", e);
            } finally {
                ReflectionUtil.setAccessible(method, accessible);
            }
        }
    }
}
Also used : Method(java.lang.reflect.Method) PostConstruct(javax.annotation.PostConstruct) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

PostConstruct (javax.annotation.PostConstruct)248 IOException (java.io.IOException)28 File (java.io.File)18 SamlRegisteredService (org.apereo.cas.support.saml.services.SamlRegisteredService)17 Map (java.util.Map)15 ArrayList (java.util.ArrayList)12 ExternalResource (com.vaadin.server.ExternalResource)11 HashMap (java.util.HashMap)10 InitialContext (javax.naming.InitialContext)9 Label (com.vaadin.ui.Label)8 VerticalLayout (com.vaadin.ui.VerticalLayout)8 Request (com.nabalive.framework.web.Request)7 Response (com.nabalive.framework.web.Response)7 Route (com.nabalive.framework.web.Route)7 Link (com.vaadin.ui.Link)7 Properties (java.util.Properties)7 Method (java.lang.reflect.Method)5 InputStream (java.io.InputStream)4 URISyntaxException (java.net.URISyntaxException)4 Path (java.nio.file.Path)4