/* (non-Javadoc)
@see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
514508
public void start(BundleContext context) throws Exception {
        if (!checkConfig(context)) {
            return;
        }

        if (monitoringService == null) {
            initWsClient(context);
        }

        EventType serverStartEvent = createEventType(EventEnumType.SERVER_START);
        putEvent(serverStartEvent);

        LOG.info("Send SERVER_START event to SAM Server successful!");
    }
1236733
@Override
    public synchronized void start( BootstrapContext ctx ) throws ResourceAdapterInternalException {
        if (engine == null) {
            engine = new ModeShapeEngine();
            engine.start();
        }
    }
635009
public void start() throws Exception {
        bundleClassResolverHelper = new BundleClassResolverHelper(bundleContext);
        bundleClassResolverHelper.setApplicationName(applicationName);
        bundleClassResolverHelper.register();
    }
687986
@Override
    public void start(StartContext context) throws StartException {
        this.config = this.getConfigurationBuilder().build();

        EmbeddedCacheManager container = this.getCacheContainer();
        CacheMode mode = this.config.clustering().cacheMode();
        if (mode.isClustered() && (container.getCacheManagerConfiguration().transport().transport() == null)) {
            throw InfinispanMessages.MESSAGES.transportRequired(mode, this.name, container.getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName());
        }

        SecurityActions.defineContainerConfiguration(container, this.name, this.config);

        log.debugf("%s cache configuration started", this.name);
    }
561208
protected void activate(ComponentContext cc) {
        Bundle usingBundle = cc.getUsingBundle();
        userContext = usingBundle.getBundleContext();
    }
413627
public Object startupService(BundleContext bundleContext)
    {
        Map<String,Object> propertiesTemp = new Hashtable<String,Object>();
        Util.parseArgs(propertiesTemp, args);

        //?server = new SApplet(args);
        ThinApplet.main(args);
        return Application.getRootApplet();
        //?Environment env = new Environment(propertiesTemp);
    }
1059623
@Activate
    protected void activate(ComponentContext componentContext, Map<String, Object> props) {
        this.componentContext = componentContext;

        // // Parse the configuration that we've been provided
        // Dictionary<?, ?> configProperties = componentContext.getProperties();
        // processConfigProperties(configProperties);

        // Hold a reference to the bundle context
        bundleContext = componentContext.getBundleContext();

        // Start listening to the framework events so we can publish them
        // as specified in section 113.6.3
        frameworkEventAdapter = new FrameworkEventAdapter(this);
        bundleContext.addFrameworkListener(frameworkEventAdapter);

        // Start listening to the bundle events so we can publish them
        // as specified in section 113.6.4
        bundleEventAdapter = new BundleEventAdapter(this);
        bundleContext.addBundleListener(bundleEventAdapter);

        // Start listening to the service events so we can publish them
        // as specified in section 113.6.5
        serviceEventAdapter = new ServiceEventAdapter(this);
        bundleContext.addServiceListener(serviceEventAdapter);
        processConfigProperties(props);
    }
1256101
public void start() {
        if (state == State.RUNNING) return;
        final Lock lock = this.lock.writeLock();
        try {
            lock.lock();
            this.state = State.STARTING;

            // Create an executor service that we'll use to start the repositories ...
            ThreadFactory threadFactory = new NamedThreadFactory("modeshape-start-repo");
            repositoryStarterService = Executors.newCachedThreadPool(threadFactory);

            state = State.RUNNING;
        } catch (RuntimeException e) {
            state = State.NOT_RUNNING;
            throw e;
        } finally {
            lock.unlock();
        }
    }
138866
public void start(BundleContext context) throws Exception {
    	Util.getLogger().info("Starting Jdbc bundle");
        
        //xthis.setProperty(BundleActivatorModel.PACKAGE_NAME, Util.getPackageName(JdbcDatabase.class.getName()));
        //x this.setProperty(BundleService.INTERFACE, BaseDatabase.class.getName());
        this.setProperty(BundleConstants.TYPE, DBParams.JDBC);
        
        super.start(context);
    }
310991
public static void startActivity(@NonNull Context context, @Nullable JSONObject jsonObject) {
        Intent intent = new Intent(context, JSONViewerActivity.class);
        Bundle bundle = new Bundle();
        if (jsonObject != null) {
            bundle.putString(JSON_OBJECT_STATE, jsonObject.toString());
        }
        intent.putExtras(bundle);
        context.startActivity(intent);
    }
548707
@Override
    public void start(BundleContext bc) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "start", bc);
        }
    }
1089480
public void start(BundleContext context) throws Exception
    {
        super.start(context);
        repositoryAdmin = this.getRepositoryAdmin(context, this);
        
        if (repositoryAdmin != null)
        {   // The repository is up, I can get to work (otherwise, I'll be waiting)
        	this.addBootstrapRepository(repositoryAdmin, context);
            this.registerClassFinder(context);
        }
    }
900435
public void start()
        throws Exception
    {
        if (_context==null)
            throw new IllegalStateException("No context for "+this);        
        _started=true;
        if(log.isDebugEnabled())log.debug("Started "+this);
    }
108004
@Override
    public synchronized void start(final StartContext context) throws StartException {
        final ModelController modelController = modelControllerSupplier.get();
        final ControlledProcessStateService controlledProcessStateService = controlledProcessStateServiceSupplier.get();
        socketBindingManager = socketBindingManagerSupplier != null ? socketBindingManagerSupplier.get() : null;

        final SecurityRealm securityRealm = securityRealmSupplier != null ? securityRealmSupplier.get() : null;
        final HttpAuthenticationFactory httpAuthenticationFactory = httpAuthFactorySupplier != null ? httpAuthFactorySupplier.get() : null;
        SSLContext sslContext = sslContextSupplier != null ? sslContextSupplier.get() : null;
        final SslClientAuthMode sslClientAuthMode;
        if (sslContext == null && securityRealm != null) {
            sslContext = securityRealm.getSSLContext();
            sslClientAuthMode = getSslClientAuthMode(securityRealm);
        } else {
            sslClientAuthMode = null;
        }

        InetSocketAddress bindAddress = null;
        InetSocketAddress secureBindAddress = null;

        final SocketBinding basicBinding = socketBindingSupplier != null ? socketBindingSupplier.get() : null;
        final SocketBinding secureBinding = secureSocketBindingSupplier != null ? secureSocketBindingSupplier.get() : null;
        final NetworkInterfaceBinding interfaceBinding = interfaceBindingSupplier != null ? interfaceBindingSupplier.get() : null;
        final NetworkInterfaceBinding secureInterfaceBinding = secureInterfaceBindingSupplier != null ? secureInterfaceBindingSupplier.get() : null;
        if (interfaceBinding != null) {
            useUnmanagedBindings = true;
            assert this.port != null;
            final int port = this.port;
            if (port > 0) {
                bindAddress = new InetSocketAddress(interfaceBinding.getAddress(), port);
            }
            assert this.securePort != null;
            final int securePort = this.securePort;
            if (securePort > 0) {
                InetAddress secureAddress = secureInterfaceBinding == null ? interfaceBinding.getAddress() : secureInterfaceBinding.getAddress();
                secureBindAddress = new InetSocketAddress(secureAddress, securePort);
            }
        } else {
            if (basicBinding != null) {
                bindAddress = basicBinding.getSocketAddress();
            }
            if (secureBinding != null) {
                secureBindAddress = secureBinding.getSocketAddress();
            }
        }
        List<ListenerRegistry.Listener> listeners = new ArrayList<>();
        //TODO: rethink this whole ListenerRegistry business
        if(bindAddress != null) {
            ListenerRegistry.Listener http = new ListenerRegistry.Listener("http", HTTP_MANAGEMENT, SERVER_NAME, bindAddress);
            http.setContextInformation("socket-binding", basicBinding);
            listeners.add(http);
        }
        if(secureBindAddress != null) {
            ListenerRegistry.Listener https = new ListenerRegistry.Listener("https", HTTPS_MANAGEMENT, SERVER_NAME, bindAddress);
            https.setContextInformation("socket-binding", secureBinding);
            listeners.add(https);
        }

        final ChannelUpgradeHandler upgradeHandler = new ChannelUpgradeHandler();
        final ServiceBuilder<?> builder = context.getChildTarget().addService(HTTP_UPGRADE_SERVICE_NAME);
        final Consumer<Object> upgradeHandlerConsumer = builder.provides(HTTP_UPGRADE_SERVICE_NAME, HTTPS_UPGRADE_SERVICE_NAME);
        builder.setInstance(org.jboss.msc.Service.newInstance(upgradeHandlerConsumer, upgradeHandler));
        builder.install();
        for (ListenerRegistry.Listener listener : listeners) {
            listener.addHttpUpgradeMetadata(new ListenerRegistry.HttpUpgradeMetadata(JBOSS_REMOTING, MANAGEMENT_ENDPOINT));
        }

        if (listenerRegistrySupplier.get() != null) {
            for(ListenerRegistry.Listener listener : listeners) {
                listenerRegistrySupplier.get().addListener(listener);
            }
        }

        try {
            serverManagement = ManagementHttpServer.builder()
                    .setBindAddress(bindAddress)
                    .setSecureBindAddress(secureBindAddress)
                    .setModelController(modelController)
                    .setSecurityRealm(securityRealm)
                    .setSSLContext(sslContext)
                    .setSSLClientAuthMode(sslClientAuthMode)
                    .setHttpAuthenticationFactory(httpAuthenticationFactory)
                    .setControlledProcessStateService(controlledProcessStateService)
                    .setConsoleMode(consoleMode)
                    .setConsoleSlot(consoleSlot)
                    .setChannelUpgradeHandler(upgradeHandler)
                    .setManagementHttpRequestProcessor(requestProcessorSupplier.get())
                    .setAllowedOrigins(allowedOrigins)
                    .setWorker(workerSupplier.get())
                    .setExecutor(executorSupplier.get())
                    .build();

            serverManagement.start();

            // Register the now-created sockets with the SBM
            if (socketBindingManager != null) {
                if (useUnmanagedBindings) {
                    SocketBindingManager.UnnamedBindingRegistry registry = socketBindingManager.getUnnamedRegistry();
                    if (bindAddress != null) {
                        final InetSocketAddress boundAddress = serverManagement.getLocalAddress(InetSocketAddress.class);
                        basicManagedBinding = ManagedBinding.Factory.createSimpleManagedBinding("management-http", boundAddress, null);
                        registry.registerBinding(basicManagedBinding);
                    }
                    if (secureBindAddress != null) {
                        final InetSocketAddress boundAddress = serverManagement.getSecureLocalAddress(InetSocketAddress.class);
                        secureManagedBinding = ManagedBinding.Factory.createSimpleManagedBinding("management-https", boundAddress, null);
                        registry.registerBinding(secureManagedBinding);
                    }
                } else {
                    SocketBindingManager.NamedManagedBindingRegistry registry = socketBindingManager.getNamedRegistry();
                    if (basicBinding != null) {
                        final InetSocketAddress boundAddress = serverManagement.getLocalAddress(InetSocketAddress.class);
                        basicManagedBinding = ManagedBinding.Factory.createSimpleManagedBinding(basicBinding.getName(), boundAddress, null);
                        registry.registerBinding(basicManagedBinding);
                    }
                    if (secureBinding != null) {
                        final InetSocketAddress boundAddress = serverManagement.getSecureLocalAddress(InetSocketAddress.class);
                        secureManagedBinding = ManagedBinding.Factory.createSimpleManagedBinding(secureBinding.getName(), boundAddress, null);
                        registry.registerBinding(secureManagedBinding);
                    }
                }
            }
        } catch (Exception e) {
            Throwable cause = e.getCause();
            if (e instanceof BindException || cause instanceof BindException) {
                final StringBuilder sb = new StringBuilder().append(e.getLocalizedMessage());
                if (bindAddress != null)
                    sb.append(" ").append(bindAddress);
                if (secureBindAddress != null)
                    sb.append(" ").append(secureBindAddress);
                throw new StartException(sb.toString());
            } else {
                throw ServerLogger.ROOT_LOGGER.failedToStartHttpManagementService(e);
            }
        }
        httpManagementConsumer.accept(httpManagement);
    }
145738
public synchronized void start(final StartContext context) throws StartException {
        try {
            context.execute(new Runnable() {

                @Override
                public void run() {
                    connectionManagerRegistry.addLdapConnectionManagerService(name, LdapConnectionManagerService.this);
                    context.complete();
                }
            });
        } finally {
            context.asynchronous();
        }
    }
73034
private BundleContext getBundleContext(Bundle bundle, long timeout) {
        long endTime = System.currentTimeMillis() + timeout;
        BundleContext bc = null;
        while (bc == null) {
            bc = bundle.getBundleContext();
            if (bc == null) {
                if (System.currentTimeMillis() >= endTime) {
                    throw new TestContainerException(
                        "Unable to retrieve bundle context from bundle " + bundle);
                }
                try {
                    Thread.sleep(100);
                }
                catch (InterruptedException e) {
                    // Ignore
                }
            }
        }
        return bc;
    }
197386
@Override
    public void start(final StartContext context) throws StartException {
        AbstractKeyManagerService keyManagers = injectedKeyManagers.getOptionalValue();
        TrustManager[] trustManagers = injectedtrustManagers.getOptionalValue();

        try {
            SSLContext sslContext = SSLContext.getInstance(protocol);
            if(keyManagers != null && keyManagers.isLazy()) {
                sslContext = new LazyInitSSLContext(sslContext, injectedKeyManagers, injectedtrustManagers, enabledCipherSuites, enabledProtocols);
            } else {
                sslContext.init(keyManagers != null ? keyManagers.getKeyManagers() : null, trustManagers, null);
                sslContext = wrapSslContext(sslContext, enabledCipherSuites, enabledProtocols);
            }

            this.theSSLContext = sslContext;

        } catch (NoSuchAlgorithmException e) {
            throw DomainManagementLogger.ROOT_LOGGER.unableToStart(e);
        } catch (KeyManagementException e) {
            throw DomainManagementLogger.ROOT_LOGGER.unableToStart(e);
        }
    }