Search in sources :

Example 31 with PostConstruct

use of javax.annotation.PostConstruct in project pinpoint by naver.

the class TestUDPReceiver method start.

@PostConstruct
@Override
public void start() {
    logger.info("{} start.", receiverName);
    afterPropertiesSet();
    final DatagramSocket socket = this.socket;
    if (socket == null) {
        throw new IllegalStateException("socket is null.");
    }
    bindSocket(socket, bindAddress, port);
    logger.info("UDP Packet reader:{} started.", ioThreadSize);
    for (int i = 0; i < ioThreadSize; i++) {
        io.execute(new Runnable() {

            @Override
            public void run() {
                receive(socket);
            }
        });
    }
}
Also used : DatagramSocket(java.net.DatagramSocket) PostConstruct(javax.annotation.PostConstruct)

Example 32 with PostConstruct

use of javax.annotation.PostConstruct in project che by eclipse.

the class WSocketEventBusClient method start.

@PostConstruct
void start() {
    if (start.compareAndSet(false, true)) {
        if (policy != null) {
            eventService.subscribe(new EventSubscriber<Object>() {

                @Override
                public void onEvent(Object event) {
                    propagate(event);
                }
            });
        }
        if (eventSubscriptions != null) {
            final Map<URI, Set<String>> cfg = new HashMap<>();
            for (Pair<String, String> service : eventSubscriptions) {
                try {
                    final URI key = new URI(service.first);
                    Set<String> values = cfg.get(key);
                    if (values == null) {
                        cfg.put(key, values = new LinkedHashSet<>());
                    }
                    if (service.second != null) {
                        values.add(service.second);
                    }
                } catch (URISyntaxException e) {
                    LOG.error(e.getMessage(), e);
                }
            }
            if (!cfg.isEmpty()) {
                executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("WSocketEventBusClient-%d").setUncaughtExceptionHandler(LoggingUncaughtExceptionHandler.getInstance()).setDaemon(true).build());
                for (Map.Entry<URI, Set<String>> entry : cfg.entrySet()) {
                    executor.execute(new ConnectTask(entry.getKey(), entry.getValue()));
                }
            }
        }
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) PostConstruct(javax.annotation.PostConstruct)

Example 33 with PostConstruct

use of javax.annotation.PostConstruct in project che by eclipse.

the class JavaPlugin method start.

@PostConstruct
public void start() {
    //        WorkingCopyOwner.setPrimaryBufferProvider(new WorkingCopyOwner() {
    //            @Override
    //            public IBuffer createBuffer(ICompilationUnit workingCopy) {
    //                ICompilationUnit original = workingCopy.getPrimary();
    //                IResource resource = original.getResource();
    //                if (resource instanceof IFile)
    //                    return new DocumentAdapter(workingCopy, (IFile)resource);
    //                return DocumentAdapter.NULL;
    //            }
    //        });
    new JavaCore();
    fMembersOrderPreferenceCache = new MembersOrderPreferenceCache();
    PreferenceConstants.initializeDefaultValues(PreferenceConstants.getPreferenceStore());
    new JavaCorePreferenceInitializer().initializeDefaultPreferences();
    new CheCodeFormatterInitializer().initializeDefaultPreferences();
}
Also used : MembersOrderPreferenceCache(org.eclipse.jdt.internal.ui.preferences.MembersOrderPreferenceCache) JavaCorePreferenceInitializer(org.eclipse.jdt.internal.core.JavaCorePreferenceInitializer) JavaCore(org.eclipse.jdt.core.JavaCore) CheCodeFormatterInitializer(org.eclipse.jdt.internal.corext.format.CheCodeFormatterInitializer) PostConstruct(javax.annotation.PostConstruct)

Example 34 with PostConstruct

use of javax.annotation.PostConstruct in project vaadin-samples by xpoft.

the class AuthenticatedView method PostConstruct.

@PostConstruct
public void PostConstruct() {
    setSizeFull();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(new Label("@RequiresAuthentication"));
    layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME)));
    setContent(layout);
}
Also used : Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ExternalResource(com.vaadin.server.ExternalResource) Link(com.vaadin.ui.Link) PostConstruct(javax.annotation.PostConstruct)

Example 35 with PostConstruct

use of javax.annotation.PostConstruct in project vaadin-samples by xpoft.

the class MainView method PostConstruct.

//private Label rolesLabel = new Label();
@PostConstruct
public void PostConstruct() {
    setSizeFull();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    HorizontalLayout usernameLayout = new HorizontalLayout();
    usernameLayout.setSpacing(true);
    usernameLayout.addComponent(new Label("Username:"));
    usernameLayout.addComponent(usernameLabel);
    //HorizontalLayout userRolesLayout = new HorizontalLayout();
    //userRolesLayout.setSpacing(true);
    //userRolesLayout.addComponent(new Label("Roles:"));
    //userRolesLayout.addComponent(rolesLabel);
    layout.addComponent(usernameLayout);
    //addComponent(userRolesLayout);
    Link roleUserView = new Link("Role \"user\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleUserView.NAME));
    Link roleAdminView = new Link("Role \"admin\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME));
    Link authenticatedView = new Link("@RequiresAuthentication View (disabled, if user doesn't have access)", new ExternalResource("#!" + AuthenticatedView.NAME));
    Link guestView = new Link("@RequiresGuest View (disabled, if user doesn't have access)", new ExternalResource("#!" + GuestView.NAME));
    Link userView = new Link("@RequiresUser View (disabled, if user doesn't have access)", new ExternalResource("#!" + UserView.NAME));
    roleUserView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleUserView.class));
    roleAdminView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleAdminView.class));
    authenticatedView.setEnabled(ShiroSecurityNavigator.hasAccess(AuthenticatedView.class));
    guestView.setEnabled(ShiroSecurityNavigator.hasAccess(GuestView.class));
    userView.setEnabled(ShiroSecurityNavigator.hasAccess(UserView.class));
    layout.addComponent(roleUserView);
    layout.addComponent(roleAdminView);
    layout.addComponent(authenticatedView);
    layout.addComponent(guestView);
    layout.addComponent(userView);
    layout.addComponent(new Link("Role \"admin\" View (throw exception, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME)));
    layout.addComponent(new Link("Logout", new ExternalResource("/logout/")));
    setContent(layout);
}
Also used : ExternalResource(com.vaadin.server.ExternalResource) 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