Package org.jvnet.hk2.component

Examples of org.jvnet.hk2.component.Habitat


            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


            _logger.log(Level.FINE,"initRecovery:Configuration.MANUAL_RECOVERY: " + value);
        }
        if (force || (isValueSet(value) && "true".equals(value))) {
            recoveryInitialized = true;

            Habitat habitat = (Habitat)properties.get(HABITAT);
            if (habitat != null) {
                ProcessEnvironment processEnv = habitat.getComponent(ProcessEnvironment.class);
                if( processEnv.getProcessType().isServer()) {
                    // Start ResourceManager if it hadn't started yet
                    habitat.getComponent(PostStartup.class,"ResourceManager");
                    value = properties.getProperty("pending-txn-cleanup-interval");
                    int interval = -1;
                    if (isValueSet(value)) {
                        interval = Integer.parseInt(value);
                    }
View Full Code Here

  return sb.toString() ;
    }

    public SerialInitContextFactory() {
        // Issue 14396
        Habitat temp = defaultHabitat ;
        if (temp == null) {
            temp = Globals.getDefaultHabitat() ;
        }
        if (temp == null) {
            // May need to initialize hk2 component model in standalone client
View Full Code Here

            }

            return obj;
        } catch (NamingException ex) {

            Habitat habitat = Globals.getDefaultHabitat();
            ProcessEnvironment processEnv = habitat.getComponent(ProcessEnvironment.class);
            if( fullName.startsWith("java:app/") &&
                processEnv.getProcessType() == ProcessType.ACC ) {

                // This could either be an attempt by an app client to access a portable
                // remote session bean JNDI name via the java:app namespace or a lookup of
                // an application-defined java:app environment dependency.  Try them in
                // that order.

                Context ic = namingManager.getInitialContext();
                String appName = (String) namingManager.getInitialContext().lookup("java:app/AppName");

                Object obj = null;

                if( !fullName.startsWith("java:app/env/")) {
                    try {

                        // Translate the java:app name into the equivalent java:global name so that
                        // the lookup will be resolved by the server.
                        String newPrefix = "java:global/" + appName + "/";

                        int javaAppLength = "java:app/".length();
                        String globalLookup = newPrefix + fullName.substring(javaAppLength);

                        obj = ic.lookup(globalLookup);

                    } catch(NamingException javaappenvne) {
                        _logger.log(Level.FINE, "Trying global version of java:app ejb lookup",
                                javaappenvne);
                    }
                }

                if( obj == null ) {
                   ComponentNamingUtil compNamingUtil = habitat.getByContract(ComponentNamingUtil.class);
                   String internalGlobalJavaAppName =
                    compNamingUtil.composeInternalGlobalJavaAppName(appName, fullName);

                    obj = ic.lookup(internalGlobalJavaAppName);
                }
View Full Code Here

        ObjectInputOutputStreamFactoryFactory.setFactory(
                new OSGiObjectInputOutputStreamFactoryImpl(context));

        // force initialisation of NamingBuilder so that any naming operation will be redirected via
        // our builder which is essential for issue #8458
        Habitat habitat = Globals.getDefaultHabitat();
        habitat.getComponent(GlassFishNamingBuilder.class);
    }
View Full Code Here

        return map;
    }
   
    private static MBeanServerConnection getMBeanServerConnection(String target) throws ConnectorRuntimeException, Exception {
        Habitat habitat = GuiUtil.getHabitat();
        Domain domain = habitat.getComponent(Domain.class);
        Cluster cluster = domain.getClusterNamed(target);
        String configRef = null;
        if (cluster == null) {
            Server server = domain.getServerNamed(target);
            configRef = server.getConfigRef();
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

     */
    private Connection getConnection(String jndiName) throws Exception {
        // TODO - pass Habitat or ConnectorRuntime as an argument.
        // TODO - remove duplication with DeploymentHelper

        Habitat habitat = Globals.getDefaultHabitat();
        ConnectorRuntime connectorRuntime = habitat.getByContract(ConnectorRuntime.class);
        DataSource ds = PersistenceHelper.lookupNonTxResource(connectorRuntime, ctx, jndiName);
        return ds.getConnection();
    }
View Full Code Here

        currentApplicationStatProvider.set(applicationStatsProvider);
    }

    private String getApplicationName(String path) {
        Habitat habitat = Globals.getDefaultHabitat();

        Domain domain = habitat.getInhabitantByType(Domain.class).get();

        List<Application> applicationList = domain.getApplications().getApplications();

        // looks like path always ends with "/" .. but just to be sure..
        for(Application app : applicationList) {
View Full Code Here

            super.setElementValue(element, value);
        }
    }

    private SecurityRoleMapper getRoleMapper(){
        Habitat habitat = Globals.getDefaultHabitat();
        SecurityRoleMapper srm = null;
        if(habitat != null){
            SecurityRoleMapperFactory srmf = habitat.getComponent(SecurityRoleMapperFactory.class);
            if(srmf != null){
                srm = srmf.getRoleMapper(descriptor.getModuleDescriptor().getModuleName());
            }
        }
        return srm;
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.