Server


LXsSRV_USERNAME

The nexus plug-in system maintains a database of the external servers which can be accessed. The servers in the system are referenced by a combination of class and name. A Server Class is a GUID which determines the type of service which the server can perform. This is also the main interface provided by the server. There can be many servers of the same class, including many built-in to the nexus application. A Server Name is a string which refers to a specific server within a given class. This might be something like “FractalNoise3D” or “JPEG”. The name must be unique among the servers of the same class. A server name must be a byte string containing characters only in the ASCII range 33-127. It can contain no spaces and except for built-in servers must start with an alphabetic character. Case is significant unless it is ignored in a specific usage context, such as commands which are looked up in a case-insensitive manner.

Servers also have a set of tagged strings which define their fixed attributes, and which describe the kinds of services they perform within their class. These tags strings are read from the server and are stored in the database for reference while the server is not loaded. There are some tags common to all servers:

  • USERNAME is the name of the server to be presented to the user in the UI. This can be a reference to a message table using “@table@msg@” syntax.

  • LICENSE indicates that the server needs a license in order to function. The license string is the product ID followed by a feature or build number. For example “iblend 12231” or “corel_X 300”. Feature numbers should always be multiple digits for security. The string can also optionally contain a date for maintainance licenses, of the form “d:YYYY.MMDD”. Example: “product 99999 d:2015.0130”.

  • OWNER, SERIAL are set to the name of the license holder and the serial number for the license, for plug-ins that require licenses. The plug-in can read these values by looking up itself in the host service.

  • LXsSRV_LICENSE

  • LXsSRV_OWNER

  • LXsSRV_SERIAL

ILxFactory

class ILxFactory

An ILxFactory is an internal nexus object that can create servers of a specific type. Internally it has a handle to a plug-in module which will be loaded as needed.

Public Functions

LxResult Name(LXtObjectID self, const char **name)

Accessors for the server’s name, username and class.

LxResult UserName(LXtObjectID self, const char **userName)
LxResult ClassGUID(LXtObjectID self, LXtGUID *guid)
LxResult Module(LXtObjectID self, const char **module)

Get the module the server is in, or NULL if this is a built-in server.

LxResult InfoTag(LXtObjectID self, const char *type, const char **value)

This allow reading the tags for a factory. These do not need to be implemented by extension factories since the tags are read from the server instance.

LxResult TagCount(LXtObjectID self, unsigned int *count)
LxResult TagByIndex(LXtObjectID self, unsigned int index, const char **type, const char **value)
LxResult Spawn(LXtObjectID self, void **ppvObj)

Aditionally, servers can be spawned using these functions. The COM interface returned needs to be released by the caller using Release(), as usual.

bool New(CLxLocalizedObject &loc)

User Class Only:

ILxHostService

class ILxHostService

This provides access to the list of factories. For convenience these methods all take the class GUID as a string, which is how they are defined in the API.

Public Functions

LxResult ScriptQuery(LXtObjectID self, void **ppvObj)

As with all globals, the first method gets the ILxScriptQueryID interface for the system.

LxResult LookupServer(LXtObjectID self, const char *className, const char *name, unsigned allowLoad, void **ppvObj)

This method can be used to lookup a factory it’s class and server name. If allowLoad is true it will prompt the user to find a module if the server is not known. The factory must be released when no longer needed.

LxResult TestServer(LXtObjectID self, const char *className, const char *name)

This simply tests to see if a server exists, and skips the error reporting.

unsigned NumServers(LXtObjectID self, const char *className)

These methods allow the server database to be scanned. These first two allow the server list to walked by class. The factory returned must be released when no longer needed.

LxResult ServerByIndex(LXtObjectID self, const char *className, unsigned index, void **ppvObj)
LxResult ServerGetIndex(LXtObjectID self, const char *className, const char *name, unsigned *index)

Servers can also be looked up by name to get their index.

LxResult AddServer(LXtObjectID self, LXtObjectID factory)

Application hosts can add servers as factories. This should not be done by plug-ins becuase they can add servers through the module method.

LxResult DefaultPath(LXtObjectID self, const char **path)

This returns the path to the plug-in directory.

LxResult SpawnForTagsOnly(LXtObjectID self)

We can also query things specific to our module. This return LXe_TRUE if the server is being spawned only to read tags.

LxResult UpdateModule(LXtObjectID self, const char *name)

Dynamic modules can update - well, dynamically. Calling this method will force the server database to update the contents of the dynamic module.

LxResult SaverVerify(LXtObjectID self, const char *format, LXtObjectID object, LXtObjectID msg)

Saver verification can be triggered directly for a given format and data object.

LxResult SaverSave(LXtObjectID self, const char *filename, const char *format, LXtObjectID object, LXtObjectID monitor)

This will perform a save using the filename, format and data object. The monitor is optional.

bool Lookup(CLxLoc_Factory &fac, const char *className, const char *name, bool allowLoad = true)

User Class Only: The C++ service has methods to get a factory directly into a user object.

bool ByIndex(CLxLoc_Factory &fac, const char *className, unsigned int index)

ILxModule

class ILxModule

Public Functions

LxResult Generate(LXtObjectID self, const char *name, const LXtGUID *iid, void **ppvObj)

Plug-in modules are loaded like any file, using an ILxLoader. The load is opaque, and the object type loaded is “module”. An ILxModule is a special type of factory capable of spawning servers of different classes which are the servers implemented by the module.

  • Generate creates a new server instance given the class GUID and server name.

  • GetTags optional method returns a StringTag interface for a server based on the name and class ID. Allows tags to be read without creating a server inst.

LxResult GetTags(LXtObjectID self, const char *name, const LXtGUID *iid, void **ppvObj)

LXtTagInfoDesc

struct st_LXtTagInfoDesc

Modules are servers are self-describing by presenting a Tag Description interface. For a module the tags of “server” type give the name (as info) and the interface type (as GUID) for the servers in the module, and is used by the nexus to determine which servers are exported by an unknown module. For servers the tags can define various properties, including the user name.

Public Members

const char *type
const char *info
const LXtGUID *guid

ILxTagDescription

class ILxTagDescription

Public Functions

unsigned Count(LXtObjectID self)

The Count() function returns the number of info tags for the object, and the Describe() method fills in the info for a given tag index.

LxResult Describe(LXtObjectID self, unsigned index, LXtTagInfoDesc *desc)
  • LXsMOD_SERVER

ILxNeedContext

class ILxNeedContext

Public Functions

LxResult SetContext(LXtObjectID self, LXtObjectID app)

The “need context” interface can be defined by any module or server that wants to be informed about the application context when it’s first created. The application passed to the SetContext() method can be queried for globals, and is owned by the client and needs to be released. Note: this conflicts with the COM standard, so you cannot “set” this argument, you must “take” it.

ILxServiceExtension

class ILxServiceExtension

Public Functions

void Dummy(LXtObjectID self)

Global services can be extended by plug-ins. The extension interface itself is just a handle that lets lets us allocate a server object, which is then queried for the real service interface.

  • LXsSRVEXT_GUID

ILxModule1

class ILxModule1

Public Functions

LxResult Generate(LXtObjectID self, const char *name, const LXtGUID *iid, void **ppvObj)

Legacy Module1 interface, which is exported by all the pre-701 plug-ins. We declare it here, add a translator, and convert from one to the other.

unsigned IsLocked(LXtObjectID self)