Class MetadataManagerFactory

This factory is used to create the MetadataManagerInterface.

The MetadataManagerInterface is the central point to connect to a 3djuump infinite build.

Connecting to a 3djuump infinite build involves :

At any time, the MetadataManagerInterface can only be connected to a single DirectorySessionInterface, DataSessionInterface and InfiniteEngineInterface, but the same MetadataManagerInterface may be used to connect to a new DataSessionInterface after the preceding has been closed.

/** 
* Sample to illustrate the popup based authentication mechanism.
*/
import {
InfiniteFactory, MetadataManagerFactory, InfiniteCacheFactory, DirectorySessionFactory,
InfiniteEngineInterface, MetadataManagerInterface, InfiniteCacheInterface, DirectorySessionInterface,
InfiniteEvent, ConnectionData,
DataSessionInterfaceSignal, DirectorySessionInterfaceSignal,
} from 'generated/documentation/appinfiniteapi';

// authentication url as defined in the directory
// authenticate.html must include your authentication script
const sAuthenticationUrl : string = 'https://your_server/your_application/authenticate.html';
const sDirectoryUrl : string = 'https://my_directory:443/directory';

// Create a metadata manager interface
// the MetadataManagerInterface is the central point of your application
// It handles the creation of sets of geometries, search functions etc...
const lMetadataManager: MetadataManagerInterface = MetadataManagerFactory.CreateMetadataManager();

// Create a 3D engine to handle the rendering of the DMU. The engine is optional if you
// just want to search data in the DMU, but required to display 3D data.
// you need to provide a div inside your html file, or create one div programmatically
const lInfiniteEngine: InfiniteEngineInterface = InfiniteFactory.CreateInfiniteEngine(lMetadataManager);
// bind the engine to the given div that will be used for rendering
lInfiniteEngine.setView(<HTMLElement>document.getElementById('rendering'));
// Create a cache to avoid requesting heavy data from the server if data has been retrieved already
const lCache: InfiniteCacheInterface = InfiniteCacheFactory.CreateInfiniteCache();

// what to do to authenticate (authenticate function may be bound to a div `click` or called straight away)
let authenticate : () => void = undefined;

// Success callback on login
let onLoginSuccess : (pEvent: InfiniteEvent, _pCallbackData: Object | undefined) => void = undefined;

// Success callback when DataSession is ready
let onDMULoaded : (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) => void = undefined;

// *****************************************************************************
// ******************************* Authentication ******************************
// *****************************************************************************
// what to do to authenticate (authenticate function may be bound to a div `click` or called straight away)
authenticate = () : void =>
{
// connect to directory with address sDirectoryAddress, in the folder "/directory" through https. The default port is unchanged (443)
// bind the session to the MetadataManagerInterface
const lDirectorySession: DirectorySessionInterface = DirectorySessionFactory.CreateDirectorySession(lMetadataManager, sDirectoryUrl);

// do something when we are connected !!!! => onLoginSuccess
lDirectorySession.addEventListener(DirectorySessionInterfaceSignal.LoginSuccess, onLoginSuccess);

// retrieve the url to contact to begin authentication with popup
// that also starts the authentication procedure
const sURL = lDirectorySession.getPopupBasedAuthenticationUrl(sAuthenticationUrl);
if (typeof sURL === 'string') {
if (sURL !== '' && sURL.indexOf('authenticate') >= 0)
{
// popup based authentication
window.open(sURL);
}
}
}

// Success callback on login
onLoginSuccess = (pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
// Get the Connection Data to get the build lists
const lConnectionData: ConnectionData = <ConnectionData>pEvent.attachments;

// Get the list of projects => do something as you like
const lProjectList = lConnectionData.projects;
for (const lProjectId in lProjectList)
{
// iterate but get the first project
const lBuildList = lProjectList[lProjectId].builds;
for (const lBuild in lBuildList)
{
// iterate but get the first build
// create a datasession that uses the cache with the first item
const lDataSession = (<DirectorySessionInterface>(pEvent.emitter)).createDataSession(lBuild, lCache);
if (lDataSession)
{
// be ready to do something when build is ready (i.e. all init data has been parsed and server is ready)
lDataSession.addEventListener(DataSessionInterfaceSignal.DMULoadingSuccess, onDMULoaded);
// and go !!! => open the data session
lDataSession.openDataSession();
}
return;
}
}
};

// Success callback when DataSession is ready
onDMULoaded = (_pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
// do something !!!
// create filters
// change visibility
// etc ....
}

authenticate();

Please refer to Authentication Samples.
Factories

See

MetadataManagerInterface

Hierarchy

  • MetadataManagerFactory

Constructors

Methods

Constructors

Methods