Package org.jvnet.hk2.component

Examples of org.jvnet.hk2.component.Habitat


        if (vi != null) {
            visibility = vi.value();
        }
       
        String classAnalysisName = null;
        Service service = constant.getClass().getAnnotation(Service.class);
        if (service != null) {
            classAnalysisName = service.analyzer();
        }
       
        return new ConstantActiveDescriptor<T>(
                constant,
                contractsAsSet,
View Full Code Here


    public WonderlandAppServer(Server server) {
        this.server = server;

        // add a module to properly specify the classpath
        Habitat h = server.getHabitat();
        ModulesRegistry mr = h.getComponent(ModulesRegistry.class);
        mr.add(new ClasspathModuleDefinition(WebServerLauncher.getClassLoader()));
    }
View Full Code Here

    public Habitat createHabitat() throws ComponentException {
        if (null != habitatFactory) {
          return habitatFactory.newHabitat();
        }
       
        return new Habitat();
    }
View Full Code Here

            final GlassFishProperties gfProps = new GlassFishProperties(cloned);
            setEnv(gfProps);

            final StartupContext startupContext = new StartupContext(gfProps.getProperties());
            ModulesRegistry modulesRegistry = AbstractFactory.getInstance().createModulesRegistry();
            final Habitat habitat = main.createHabitat(modulesRegistry, startupContext);
            final ModuleStartup gfKernel = main.findStartupService(modulesRegistry, habitat, null, startupContext);
            // create a new GlassFish instance
            GlassFishImpl gfImpl = new GlassFishImpl(gfKernel, habitat, gfProps.getProperties()) {
                @Override
                public void dispose() throws GlassFishException {
View Full Code Here

            final ServiceTracker hk2Tracker = new ServiceTracker(getBundleContext(), Main.class.getName(), null);
            hk2Tracker.open();
            final Main main = (Main) hk2Tracker.waitForService(0);
            hk2Tracker.close();
            final ModulesRegistry mr = ModulesRegistry.class.cast(getBundleContext().getService(getBundleContext().getServiceReference(ModulesRegistry.class.getName())));
            final Habitat habitat = main.createHabitat(mr, startupContext);
            final ModuleStartup gfKernel = main.findStartupService(mr, habitat, null, startupContext);
            GlassFish glassFish = createGlassFish(gfKernel, habitat, gfProps.getProperties());
            gfs.add(glassFish);
            getBundleContext().registerService(GlassFish.class.getName(), glassFish, gfProps.getProperties());
            return glassFish;
View Full Code Here

    }

    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

     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);
        }catch(Exception ex){
            GuiUtil.getLogger().warning("RestUtil.initialize() failed");
            if (GuiUtil.getLogger().isLoggable(Level.FINE)){
                ex.printStackTrace();
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()) {
                    value = properties.getProperty("pending-txn-cleanup-interval");
                    int interval = -1;
                    if (isValueSet(value)) {
                        interval = Integer.parseInt(value);
View Full Code Here

        if ( ! domainXMLFile.exists()) {
            return null;
        }

        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 d = domDomain.createProxy(Domain.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

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.