02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - 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 />

valid license cannot be acquired, then a LicenseException exception is caught by the<br />

<strong>Ocean</strong> Core and the module is not instantiated.<br />

using System;<br />

using Slb.<strong>Ocean</strong>.Core;<br />

namespace Slb.<strong>Ocean</strong>.Demo<br />

{<br />

// Define attribute for license provider<br />

[LicenseProvider(typeof (FooBarLicenseProvider))]<br />

public class MyModule : IModule<br />

{<br />

private License license;<br />

}<br />

}<br />

public Module ()<br />

{<br />

// Acquire the license.<br />

license = LicenseManager.Validate(typeof(MyModule), this);<br />

...<br />

}<br />

...<br />

If the module is not instantiated, then consequently any services it defines are not<br />

available to other modules. Modules that use these services should check the service<br />

reference when acquiring it.<br />

After all modules have been instantiated, the <strong>Ocean</strong> Core will move on to the next phase<br />

in the module lifecycle.<br />

Initialization<br />

The second phase of the module lifecycle is the execution of the Initialize method.<br />

The main purpose of Initialize is registration of the services provided by the module<br />

with the <strong>Ocean</strong> ServiceLocator class. Services may be registered through the <strong>Ocean</strong><br />

Core by their type or by a combination of their type and the data type they are applied to.<br />

3-26 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

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

Saved successfully!

Ooh no, something went wrong!