Re: Dynamic Services?
Re: Dynamic Services?
- Subject: Re: Dynamic Services?
- From: Ondra Cada <email@hidden>
- Date: Tue, 28 Aug 2001 15:40:27 +0200
Evan,
>
>>>>> Evan Gross (EG) wrote at Tue, 28 Aug 2001 05:34:57 -0400:
EG> I've seen some scattered references to "Dynamic Services", but haven't
EG> been able to gather much information on a) just what *exactly* they are
EG> and what they can do (anything a "regular" service can do? Or limited?)
EG> or how they are implemented.
Well, I should prepend a warning that the following info is a NeXTStep one
-- I don't know whether the functionality made it to OSX or not. Eg. the fact
that Terminal does not support the absolutely *GREAT* terminal services
anymore might indicate there are some problems.
Well, to business:
Normally, Services are published through some easily-externally-readable
format (an extra file originally, the Info plist now), so as the operating
system can get the information for all applications, show the service list
for them, and run the appropriate application on-demand, when the service is
needed. I guess you understand this part quite well.
So as to create more services dynamically:
First, there still needs to be an "Info plist" *somewhere* -- so as the
dynamically added service is found (and therefore available) after logout.
The appropriate place for such services is a <something>.service bundle in
~/Library/Services (or perhaps /Local/Library/Services, if it works in OSX at
all). Such bundles are scanned on login automatically just like
applications, and all the services defined there are added to the service
list. Unlike the application bundle, this folder is always writable.
Note that the actual service provider is not limited to the executable which
is placed in the same bundle where the Info plist is; any path can be used
for the NSExecutable key. Thus, you can have any number of .service bundles
containing any number of service items, all serviced by one common
application.
When you change the services list (anywhere), you can force the system to
rescan services immediately either by using a CLI tool make_services, or an
AppKit function "NSUpdateDynamicServices".
So, the dynamic service provider's pattern is simple:
- make/update some appropriate Xxxx.services bundle contents in
.../Library/Services;
- call NSUpdateDynamicServices()
That's all.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc