Package org.glassfish.hk2.utilities

Examples of org.glassfish.hk2.utilities.BuilderHelper


        return javaGlobalPrefix.toString();
    }

    protected EJBContextImpl createEjbInstanceAndContext() throws Exception {

        ServiceLocator services = ejbContainerUtilImpl.getServices();

        JCDIService jcdiService = services.getService(JCDIService.class);

        EjbBundleDescriptorImpl ejbBundle = ejbDescriptor.getEjbBundleDescriptor();

  Object instance = null;
  JCDIService.JCDIInjectionContext jcdiCtx = null;
View Full Code Here


  return ejbClass.newInstance();
    }

    protected void injectEjbInstance(EJBContextImpl context) throws Exception {
       
        ServiceLocator services = ejbContainerUtilImpl.getServices();

        JCDIService jcdiService = services.getService(JCDIService.class);

        EjbBundleDescriptorImpl ejbBundle = ejbDescriptor.getEjbBundleDescriptor();

        Object[] interceptorInstances = null;
View Full Code Here

    public static final Logger logger = Logger.getAnonymousLogger();
   
    private final Subject adminSubject = prepareAdminSubject();
   
    private Subject prepareAdminSubject() {
        final ServiceLocator locator = getBaseServiceLocator();
        if (locator != null) {
            final List<ServiceHandle<? extends Object>> adminIdentities =
/*               
                    (List<ServiceHandle<? extends Object>>) getBaseServiceLocator().getAllServices(
                    new Filter() {
View Full Code Here

     * Returns a configured Habitat with the configuration.
     *
     * @return a configured Habitat
     */
    public ServiceLocator getHabitat() {
        ServiceLocator habitat = Utils.instance.getHabitat(this);
       
        assertNotNull("Transactions service from Configuration subsystem is null", habitat.getService(Transactions.class));
        return habitat;
    }
View Full Code Here

    /**
     * Given a command name, return the name of the class that implements
     * that command in the server.
     */
    private static String getCommandClass(String cmdName) {
        ServiceLocator h = getManHabitat();
        String cname = "org.glassfish.api.admin.AdminCommand";
        ActiveDescriptor<?> ad = h.getBestDescriptor(
                BuilderHelper.createNameAndContractFilter(cname, cmdName));
        if (ad == null) return null;
        return ad.getImplementation();
    }
View Full Code Here

    public static void initialize(Client client) {
        if (client == null) {
            client = getJerseyClient();
        }
        try {
            ServiceLocator habitat = SecurityServicesUtil.getInstance().getHabitat();
            SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);
            client.property(ClientProperties.SSL_CONFIG, new SslConfig(new BasicHostnameVerifier(),
                                                                                          habitat.<SSLUtils>getService(SSLUtils.class).getAdminSSLContext(SecureAdmin.Util.DASAlias(secureAdmin), null)));
            client.register(CsrfProtectionFilter.class);

        } catch (Exception ex) {
            Throwable cause = ex;
            int lcv = 0;
View Full Code Here

    // Jersey client methods
    //******************************************************************************************************************

    public static ClientBuilder initialize(ClientBuilder clientBuilder) {
        try {
            ServiceLocator habitat = SecurityServicesUtil.getInstance().getHabitat();
            SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);

            final SSLContext sslContext = habitat
                    .<SSLUtils>getService(SSLUtils.class)
                    .getAdminSSLContext(SecureAdmin.Util.DASAlias(secureAdmin), null);

            // Instruct Jersey to use HostNameVerifier and SSLContext provided by us.
            clientBuilder
View Full Code Here

    /**
     * Given a command name, return the name of the class that implements
     * that command in the server.
     */
    private static String getCommandClass(String cmdName) {
        ServiceLocator h = getManHabitat();
        String cname = "org.glassfish.api.admin.AdminCommand";
        for (ActiveDescriptor<?> ad : h.getDescriptors(BuilderHelper.createContractFilter(cname))) {
            if (ad.getName() != null && ad.getName().equals(cmdName)) {
                return ad.getImplementation();
            }
        }
       
View Full Code Here

    private static synchronized ServiceLocator getManHabitat() {
        if (manServiceLocator != null)
            return manServiceLocator;
       
        ModulesRegistry registry = new StaticModulesRegistry(getModuleClassLoader());
        ServiceLocator serviceLocator = registry.createServiceLocator("default");
        manServiceLocator = serviceLocator;
        return manServiceLocator;
    }
View Full Code Here

            if (loginErrorPage == null) {
                throw new AuthException("'loginErrorPage' "
                        + "must be supplied as a property in the provider-config "
                        + "in the domain.xml file!");
            }
            ServiceLocator habitat = SecurityServicesUtil.getInstance().getHabitat();
            Domain domain = habitat.getService(Domain.class);
            NetworkListener adminListener = domain.getServerNamed("server").getConfig().getNetworkConfig().getNetworkListener("admin-listener");
            SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);
           
            final String host = adminListener.getAddress();
            // Save the REST URL we need to authenticate the user.
            this.restURL =  (SecureAdmin.Util.isEnabled(secureAdmin) ? "https://" : "http://") +
                    (host.equals("0.0.0.0") ? "localhost" : host) + ":" + adminListener.getPort() + "/management/sessions";
View Full Code Here

TOP

Related Classes of org.glassfish.hk2.utilities.BuilderHelper

Copyright © 2018 www.massapicom. 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.