02.05.2014 Views

Ocean* Application Development Framework - Ocean - Schlumberger

Ocean* Application Development Framework - Ocean - Schlumberger

Ocean* Application Development Framework - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The <strong>Ocean</strong> Module<br />

// create a ModuleTrust from the namespace, type, assembly string<br />

ModuleTrust mt = new ModuleTrust(moduleTrustName);<br />

// add the ModuleTrust to the known trust<br />

CoreSystem.Modules.AddModuleTrust(mt);<br />

// add the modules in the collection to the known modules<br />

CoreSystem.AddModules(col, moduleTrustName);<br />

}<br />

}<br />

Private void CoreSystemStateChanged(object sender,<br />

SystemStateEventArgs e)<br />

{<br />

// Make sure we’re beyond IntegratePresentation.<br />

if (e.State.Equals(SystemState.Running))<br />

{<br />

// we assume we’ve added a moduletrust for our purposes<br />

// earlier, perhaps in the configuration file<br />

string demoTrustName = "DemoModuleTrust";<br />

// create a collection to hold the module<br />

ModuleReferenceCollection col = new ModuleReferenceCollection();<br />

// add our module to the collection using the assembly<br />

// qualified typename<br />

string moduleName = "Demo.MyModule, MyModuleAssembly";<br />

col.AddModule(moduleName);<br />

// add the modules in the collection to the known modules,<br />

// and place them in the moduletrust named “DemoModuleTrust”<br />

CoreSystem.AddModules(col, demoTrustName);<br />

}<br />

}<br />

Module Trust<br />

The ModuleManager class also manages module trusts. A module trust represents<br />

the trust level held by a group of assemblies. When assemblies are loaded into the<br />

<strong>Ocean</strong> Core through a system factory implementation, or through the<br />

CoreSystem.AddModules method, they will be associated with a<br />

ModuleTrust object.<br />

A ModuleTrust can be strong by associating with a public key or weak by not<br />

associating with a key. A strong ModuleTrust will cause assembly loading to fail<br />

for assemblies that are not signed with the key specified by the ModuleTrust.<br />

You find all module trusts through the ModuleTrust property, or you can a specific<br />

module trust using its name as a string and the GetModuleTrust method.<br />

Additionally you can find the module trust that contains a specific module and all the<br />

modules loaded to a specific module trust.<br />

3-32 <strong>Ocean</strong> <strong>Application</strong> <strong>Development</strong> <strong>Framework</strong> 2009.1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!