Tobias Krais wrote:
> long time ago I had the question whether it is possible to register a
> UNO package via Java. I wanted to ask, whether something has changed and
> it is possible now?
>
Yes, it should.
Unfortunately, I do not have a Java example but an ooRexx example, which
might nevertheless help, as it exercises the Java interface to OOo. The
syntax is like pseudo-code, the "~" (tilde) the message operator (left
of it the receiving object, right of it the name of the message). In the
case of querying an interface it is sufficient to send the service
object the unqualified name of the interface (the rest will be done
"behind the curtain" by an ooRexx module).
Here are a few snippets which should allow you to grasp the names of the
UNO services and interfaces to use:
--- cut-outs ---
/* initialize connection to server, get XContext */
xContext = UNO.connect() -- connect to server and retrieve the XContext
interface
... get the singleton
/* get the pre-registered package manager factory singleton object */
pmName="/singletons/com.sun.star.deployment.thePackageManagerFactory"
xpmf=xContext~getValueByName(pmName)~XPackageManagerFactory
xpm=xpmf~getPackageManager("shared") -- alternative "user"
... define package related values
packageName = "ScriptProviderForooRexx.jar"
mediaType = "application/vnd.sun.star.uno-component;type=Java"
tmpName = stream(packageName, "C", "QUERY EXISTS") -- get fully
qualified filename
urlName = ConvertToUrl(tmpName) -- turn into ucp compliant URL
... add package
xpm~addPackage(urlName, mediaType, .nil, .nil) -- add package
... get package, if it exists
xpm~getDeployedPackage(packageName, .nil)
... to remove a package:
xpm~removePackage(packageName, .nil, .nil)
--- cut-outs ---
This should get you at least started. Please consult the IDL
documentation, it has been a while since I ran that code (have replaced
it whith invoking "unopkg" at the moment). ".nil" in ooRexx is the same
as "null" in Java.
Hope that helps,
---rony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]