Search in sources :

Example 91 with PostConstruct

use of javax.annotation.PostConstruct in project fess by codelibs.

the class SpnegoAuthenticator method init.

@PostConstruct
public void init() {
    if ("spnego".equals(ComponentUtil.getFessConfig().getSsoType())) {
        try {
            // set some System properties
            final SpnegoFilterConfig config = SpnegoFilterConfig.getInstance(new SpengoConfig());
            // pre-authenticate
            authenticator = new org.codelibs.spnego.SpnegoAuthenticator(config);
        } catch (final Exception e) {
            throw new FessSystemException("Failed to initialize SPNEGO.", e);
        }
    }
}
Also used : SpnegoFilterConfig(org.codelibs.spnego.SpnegoFilterConfig) FessSystemException(org.codelibs.fess.exception.FessSystemException) SsoLoginException(org.codelibs.fess.exception.SsoLoginException) FessSystemException(org.codelibs.fess.exception.FessSystemException) PostConstruct(javax.annotation.PostConstruct)

Example 92 with PostConstruct

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

the class UserPage method init.

@PostConstruct
public void init() throws Exception {
    final Session session = resource.getResourceResolver().adaptTo(Session.class);
    final UserManager userManager = AccessControlUtil.getUserManager(session);
    user = (User) userManager.getAuthorizable(session.getUserID());
    userProperties = mapUserProperties(user);
}
Also used : UserManager(org.apache.jackrabbit.api.security.user.UserManager) Session(javax.jcr.Session) PostConstruct(javax.annotation.PostConstruct)

Example 93 with PostConstruct

use of javax.annotation.PostConstruct in project uPortal by Jasig.

the class SoffitConnectorController method init.

@PostConstruct
public void init() {
    PoolingHttpClientConnectionManager poolingHttpClientConnectionManager = new PoolingHttpClientConnectionManager();
    poolingHttpClientConnectionManager.setDefaultMaxPerRoute(maxConnectionsPerRoute);
    poolingHttpClientConnectionManager.setMaxTotal(maxConnectionsTotal);
    httpClientBuilder.setConnectionManager(poolingHttpClientConnectionManager);
    final Map<String, IHeaderProvider> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, IHeaderProvider.class);
    final List<IHeaderProvider> values = new ArrayList<>(beans.values());
    headerProviders = Collections.unmodifiableList(values);
}
Also used : ArrayList(java.util.ArrayList) PoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager) PostConstruct(javax.annotation.PostConstruct)

Example 94 with PostConstruct

use of javax.annotation.PostConstruct in project uPortal by Jasig.

the class ModelAttributeService method init.

@PostConstruct
public void init() {
    /*
         * Gather classes & methods that reference @SoffitMoldelAttribute
         */
    final Map<AnnotatedElement, Object> map = new HashMap<>();
    final String[] beanNames = applicationContext.getBeanDefinitionNames();
    for (String name : beanNames) {
        final Object bean = applicationContext.getBean(name);
        final Class clazz = AopUtils.isAopProxy(bean) ? AopUtils.getTargetClass(bean) : bean.getClass();
        if (clazz.isAnnotationPresent(SoffitModelAttribute.class)) {
            // The bean itself is the model attribute
            map.put(clazz, bean);
        } else {
            // Check the bean for annotated methods...
            for (Method m : clazz.getMethods()) {
                if (m.isAnnotationPresent(SoffitModelAttribute.class)) {
                    map.put(m, bean);
                }
            }
        }
    }
    logger.debug("Found {} beans and/or methods referencing @SoffitModelAttribute", map.size());
    modelAttributes = Collections.unmodifiableMap(map);
}
Also used : HashMap(java.util.HashMap) AnnotatedElement(java.lang.reflect.AnnotatedElement) Method(java.lang.reflect.Method) PostConstruct(javax.annotation.PostConstruct)

Example 95 with PostConstruct

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

the class HostDaoImpl method init.

@PostConstruct
public void init() {
    MaintenanceCountSearch = createSearchBuilder();
    MaintenanceCountSearch.and("cluster", MaintenanceCountSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
    MaintenanceCountSearch.and("resourceState", MaintenanceCountSearch.entity().getResourceState(), SearchCriteria.Op.IN);
    MaintenanceCountSearch.done();
    TypePodDcStatusSearch = createSearchBuilder();
    HostVO entity = TypePodDcStatusSearch.entity();
    TypePodDcStatusSearch.and("type", entity.getType(), SearchCriteria.Op.EQ);
    TypePodDcStatusSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ);
    TypePodDcStatusSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ);
    TypePodDcStatusSearch.and("cluster", entity.getClusterId(), SearchCriteria.Op.EQ);
    TypePodDcStatusSearch.and("status", entity.getStatus(), SearchCriteria.Op.EQ);
    TypePodDcStatusSearch.and("resourceState", entity.getResourceState(), SearchCriteria.Op.EQ);
    TypePodDcStatusSearch.done();
    MsStatusSearch = createSearchBuilder();
    MsStatusSearch.and("ms", MsStatusSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
    MsStatusSearch.and("type", MsStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
    MsStatusSearch.and("resourceState", MsStatusSearch.entity().getResourceState(), SearchCriteria.Op.NIN);
    MsStatusSearch.done();
    TypeDcSearch = createSearchBuilder();
    TypeDcSearch.and("type", TypeDcSearch.entity().getType(), SearchCriteria.Op.EQ);
    TypeDcSearch.and("dc", TypeDcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    TypeDcSearch.done();
    SecondaryStorageVMSearch = createSearchBuilder();
    SecondaryStorageVMSearch.and("type", SecondaryStorageVMSearch.entity().getType(), SearchCriteria.Op.EQ);
    SecondaryStorageVMSearch.and("dc", SecondaryStorageVMSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    SecondaryStorageVMSearch.and("status", SecondaryStorageVMSearch.entity().getStatus(), SearchCriteria.Op.EQ);
    SecondaryStorageVMSearch.done();
    TypeDcStatusSearch = createSearchBuilder();
    TypeDcStatusSearch.and("type", TypeDcStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
    TypeDcStatusSearch.and("dc", TypeDcStatusSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    TypeDcStatusSearch.and("status", TypeDcStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
    TypeDcStatusSearch.and("resourceState", TypeDcStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
    TypeDcStatusSearch.done();
    TypeClusterStatusSearch = createSearchBuilder();
    TypeClusterStatusSearch.and("type", TypeClusterStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
    TypeClusterStatusSearch.and("cluster", TypeClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
    TypeClusterStatusSearch.and("status", TypeClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
    TypeClusterStatusSearch.and("resourceState", TypeClusterStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
    TypeClusterStatusSearch.done();
    IdStatusSearch = createSearchBuilder();
    IdStatusSearch.and("id", IdStatusSearch.entity().getId(), SearchCriteria.Op.EQ);
    IdStatusSearch.and("states", IdStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
    IdStatusSearch.done();
    DcPrivateIpAddressSearch = createSearchBuilder();
    DcPrivateIpAddressSearch.and("privateIpAddress", DcPrivateIpAddressSearch.entity().getPrivateIpAddress(), SearchCriteria.Op.EQ);
    DcPrivateIpAddressSearch.and("dc", DcPrivateIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    DcPrivateIpAddressSearch.done();
    DcStorageIpAddressSearch = createSearchBuilder();
    DcStorageIpAddressSearch.and("storageIpAddress", DcStorageIpAddressSearch.entity().getStorageIpAddress(), SearchCriteria.Op.EQ);
    DcStorageIpAddressSearch.and("dc", DcStorageIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    DcStorageIpAddressSearch.done();
    PublicIpAddressSearch = createSearchBuilder();
    PublicIpAddressSearch.and("publicIpAddress", PublicIpAddressSearch.entity().getPublicIpAddress(), SearchCriteria.Op.EQ);
    PublicIpAddressSearch.done();
    GuidSearch = createSearchBuilder();
    GuidSearch.and("guid", GuidSearch.entity().getGuid(), SearchCriteria.Op.EQ);
    GuidSearch.done();
    DcSearch = createSearchBuilder();
    DcSearch.and("dc", DcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    DcSearch.and("type", DcSearch.entity().getType(), Op.EQ);
    DcSearch.and("status", DcSearch.entity().getStatus(), Op.EQ);
    DcSearch.and("resourceState", DcSearch.entity().getResourceState(), Op.EQ);
    DcSearch.done();
    ClusterStatusSearch = createSearchBuilder();
    ClusterStatusSearch.and("cluster", ClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
    ClusterStatusSearch.and("status", ClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
    ClusterStatusSearch.done();
    TypeNameZoneSearch = createSearchBuilder();
    TypeNameZoneSearch.and("name", TypeNameZoneSearch.entity().getName(), SearchCriteria.Op.EQ);
    TypeNameZoneSearch.and("type", TypeNameZoneSearch.entity().getType(), SearchCriteria.Op.EQ);
    TypeNameZoneSearch.and("zoneId", TypeNameZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    TypeNameZoneSearch.done();
    PodSearch = createSearchBuilder();
    PodSearch.and("podId", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
    PodSearch.done();
    ClusterSearch = createSearchBuilder();
    ClusterSearch.and("clusterId", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
    ClusterSearch.done();
    TypeSearch = createSearchBuilder();
    TypeSearch.and("type", TypeSearch.entity().getType(), SearchCriteria.Op.EQ);
    TypeSearch.done();
    StatusSearch = createSearchBuilder();
    StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
    StatusSearch.done();
    ResourceStateSearch = createSearchBuilder();
    ResourceStateSearch.and("resourceState", ResourceStateSearch.entity().getResourceState(), SearchCriteria.Op.IN);
    ResourceStateSearch.done();
    NameLikeSearch = createSearchBuilder();
    NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
    NameLikeSearch.done();
    NameSearch = createSearchBuilder();
    NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
    NameSearch.done();
    SequenceSearch = createSearchBuilder();
    SequenceSearch.and("id", SequenceSearch.entity().getId(), SearchCriteria.Op.EQ);
    // SequenceSearch.addRetrieve("sequence", SequenceSearch.entity().getSequence());
    SequenceSearch.done();
    DirectlyConnectedSearch = createSearchBuilder();
    DirectlyConnectedSearch.and("resource", DirectlyConnectedSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    DirectlyConnectedSearch.and("ms", DirectlyConnectedSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
    DirectlyConnectedSearch.and("statuses", DirectlyConnectedSearch.entity().getStatus(), SearchCriteria.Op.EQ);
    DirectlyConnectedSearch.and("resourceState", DirectlyConnectedSearch.entity().getResourceState(), SearchCriteria.Op.NOTIN);
    DirectlyConnectedSearch.done();
    UnmanagedDirectConnectSearch = createSearchBuilder();
    UnmanagedDirectConnectSearch.and("resource", UnmanagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    UnmanagedDirectConnectSearch.and("server", UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
    UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ);
    UnmanagedDirectConnectSearch.and("resourceStates", UnmanagedDirectConnectSearch.entity().getResourceState(), SearchCriteria.Op.NIN);
    UnmanagedDirectConnectSearch.and("clusterIn", UnmanagedDirectConnectSearch.entity().getClusterId(), SearchCriteria.Op.IN);
    /*
         * UnmanagedDirectConnectSearch.op(SearchCriteria.Op.OR, "managementServerId",
         * UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
         * UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(),
         * SearchCriteria.Op.LTEQ); UnmanagedDirectConnectSearch.cp(); UnmanagedDirectConnectSearch.cp();
         */
    try {
        HostTransferSearch = _hostTransferDao.createSearchBuilder();
    } catch (Throwable e) {
        s_logger.debug("error", e);
    }
    HostTransferSearch.and("id", HostTransferSearch.entity().getId(), SearchCriteria.Op.NULL);
    UnmanagedDirectConnectSearch.join("hostTransferSearch", HostTransferSearch, HostTransferSearch.entity().getId(), UnmanagedDirectConnectSearch.entity().getId(), JoinType.LEFTOUTER);
    ClusterManagedSearch = _clusterDao.createSearchBuilder();
    ClusterManagedSearch.and("managed", ClusterManagedSearch.entity().getManagedState(), SearchCriteria.Op.EQ);
    UnmanagedDirectConnectSearch.join("ClusterManagedSearch", ClusterManagedSearch, ClusterManagedSearch.entity().getId(), UnmanagedDirectConnectSearch.entity().getClusterId(), JoinType.INNER);
    UnmanagedDirectConnectSearch.done();
    DirectConnectSearch = createSearchBuilder();
    DirectConnectSearch.and("resource", DirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    DirectConnectSearch.and("id", DirectConnectSearch.entity().getId(), SearchCriteria.Op.EQ);
    DirectConnectSearch.and().op("nullserver", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
    DirectConnectSearch.or("server", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
    DirectConnectSearch.cp();
    DirectConnectSearch.done();
    UnmanagedApplianceSearch = createSearchBuilder();
    UnmanagedApplianceSearch.and("resource", UnmanagedApplianceSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    UnmanagedApplianceSearch.and("server", UnmanagedApplianceSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
    UnmanagedApplianceSearch.and("types", UnmanagedApplianceSearch.entity().getType(), SearchCriteria.Op.IN);
    UnmanagedApplianceSearch.and("lastPinged", UnmanagedApplianceSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ);
    UnmanagedApplianceSearch.done();
    AvailHypevisorInZone = createSearchBuilder();
    AvailHypevisorInZone.and("zoneId", AvailHypevisorInZone.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    AvailHypevisorInZone.and("hostId", AvailHypevisorInZone.entity().getId(), SearchCriteria.Op.NEQ);
    AvailHypevisorInZone.and("type", AvailHypevisorInZone.entity().getType(), SearchCriteria.Op.EQ);
    AvailHypevisorInZone.groupBy(AvailHypevisorInZone.entity().getHypervisorType());
    AvailHypevisorInZone.done();
    HostsInStatusSearch = createSearchBuilder(Long.class);
    HostsInStatusSearch.selectFields(HostsInStatusSearch.entity().getId());
    HostsInStatusSearch.and("dc", HostsInStatusSearch.entity().getDataCenterId(), Op.EQ);
    HostsInStatusSearch.and("pod", HostsInStatusSearch.entity().getPodId(), Op.EQ);
    HostsInStatusSearch.and("cluster", HostsInStatusSearch.entity().getClusterId(), Op.EQ);
    HostsInStatusSearch.and("type", HostsInStatusSearch.entity().getType(), Op.EQ);
    HostsInStatusSearch.and("statuses", HostsInStatusSearch.entity().getStatus(), Op.IN);
    HostsInStatusSearch.done();
    CountRoutingByDc = createSearchBuilder(Long.class);
    CountRoutingByDc.select(null, Func.COUNT, null);
    CountRoutingByDc.and("dc", CountRoutingByDc.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    CountRoutingByDc.and("type", CountRoutingByDc.entity().getType(), SearchCriteria.Op.EQ);
    CountRoutingByDc.and("status", CountRoutingByDc.entity().getStatus(), SearchCriteria.Op.EQ);
    CountRoutingByDc.done();
    ManagedDirectConnectSearch = createSearchBuilder();
    ManagedDirectConnectSearch.and("resource", ManagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    ManagedDirectConnectSearch.and("server", ManagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
    ManagedDirectConnectSearch.done();
    ManagedRoutingServersSearch = createSearchBuilder();
    ManagedRoutingServersSearch.and("server", ManagedRoutingServersSearch.entity().getManagementServerId(), SearchCriteria.Op.NNULL);
    ManagedRoutingServersSearch.and("type", ManagedRoutingServersSearch.entity().getType(), SearchCriteria.Op.EQ);
    ManagedRoutingServersSearch.done();
    RoutingSearch = createSearchBuilder();
    RoutingSearch.and("type", RoutingSearch.entity().getType(), SearchCriteria.Op.EQ);
    RoutingSearch.done();
    HostsForReconnectSearch = createSearchBuilder();
    HostsForReconnectSearch.and("resource", HostsForReconnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    HostsForReconnectSearch.and("server", HostsForReconnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
    HostsForReconnectSearch.and("lastPinged", HostsForReconnectSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ);
    HostsForReconnectSearch.and("resourceStates", HostsForReconnectSearch.entity().getResourceState(), SearchCriteria.Op.NIN);
    HostsForReconnectSearch.and("cluster", HostsForReconnectSearch.entity().getClusterId(), SearchCriteria.Op.NNULL);
    HostsForReconnectSearch.and("status", HostsForReconnectSearch.entity().getStatus(), SearchCriteria.Op.IN);
    HostsForReconnectSearch.done();
    ClustersOwnedByMSSearch = createSearchBuilder(Long.class);
    ClustersOwnedByMSSearch.select(null, Func.DISTINCT, ClustersOwnedByMSSearch.entity().getClusterId());
    ClustersOwnedByMSSearch.and("resource", ClustersOwnedByMSSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    ClustersOwnedByMSSearch.and("cluster", ClustersOwnedByMSSearch.entity().getClusterId(), SearchCriteria.Op.NNULL);
    ClustersOwnedByMSSearch.and("server", ClustersOwnedByMSSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
    ClustersOwnedByMSSearch.done();
    ClustersForHostsNotOwnedByAnyMSSearch = createSearchBuilder(Long.class);
    ClustersForHostsNotOwnedByAnyMSSearch.select(null, Func.DISTINCT, ClustersForHostsNotOwnedByAnyMSSearch.entity().getClusterId());
    ClustersForHostsNotOwnedByAnyMSSearch.and("resource", ClustersForHostsNotOwnedByAnyMSSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    ClustersForHostsNotOwnedByAnyMSSearch.and("cluster", ClustersForHostsNotOwnedByAnyMSSearch.entity().getClusterId(), SearchCriteria.Op.NNULL);
    ClustersForHostsNotOwnedByAnyMSSearch.and("server", ClustersForHostsNotOwnedByAnyMSSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
    ClustersForHostsNotOwnedByAnyMSSearch.done();
    AllClustersSearch = _clusterDao.createSearchBuilder(Long.class);
    AllClustersSearch.select(null, Func.NATIVE, AllClustersSearch.entity().getId());
    AllClustersSearch.and("managed", AllClustersSearch.entity().getManagedState(), SearchCriteria.Op.EQ);
    AllClustersSearch.done();
    HostsInClusterSearch = createSearchBuilder();
    HostsInClusterSearch.and("resource", HostsInClusterSearch.entity().getResource(), SearchCriteria.Op.NNULL);
    HostsInClusterSearch.and("cluster", HostsInClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
    HostsInClusterSearch.and("server", HostsInClusterSearch.entity().getManagementServerId(), SearchCriteria.Op.NNULL);
    HostsInClusterSearch.done();
    HostIdSearch = createSearchBuilder(Long.class);
    HostIdSearch.selectFields(HostIdSearch.entity().getId());
    HostIdSearch.and("dataCenterId", HostIdSearch.entity().getDataCenterId(), Op.EQ);
    HostIdSearch.done();
    _statusAttr = _allAttributes.get("status");
    _msIdAttr = _allAttributes.get("managementServerId");
    _pingTimeAttr = _allAttributes.get("lastPinged");
    _resourceStateAttr = _allAttributes.get("resourceState");
    assert (_statusAttr != null && _msIdAttr != null && _pingTimeAttr != null) : "Couldn't find one of these attributes";
}
Also used : HostVO(com.cloud.host.HostVO) PostConstruct(javax.annotation.PostConstruct)

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