Examples of Habitat


Examples of org.jvnet.hk2.component.Habitat

  throws Exception
    {
        if (initialized) {
            return;
        }
        Habitat habitat = Globals.getDefaultHabitat();
        SSLUtils sslUtils = habitat.getComponent(SSLUtils.class);

        keyManagers = sslUtils.getKeyManagers();
        trustManagers = sslUtils.getTrustManagers();
 
        // Creating a default SSLContext and HttpsURLConnection for clients
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

            final ClassLoader loader) {
        /*
         * Initialize the habitat.
         */
        ModulesRegistry registry = new StaticModulesRegistry(loader);
        Habitat h = registry.createHabitat("default");
        return h;
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

        }
        return runtime;
    }

    static private Habitat getHabitat() {
        Habitat habitat = Globals.getStaticHabitat();
        StartupContext startupContext = new StartupContext();
        habitat.add(new ExistingSingletonInhabitant(startupContext));

        habitat.addComponent(null, new ProcessEnvironment(ProcessEnvironment.ProcessType.Other));
        return habitat;
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

  // We need to get the ServletContext to find the Habitat
  ServletContext servletCtx = (ServletContext)
      (ctx.getExternalContext()).getContext();

  // Get the Habitat from the ServletContext
  Habitat habitat = (Habitat) servletCtx.getAttribute(
      org.glassfish.admingui.common.plugin.ConsoleClassLoader.HABITAT_ATTRIBUTE);

//  System.out.println("Habitat:" + habitat);

  return habitat.getByType(ConsolePluginService.class);
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

  // Get the ServletContext
  ServletContext servletCtx = (ServletContext)
      (FacesContext.getCurrentInstance().getExternalContext()).getContext();

  // Get the Habitat from the ServletContext
  Habitat habitat = (Habitat) servletCtx.getAttribute(HABITAT_ATTRIBUTE);

  // Use the Habitat to find the ConsolePluginService and return the
  // correct ClassLoader for the requested module (or null)
  return habitat.getByType(ConsolePluginService.class).
      getModuleClassLoader(moduleName);
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

            if (loginErrorPage == null) {
                throw new AuthException("'loginErrorPage' "
                        + "must be supplied as a property in the provider-config "
                        + "in the domain.xml file!");
            }
            Habitat habitat = SecurityServicesUtil.getInstance().getHabitat();
            Domain domain = habitat.getByType(Domain.class);
            NetworkListener adminListener = domain.getServerNamed("server").getConfig().getNetworkConfig().getNetworkListener("admin-listener");

            if (restURL.contains(TOKEN_ADMIN_LISTENER_PORT)) {
                restURL = restURL.replace(TOKEN_ADMIN_LISTENER_PORT, adminListener.getPort());
            }

      String host = adminListener.getAddress();
      if (! ("localhost".equals(host) || "0.0.0.0".equals(host))){
                restURL = restURL.replace("localhost", adminListener.getAddress());
            }

            //If secure admin is enabled, we need to ensure using https
            SecureAdmin secureAdmin = habitat.getComponent(SecureAdmin.class);
            if (restURL.startsWith("http:") && (SecureAdmin.Util.isEnabled(secureAdmin))) {
                restURL = restURL.replace("http:", "https:");
            }
        }
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

     public static void initialize(Client client){
        if (client == null){
            client = JERSEY_CLIENT;
        }
        try{
            Habitat habitat = SecurityServicesUtil.getInstance().getHabitat();
            SecureAdmin secureAdmin = habitat.getComponent(SecureAdmin.class);
            HTTPSProperties httpsProperties = new HTTPSProperties(new BasicHostnameVerifier(),
                habitat.getComponent(SSLUtils.class).getAdminSSLContext(SecureAdmin.Util.DASAlias(secureAdmin), null ));
            client.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, httpsProperties);
            client.addFilter(new CsrfProtectionFilter());
        }catch(Exception ex){
            GuiUtil.getLogger().warning("RestUtil.initialize() failed");
            if (GuiUtil.getLogger().isLoggable(Level.FINE)){
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

public abstract class AbstractEjbHandler extends AbstractHandler {

    private AnnotationTypesProvider provider = null;
           
    public AbstractEjbHandler() {
        Habitat h = Globals.getDefaultHabitat();
        if( h != null ) {
            provider = h.getComponent(AnnotationTypesProvider.class, "EJB");
        }
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

    }

    public static Habitat getHabitat() {
        ServletContext servletCtx = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
        // Get the Habitat from the ServletContext
        Habitat habitat = (Habitat) servletCtx.getAttribute(
                org.glassfish.admingui.common.plugin.ConsoleClassLoader.HABITAT_ATTRIBUTE);
        return habitat;
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Habitat

                GlassFish server = runtime.newGlassFish(glassFishProperties);
                if (l != null && !l.reuse_instance_location) {
                    // XXX Start the server to get the services
                    server.start();
                    EmbeddedSecurity es = server.getService(EmbeddedSecurity.class);
                    Habitat habitat = server.getService(Habitat.class);

                    // XXX Wait a little before stopping to avoid a deadlock
                    Thread.sleep(1000);
                    server.stop();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.