Package org.glassfish.hk2.api

Examples of org.glassfish.hk2.api.ServiceLocator


        }
        currentInvocation.setTransactionOperationsManager(preexistingTransactionOperationsManager);
    }

    ComponentInvocation getCurrentInvocation() {
        ServiceLocator serviceLocator = Globals.getDefaultHabitat();
        InvocationManager invocationManager =
                serviceLocator == null ? null : serviceLocator.getService(InvocationManager.class);
        return invocationManager == null ? null : invocationManager.getCurrentInvocation();
    }
View Full Code Here


        this.deployment = deployment;
    }

    public <T> void aroundInject(InjectionContext<T> injectionContext) {
        try {
            ServiceLocator serviceLocator = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
            EjbContainerServices containerServices = serviceLocator.getService(EjbContainerServices.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            ManagedBeanDescriptor mbDesc = null;
View Full Code Here

        injectionManager = injectionMgr;
    }

    public <T> void aroundInject(InjectionContext<T> injectionContext) {
        try {
            ServiceLocator serviceLocator = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            Object target = injectionContext.getTarget();
            String targetClass = target.getClass().getName();
View Full Code Here

      return res;
    }

    public <T> void aroundInject(InjectionContext<T> injectionContext) {
        try {
            ServiceLocator serviceLocator = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
            EjbContainerServices containerServices = serviceLocator.getService(EjbContainerServices.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            ManagedBeanDescriptor mbDesc = null;
View Full Code Here

        this.deployment = deployment;
    }

    public <T> void aroundInject(InjectionContext<T> injectionContext) {
        try {
            ServiceLocator serviceLocator = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
            EjbContainerServices containerServices = serviceLocator.getService(EjbContainerServices.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            ManagedBeanDescriptor mbDesc = null;
View Full Code Here

        }
    }

    private JavaEETransactionManager getTransactionManager() {
        if (transactionManager == null) {
            ServiceLocator serviceLocator = Globals.get(ServiceLocator.class);
            if (serviceLocator != null)
                transactionManager = serviceLocator.getService(JavaEETransactionManager.class);
            if (transactionManager == null) {
                throw new RuntimeException(localStrings.getLocalString("txn.mgr.failure", "Unable to retrieve transaction manager."));
            }
        }
        return transactionManager;
View Full Code Here

     */
    public static ArchiveType getModuleType(String moduleType) {
        if (moduleType == null) {
            return null;
        }
        final ServiceLocator services = Globals.getDefaultHabitat();
        ArchiveType result = null;
        // This method is called without HK2 being setup when dol unit tests are run, so protect against NPE.
        if(services != null) {
            result = services.getService(ArchiveType.class, moduleType);
        }
        return result;
    }
View Full Code Here

     */
    public static ArchiveType getModuleType(String moduleType) {
        if (moduleType == null) {
            return null;
        }
        final ServiceLocator services = Globals.getDefaultHabitat();
        ArchiveType result = null;
        // This method is called without HK2 being setup when dol unit tests are run, so protect against NPE.
        if(services != null) {
            result = services.getService(ArchiveType.class, moduleType);
        }
        return result;
    }
View Full Code Here

            useDOLforDeployment = Boolean.valueOf(System.getProperty(DOL_DEPLOYMENT));
        }
    }
   
    private WebConfigListener addAndGetWebConfigListener() {
      ServiceLocator locator = (ServiceLocator) habitat;
     
      DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
      DynamicConfiguration config = dcs.createDynamicConfiguration();
     
      config.addActiveDescriptor(WebConfigListener.class);
     
      config.commit();
     
      return locator.getService(WebConfigListener.class);
    }
View Full Code Here

        if (serverContext == null) {
            String msg = _rb.getString(NO_SERVER_CONTEXT);
            msg = MessageFormat.format(msg, wm.getName());
            throw new IllegalStateException(msg);
        }
        ServiceLocator services = serverContext.getDefaultServices();
        im = services.getService(InvocationManager.class);
        tm = getJavaEETransactionManager(services);
        injectionMgr = services.getService(InjectionManager.class);
        initialized = true;

        securityContext = serverContext.getDefaultServices().getService(AppServSecurityContext.class);
        if (securityContext != null) {
            if (_logger.isLoggable(Level.FINE)) {
View Full Code Here

TOP

Related Classes of org.glassfish.hk2.api.ServiceLocator

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.