Package org.jvnet.hk2.component

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


    public Object getContainer(Object info) {

        Object[] params = (Object[])info;
        String appName = (String)params[0];

        Habitat habitat = Globals.getDefaultHabitat();
        ApplicationRegistry reg = habitat.getComponent(ApplicationRegistry.class);
        ApplicationInfo appInfo = reg.get(appName);
        Application app = appInfo.getMetaData(Application.class);

        EjbDescriptor desc = app.getEjbByName((String)params[1]);
View Full Code Here

            logger.fine("ejb.DeploymentHelper.getconnection", name); //NOI18N
        }

        // TODO - pass Habitat or ConnectorRuntime as an argument.

        Habitat habitat = Globals.getDefaultHabitat();
        DataSource ds = null;
        try {
            ConnectorRuntime connectorRuntime = habitat.getByContract(ConnectorRuntime.class);
            ds = DataSource.class.cast(connectorRuntime.lookupNonTxResource(name, true));
        } catch (Exception e) {
            throw new JDOFatalUserException(
                I18NHelper.getMessage(messages,
                        "ejb.jndi.lookupfailed", name)); //NOI18N
View Full Code Here

        return javaGlobalPrefix.toString();
    }

    protected EJBContextImpl createEjbInstanceAndContext() throws Exception {

  Habitat h = ejbContainerUtilImpl.getDefaultHabitat();

        JCDIService jcdiService = h.getByContract(JCDIService.class);

        EjbBundleDescriptor ejbBundle = ejbDescriptor.getEjbBundleDescriptor();

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

  return ejbClass.newInstance();
    }

    protected void injectEjbInstance(EJBContextImpl context) throws Exception {
       
        Habitat h = ejbContainerUtilImpl.getDefaultHabitat();

        JCDIService jcdiService = h.getByContract(JCDIService.class);

        EjbBundleDescriptor ejbBundle = ejbDescriptor.getEjbBundleDescriptor();

        Object[] interceptorInstances = null;
View Full Code Here

            throw e;
        }
    }
   
    private void resolveWebProgrammaticLogin() {
        Habitat habitat = SecurityServicesUtil.getInstance().getHabitat();
        this.webProgrammaticLogin = habitat.getComponent(WebProgrammaticLogin.class);
    }
View Full Code Here

    private static synchronized Realm doInstantiate(String name, String className,
                                       Properties props)
        throws BadRealmException
    {
       
        Habitat habitat = Globals.getDefaultHabitat();
        RealmsManager mgr = null;
        try {
            mgr = getRealmsManager();
            Class realmClass = null;
            //try a HK2 route first
            Realm r = habitat.getComponent(Realm.class, name);
            if (r == null) {
                try {
                    //TODO: workaround here. Once fixed in V3 we should be able to use
                    //Context ClassLoader instead.
                    ClassLoaderHierarchy hierarchy =
                            habitat.getComponent(ClassLoaderHierarchy.class);
                    realmClass = hierarchy.getCommonClassLoader().loadClass(className);
                    Object obj = realmClass.newInstance();
                    r = (Realm) obj;
                } catch (ClassNotFoundException ex) {
                    realmClass = Class.forName(className);
View Full Code Here

               "com.sun.enterprise.security.auth.realm.file.FileRealm",
               "com.sun.enterprise.security.auth.realm.certificate.CertificateRealm",
               "com.sun.enterprise.security.auth.realm.ldap.LDAPRealm",
               "com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm",
               "com.sun.enterprise.security.auth.realm.solaris.SolarisRealm"};*/
       Habitat habitat = Globals.getDefaultHabitat();
       Collection<Inhabitant<? extends Realm>> collection = habitat.getInhabitants(Realm.class);
       List<String> arr = new ArrayList<String>();
       for (Inhabitant<? extends Realm> it : collection) {
           arr.add(it.typeName());
       }
     
View Full Code Here

        LogDomains.getLogger(CustomSocketFactory.class, LogDomains.SECURITY_LOGGER);
    protected static final StringManager sm =
        StringManager.getManager(CustomSocketFactory.class);

    public  CustomSocketFactory() {
        Habitat habitat = Globals.getDefaultHabitat();
        SSLUtils sslUtils = habitat.getComponent(SSLUtils.class);
        SSLContext sc = null;
        try {
            sc = SSLContext.getInstance(SSL);
            sc.init(sslUtils.getKeyManagers(), sslUtils.getTrustManagers(), SharedSecureRandom.get());
        } catch (Exception ex) {
View Full Code Here

            for (File file : files) {
                DomainDirs dir = new DomainDirs(file);
                File domainXMLFile = dir.getServerDirs().getDomainXml();
                logger.finer("Domain XML file = " + domainXMLFile);
                try {
                    Habitat habitat = Globals.getStaticHabitat();
                    ConfigParser parser = new ConfigParser(habitat);
                    URL domainURL = domainXMLFile.toURI().toURL();
                    DomDocument doc = parser.parse(domainURL);
                    Dom domDomain = doc.getRoot();
                    Domain domain = domDomain.createProxy(Domain.class);
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.component.Habitat

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.