/* (non-Javadoc)
@see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
548707
@Override
    public void start(BundleContext bc) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "start", bc);
        }
    }
667101
protected void activate(ComponentContext context) throws UnableToAdaptException, MalformedURLException {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "activate", context.getProperties());

        id = (String) context.getProperties().get(Constants.ID);
        rarFilePath = (String) context.getProperties().get(Constants.LOCATION);
        bundleContext = Utils.priv.getBundleContext(context);
        bundle = bundleContext.getBundle();

        // This is here so that the RAR class loader is set before providing it
        // to the bundle service for the RAR below.
        getClassLoader();

        // Provide the classloader identity to the bundle service associated
        // with the RAR so it may complete initialization before the RAR is
        // installed.
        raBundleSvc.setClassLoaderID(rarClassLoaderId);

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "activate");
    }
1054541
public void start() throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "start", this);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(tc, "Start ME, mode defaulting to ME_START_DEFAULT");
        start(JsConstants.ME_START_DEFAULT);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "start");
    }
766213
public static void onStartup(String container, Object containerContext) {
        try {
            startedUp = false;
            logger = LoggerUtil.getStandardLogger();
            containerName = container;

            // use reflection to avoid build-time dependencies
            String pluginPackage = MdwDataSource.class.getPackage().getName() + "." + containerName.toLowerCase();
            String namingProviderClass = pluginPackage + "." + containerName + "Naming";
            namingProvider = Class.forName(namingProviderClass).asSubclass(NamingProvider.class).newInstance();
            logger.info("Naming Provider: " + namingProvider.getClass().getName());

            String ds = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_DATASOURCE_PROVIDER);
            if (ds == null)
                ds = PropertyManager.getProperty("mdw.container.datasource_provider"); // compatibility
            if (StringHelper.isEmpty(ds) || ds.equals(DataSourceProvider.TOMCAT)) {
                dataSourceProvider = new TomcatDataSource();
            } else if (DataSourceProvider.MDW.equals(ds)){
                dataSourceProvider = new MdwDataSource();
            } else {
                String dsProviderClass = pluginPackage + "." + ds + "DataSource";
                dataSourceProvider = Class.forName(dsProviderClass).asSubclass(DataSourceProvider.class).newInstance();
            }
            logger.info("Data Source Provider: " + dataSourceProvider.getClass().getName());

            String jms = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_JMS_PROVIDER);
            if (jms == null)
                jms = PropertyManager.getProperty("mdw.container.jms_provider"); // compatibility
            if (StringHelper.isEmpty(jms))
                jms = JmsProvider.ACTIVEMQ;

            if (JmsProvider.ACTIVEMQ.equals(jms)) {
                if (jmsProvider == null) {
                    // use below to avoid build time dependency
                    jmsProvider = Class.forName("com.centurylink.mdw.container.plugin.activemq.ActiveMqJms").asSubclass(JmsProvider.class).newInstance();
                }
            }
            else {
                String jmsProviderClass = pluginPackage + "." + jms + "Jms";
                jmsProvider = Class.forName(jmsProviderClass).asSubclass(JmsProvider.class).newInstance();
            }

            logger.info("JMS Provider: " + (jmsProvider==null?"none":jmsProvider.getClass().getName()));

            String tp = PropertyManager.getProperty(PropertyNames.MDW_CONTAINER_THREADPOOL_PROVIDER);
            if (tp == null)
                tp = PropertyManager.getProperty("mdw.container.threadpool_provider"); // compatibility
            if (StringHelper.isEmpty(tp) || ThreadPoolProvider.MDW.equals(tp)) {
                threadPoolProvider = new CommonThreadPool();
                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                ObjectName mbeanName = new ObjectName("com.centurylink.mdw.container.plugin:type=CommonThreadPool,name=MDW Thread Pool Info");
                if (!mbs.isRegistered(mbeanName))
                    mbs.registerMBean(threadPoolProvider, mbeanName);
            }
            else {
                String tpProviderClass = pluginPackage + "." + tp + "ThreadPool";
                threadPoolProvider = Class.forName(tpProviderClass).asSubclass(ThreadPoolProvider.class).newInstance();
            }
            logger.info("Thread Pool Provider: " + threadPoolProvider.getClass().getName());

            startedUp = true;
            startupTime = new Date();
        }
        catch (Exception ex) {
            throw new StartupException("Failed to initialize ApplicationContext", ex);
        }
    }
1128405
@Override
    public Object startupService(BundleContext bundleContext)
    {
        service = this.createServiceTracker(context, getHttpContext(), this.getProperties());
        ((HttpServiceTracker)service).open();

        return service;
    }
1001679
@Override
	public final void start() throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        if (started)
	            return;
	        started = true;
	        
	        // Wake up waiting consumers
	        wakeUpLocalConsumers();
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
734933
public void start(BundleContext context) throws Exception
    {
        this.log(context, LogService.LOG_INFO, "Starting and registering the (repository) " + this.getClass().getName() + " ClassService ");
        
        bundleContext = context;

        if (context != null)
            context.registerService(ClassFinder.class.getName(), this, null);	// Should be only one of these
    }
588943
public void start() throws Exception {
        baseFilterFactory = new DefaultFilterFactory(bundleContext, filterClass, priority, applicationName, initParams);
        baseFilterFactory.register();
    }
800949
public Object startupService(BundleContext bundleContext)
    {
        try {
            Environment env = (Environment)this.getService(Env.class);
            // Note the order that I do this... this is because MainApplication may need access to the remoteapp during initialization
            Map<String, Object> properties = getServiceProperties();
            properties = Utility.putAllIfNew(properties, env.getProperties());  // Use the same params as environment
            App app = env.getMessageApplication(true, properties);
//            app.setProperty(DBParams.JMSSERVER, DBConstants.TRUE);
//            app.getMessageManager(true);
            return new RemoteSessionServer(app, null, properties);	// Doesn't create environment
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    	return null;
    }
443290
public synchronized void start(StartContext context) throws StartException {
        Logger.getLogger("org.mobicents.as10").debug(
                "SipConnectorService.start(), protocol = " + protocol + " - scheme = " + scheme);
        final SocketBinding binding = this.binding.getValue();
        final InetSocketAddress address = binding.getSocketAddress();
        final Executor executor = this.executor.getOptionalValue();
        try {

            SipConnector sipConnector = new SipConnector();
            sipConnector.setIpAddress(address.getAddress().getHostAddress());
            sipConnector.setPort(address.getPort());
            // https://github.com/Mobicents/sip-servlets/issues/44 support multiple connectors
            sipConnector.setTransport(binding.getName().substring(binding.getName().lastIndexOf("sip-") + ("sip-".length())));
            sipConnector.setUseLoadBalancer(useLoadBalancer);
            sipConnector.setLoadBalancerAddress(loadBalancerAddress);
            sipConnector.setLoadBalancerRmiPort(loadBalancerRmiPort);
            sipConnector.setLoadBalancerSipPort(loadBalancerSipPort);
            sipConnector.setUseStaticAddress(useStaticAddress);
            sipConnector.setStaticServerAddress(staticServerAddress);
            sipConnector.setStaticServerPort(staticServerPort);
            sipConnector.setUseStun(useStun);
            sipConnector.setStunServerAddress(stunServerAddress);
            sipConnector.setStunServerPort(stunServerPort);
            sipConnector.setHostNames(hostNames);

            Logger.getLogger("org.mobicents.as10").debug(
                    "SipConnectorService.start(), address = " + address.getAddress().getHostAddress() + " - port = "
                            + address.getPort() + " - transport = " + sipConnector.getTransport());
            Logger.getLogger("org.mobicents.as10").debug("SipConnectorService.start(), hostnames = " + hostNames);

            /*
             * FIXME: kakonyii: need an implementation in SipConnector class for the following fields: enableLookups proxyName
             * proxyPort redirectPort secure maxPostSize maxSavePostSize
             */

            SipProtocolHandler sipProtocolHandler = new SipProtocolHandler(sipConnector);

            // TODO set Executor on ProtocolHandler
            // TODO use server socket factory - or integrate with {@code ManagedBinding}

            final SipConnectorListener connector = new SipConnectorListener(sipProtocolHandler);

            connector.init();
            getSipServer().addConnector(connector);
            connector.start();

            this.connector = connector;
        } catch (Exception e) {
            throw new StartException(MESSAGES.connectorStartError(), e);
        }
        // Register the binding after the connector is started
        binding.getSocketBindings().getNamedRegistry().registerBinding(new ConnectorBinding(binding));
        //notify SipServer only when connector has already been added/started
        getSipServer().connectorAdded(connector);        
    }
1023738
public void start() throws ContextClientCodeException {
    synchronized (this.contextStack) {
      LOG.log(Level.FINEST, "Instantiating root context.");
      this.contextStack.push(this.launchContext.get().getRootContext());

      if (this.launchContext.get().getInitialTaskConfiguration().isPresent()) {
        LOG.log(Level.FINEST, "Launching the initial Task");
        try {
          this.contextStack.peek().startTask(this.launchContext.get().getInitialTaskConfiguration().get());
        } catch (final TaskClientCodeException e) {
          this.handleTaskException(e);
        }
      }
    }
  }
1359693
@Override
	public void start(BundleContext context) throws Exception {

		System.out.println("******************************** WebsocketActivator STARTUP **********************************");

		Config config = new Config();
		config.setProperty(GroupProperties.PROP_VERSION_CHECK_ENABLED, "false");
		config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(true);

		hazelcastNode = Hazelcast.newHazelcastInstance(config);
		hazelcastTopic = hazelcastNode.getTopic("cloud");
		hazelcastTopic.addMessageListener(new MessageListener<Object>() {

			public void onMessage(Message<Object> arg0) {
				publishToAll(arg0.getMessageObject().toString());
			}
		});

	}
657727
public void start() throws Exception {
        tracker = new ServiceTracker<ProxyTargetLocatorFactory, ProxyTargetLocatorFactory>(bundleContext,
            ProxyTargetLocatorFactory.class, null);
        tracker.open();
        bundleInjectionProviderHelper =
            new BundleInjectionProviderHelper(bundleContext, applicationName, injectionSource, tracker);
        bundleInjectionProviderHelper.register();
    }
78527
@Override
	public void run() {
		// Flag to avoid checking the very first time, when the request handler
		// has just started.
		boolean firstRun = true;

		while (continuePolling) {
			try {
				// Must check before sleeping, otherwise stopPolling does not
				// work.
				if (!firstRun) {
					if (propertiesSource.configChanged()) {
						Properties props = propertiesSource.getConfigProperties();
						if (overriddenProperties != null) {
							props.putAll(overriddenProperties);
						}
						listener.configChanged(props);
					} else if (bundlesHandler != null && bundlesHandler.bundlesNeedToBeRebuild()) {
						listener.rebuildDirtyBundles();
					}
				}
				sleep(waitMillis);
				firstRun = false;

			} catch (InterruptedException e) {
				// Nothing to do
			} catch (InterruptBundlingProcessException e) {
				if (LOGGER.isInfoEnabled()) {
					LOGGER.info("Bundling processed stopped");
				}
			}
		}
		
		this.bundlesHandler = null;
		this.listener = null;
	}
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);
        }
    }
447232
def start(self):
        
        if self.__framework._state not in (Bundle.STARTING, Bundle.ACTIVE):
            # Framework is not running
            raise BundleException(
                "Framework must be started before its bundles"
            )

        with self._lock:
            if self._state in (Bundle.ACTIVE, Bundle.STARTING):
                # Already started bundle, do nothing
                return

            # Store the bundle current state
            previous_state = self._state

            # Starting...
            self._state = Bundle.STARTING
            self._fire_bundle_event(BundleEvent.STARTING)

            # Call the activator, if any
            starter = self.__get_activator_method("start")
            if starter is not None:
                try:
                    # Call the start method
                    starter(self.__context)
                except (FrameworkException, BundleException):
                    # Restore previous state
                    self._state = previous_state

                    # Re-raise directly Pelix exceptions
                    _logger.exception(
                        "Pelix error raised by %s while starting", self.__name
                    )
                    raise
                except Exception as ex:
                    # Restore previous state
                    self._state = previous_state

                    # Raise the error
                    _logger.exception(
                        "Error raised by %s while starting", self.__name
                    )
                    raise BundleException(ex)

            # Bundle is now active
            self._state = Bundle.ACTIVE
            self._fire_bundle_event(BundleEvent.STARTED)
1149299
public synchronized void start(StartContext context) throws StartException {
        Logger.getLogger("org.mobicents.as7").debug("SipConnectorService.start(), protocol = " + protocol + " - scheme = " + scheme);
        final SocketBinding binding = this.binding.getValue();
        final InetSocketAddress address = binding.getSocketAddress();
        final Executor executor = this.executor.getOptionalValue();
        try {
            // Create connector
            final Connector connector = new Connector(SipProtocolHandler.class.getName());
            connector.setPort(address.getPort());
            connector.setScheme(scheme);
            SipConnector sipConnector = new SipConnector();
            sipConnector.setIpAddress(address.getAddress().getHostAddress());
            sipConnector.setPort(address.getPort());
            // https://github.com/Mobicents/sip-servlets/issues/44 support multiple connectors
            sipConnector.setTransport(binding.getName().substring(binding.getName().lastIndexOf("sip-")+("sip-".length())));
            sipConnector.setUseLoadBalancer(useLoadBalancer);
            sipConnector.setLoadBalancerAddress(loadBalancerAddress);
            sipConnector.setLoadBalancerRmiPort(loadBalancerRmiPort);
            sipConnector.setLoadBalancerSipPort(loadBalancerSipPort);
            sipConnector.setUseStaticAddress(useStaticAddress);
            sipConnector.setStaticServerAddress(staticServerAddress);
            sipConnector.setStaticServerPort(staticServerPort);
            sipConnector.setUseStun(useStun);
            sipConnector.setStunServerAddress(stunServerAddress);
            sipConnector.setStunServerPort(stunServerPort);
            sipConnector.setHostNames(hostNames);
            Logger.getLogger("org.mobicents.as7").debug("SipConnectorService.start(), address = " + address.getAddress().getHostAddress() + " - port = " + address.getPort() + " - transport = " + sipConnector.getTransport());
            Logger.getLogger("org.mobicents.as7").debug("SipConnectorService.start(), hostnames = " + hostNames);
            SipProtocolHandler sipProtocolHandler = (SipProtocolHandler) connector.getProtocolHandler();
            sipProtocolHandler.setSipConnector(sipConnector);
            if (enableLookups != null)
                connector.setEnableLookups(enableLookups);
            if (maxPostSize != null)
                connector.setMaxPostSize(maxPostSize);
            if (maxSavePostSize != null)
                connector.setMaxSavePostSize(maxSavePostSize);
            if (proxyName != null)
                connector.setProxyName(proxyName);
            if (proxyPort != null)
                connector.setProxyPort(proxyPort);
            if (redirectPort != null)
                connector.setRedirectPort(redirectPort);
            if (secure != null)
                connector.setSecure(secure);
            // TODO set Executor on ProtocolHandler
            // TODO use server socket factory - or integrate with {@code ManagedBinding}

            getSipServer().addConnector(connector); 
            
            connector.init();
            connector.start();
            this.connector = connector;
        } catch (Exception e) {
            throw new StartException(MESSAGES.connectorStartError(), e);
        }
        // Register the binding after the connector is started
        binding.getSocketBindings().getNamedRegistry().registerBinding(new ConnectorBinding(binding));
        //notify SipServer only when connector has already been added/started
        getSipServer().connectorAdded(connector);
    }