Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        public virtual void  stop(BundleContext bc)
        {
            /*!--------------PART FOR UNGETTING SERVICES--------------*/
            if (refInHausBaseDriver != null)
            {
                /*Ungetting service if the ServiceReference is not null, i.e. the service has been gotten.*/
                bc.ungetService(refInHausBaseDriver);
            }


            /*!--------------END OF PART FOR UNGETTING SERVICES--------------*/
            /*!--------------PART FOR REMOVING SERVICE LISTENERS--------------*/
            /*Removing this class as listener for any ServiceEvents.*/
            bc.removeServiceListener(this);
            /*!--------------END OF PART FOR REMOVING SERVICE LISTENERS--------------*/
            try
            {
                /*!--------------PART FOR UNREGISTERING SERVICE--------------*/
                /*Unregistering the underlying service if the registration is successful, i.e. field "regLamp" is not null.*/
                if (regLamp != null)
                {
                    regLamp.unregister();
                    regLamp = null;
                }
                lamp = null;

                /*!--------------END PART FOR UNREGISTERING SERVICES--------------*/
            }
            catch (System.Exception e)
            {
                /*Logging error via org.osgi.service.log.LogService or com.prosyst.util.ref.Log
                 * and printing the stack trace of the thrown exception.*/
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043"'
                dump("[Lamp]Error in stop method: " + e.Message, e);

                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043"'
                throw new BundleException("[Lamp]Error in stop method: " + e.Message);
            }
        }