Ejemplo n.º 1
0
 //////////////////////////////////////////////////////////////////////////
 public CBundleContext(CBundle bundle, CSystemBundle systemBundle)
 {
     m_checker = new StaleReferenceChecker(onStaleRefAccess);
     m_bundle = bundle;
     m_systemBundle = systemBundle;
     m_publishedServices = new List<CServiceRegistration>();
     m_frameworkListeners = new List<IFrameworkListener>();
     m_bundleListeners = new List<IBundleListener>();
     m_serviceListeners = new List<IServiceListener>();
 }
Ejemplo n.º 2
0
        //////////////////////////////////////////////////////////////////////////

        public CBundleContext(CBundle bundle, CSystemBundle systemBundle)
        {
            m_checker            = new StaleReferenceChecker(onStaleRefAccess);
            m_bundle             = bundle;
            m_systemBundle       = systemBundle;
            m_publishedServices  = new List <CServiceRegistration>();
            m_frameworkListeners = new List <IFrameworkListener>();
            m_bundleListeners    = new List <IBundleListener>();
            m_serviceListeners   = new List <IServiceListener>();
        }
        //////////////////////////////////////////////////////////////////////////

        public CBundle InstallBundle(string location, System.IO.Stream input)
        {
            /*
             * 1.If a bundle containing the same location identifier is already installed, the Bundle object for that bundle is returned.
             * 2.The bundle's content is read from the input stream. If this fails, a BundleException is thrown.
             * 3.The bundle's associated resources are allocated. The associated resources minimally consist
             * of a unique identifier and a persistent storage area if the platform has file system support.
             * If this step fails, a BundleException is thrown.
             * 4.The bundle's state is set to INSTALLED.
             * 5.A bundle event of type BundleEvent.INSTALLED is fired.
             * 6.The Bundle object for the newly or previously installed bundle is returned.
             */
            lock (m_lock)
            {
                if (input != null)
                {
                    throw new NotImplementedException();
                }

                CBundle bndl = getBundle(location);
                if (bndl != null)
                {
                    return(bndl);
                }

                CManifest manifest = new CManifest();
                manifest.SymbolicName = "<symbolic_name>";
                manifest.Version      = new Version(6, 6, 6, 6);
                manifest.AssemblyPath = Path.Combine(m_systemBundle.getConfig().BundleRegistryPath, location);
                manifest.AssemblyPath = Path.Combine(manifest.AssemblyPath, location + ".dll");

                bndl = new CBundle(m_firstFreeID++, location, manifest, DateTime.Now, m_systemBundle);
                m_bundlesByID.Add(bndl.getBundleId(), bndl);
                m_bundlesByLocation.Add(bndl.getLocation(), bndl);

                m_systemBundle.RaiseBundleEvent(new BundleEvent(BundleEvent.Type.INSTALLED, bndl));
                return(bndl);
            }
        }
        //////////////////////////////////////////////////////////////////////////

        public Assembly LoadBundleAssembly(CBundle bndl)
        {
            string assembly = bndl.getManifest().AssemblyPath;

            return(Assembly.LoadFrom(assembly));
        }
Ejemplo n.º 5
0
        //////////////////////////////////////////////////////////////////////////
        public CBundle InstallBundle(string location, System.IO.Stream input)
        {
            /*
            1.If a bundle containing the same location identifier is already installed, the Bundle object for that bundle is returned.
            2.The bundle's content is read from the input stream. If this fails, a BundleException is thrown.
            3.The bundle's associated resources are allocated. The associated resources minimally consist
             * of a unique identifier and a persistent storage area if the platform has file system support.
             * If this step fails, a BundleException is thrown.
            4.The bundle's state is set to INSTALLED.
            5.A bundle event of type BundleEvent.INSTALLED is fired.
            6.The Bundle object for the newly or previously installed bundle is returned.
            */
            lock (m_lock)
            {
                if (input != null)
                    throw new NotImplementedException();

                CBundle bndl = getBundle(location);
                if (bndl != null)
                    return bndl;

                CManifest manifest = new CManifest();
                manifest.SymbolicName = "<symbolic_name>";
                manifest.Version = new Version(6, 6, 6, 6);
                manifest.AssemblyPath = Path.Combine(m_systemBundle.getConfig().BundleRegistryPath, location);
                manifest.AssemblyPath = Path.Combine(manifest.AssemblyPath, location + ".dll");

                bndl = new CBundle(m_firstFreeID++, location, manifest, DateTime.Now, m_systemBundle);
                m_bundlesByID.Add(bndl.getBundleId(), bndl);
                m_bundlesByLocation.Add(bndl.getLocation(), bndl);

                m_systemBundle.RaiseBundleEvent(new BundleEvent(BundleEvent.Type.INSTALLED, bndl));
                return bndl;
            }
        }
Ejemplo n.º 6
0
 //////////////////////////////////////////////////////////////////////////
 public Assembly LoadBundleAssembly(CBundle bndl)
 {
     string assembly = bndl.getManifest().AssemblyPath;
     return Assembly.LoadFrom(assembly);
 }