Hi Rony,
>> Here is the error message:
>> -----%<-----
>> com.sun.star.deployment.DeploymentException: Fehler beim Hinzufügen von:
>> JudasComponent.und.pkg
>>
> Are you sure it is ".und.pkg" above ('d' instead of 'o' in ".uno.pkg")?
Sorry, the code was OK. This is because I changed the value manually.
The correct name I use is .uno.pkg.
> Not sure why that happens (I *think* this behaviour may have started
> with 2.2, as it used to work flawlessly beforehand).
> [It would be nice if at that point OOo would give a much more meaningful
> error message!]
Interesting. I use 2.2. I would appreciate a more meaningful error
message, too.
>> I think the mediaType is wrong. But what media type should I use to add
>> a complete Extension Package? I tried adding the jar file contained in
>> the package, but I got the same error...
> Hmm, mostlikely the media-type is o.k., eg. cf.
> <http://wiki.services.openoffice.org/wiki/General_UNO_Component_Project_Type>.
> Maybe the "addPackage()" method got changed, such that the last two
> arguments need to be supplied and not be "null"? (Just a wild guess.)
Very good guess. I had to implement com.sun.star.ucb.XCommandEnvironment
-----%<-----
import com.sun.star.deployment.XPackageManager;
import com.sun.star.deployment.XPackageManagerFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
public class UNOPackageManager implements
com.sun.star.ucb.XCommandEnvironment {
public void addPackage() {
// code for adding packages
}
public com.sun.star.ucb.XProgressHandler getProgressHandler()
{
return new ProgressImpl();
}
public com.sun.star.task.XInteractionHandler
getInteractionHandler()
{
return new InteractionImpl();
}
}
class InteractionImpl implements com.sun.star.task.XInteractionHandler {
public void handle (com.sun.star.task.XInteractionRequest xRequest)
{
boolean approve = true;
boolean abort = false;
com.sun.star.task.XInteractionContinuation[] conts =
xRequest.getContinuations();
for (int i = 0; i < conts.length; i++)
{
if (approve)
{
com.sun.star.task.XInteractionApprove xApprove =
(com.sun.star.task.XInteractionApprove)
UnoRuntime.queryInterface
(com.sun.star.task.XInteractionApprove.class,
conts[i]);
if (xApprove != null)
xApprove.select();
//don't query again for ongoing extensions
approve = false;
}
else if (abort)
{
com.sun.star.task.XInteractionAbort xAbort =
(com.sun.star.task.XInteractionAbort)
UnoRuntime.queryInterface
(com.sun.star.task.XInteractionAbort.class,
conts[i]);
if (xAbort != null)
xAbort.select();
//don't query again for ongoing extensions
abort = false;
}
}
}
}
class ProgressImpl implements com.sun.star.ucb.XProgressHandler
{
public void push(Object status)
{
}
public void update(Object status)
{
}
public void pop()
{
}
}
-----%<-----
I found part of this code at koders.com. I hope to have time to create a
snippet in Java for it.
Thanks for your great help!
Greetings, Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]