Hi,

I'm trying to read the manifest.xml content into a zipped package using the 
UniversalContentBroker service, but without any success.

When I execute the "open" command I get the following error:
Type: com.sun.star.ucb.InteractiveAugmentedIOException
Message: "Got no data stream!"
What am I doing worng?
(See my testing code below)

Thanks for any help
Paolo M


--------------------------------------------------
REM  *****  BASIC  *****

Sub ReadManifestTest

        oSM = GetProcessServiceManager()
        oUCB = oSM.createInstanceWithArguments( _
                "com.sun.star.ucb.UniversalContentBroker", 
Array("Local","Office"))
                
        sUrl = "file:///home/paolo/Library1.uno.pkg"
        
        'This one DOES NOT WORK!
        sUrl = _
        "vnd.sun.star.pkg://" & Join(Split(sUrl, "/"), "%2F") 
& "/META-INF/manifest.xml"

'       sUrl = "file:///home/paolo/manifest.xml" '<-- This WORKS!

        oID = oUCB.createContentIdentifier(sUrl)
        oProvider = oUCB.queryContentProvider(sUrl)
        oContent = oProvider.queryContent(oID)
        
        oPropSet = UcbExecuteCommand(oContent, "getPropertySetInfo", Null)
        oResult = UcbExecuteCommand(oContent, "getPropertyValues", 
oPropSet.getProperties())
        print oResult.getString(1) ' OK! "application/vnd.sun.star.pkg-stream

        Dim aArg As New com.sun.star.ucb.OpenCommandArgument2
        aArg.Mode = com.sun.star.ucb.OpenMode.DOCUMENT
        aArg.Priority = 32768
        
        oMySinc = CreateUnoService("com.sun.star.io.DataInputStream")
        aArg.Sink = oMySinc
        
        aRes = UcbExecuteCommand(oContent, "open", aArg) '**** ERROR HERE
        
        oReader = 
CreateUnoService("com.sun.star.packages.manifest.ManifestReader")
        mManifestProps() = oReader.readManifestSequence(oMySinc)

End Sub


Function UcbExecuteCommand(oContent As Object, _
        sCommandName As String, aArgument As Variant) As Variant

        ' Assemble command to execute.
        Dim aCommand As New com.sun.star.ucb.Command
        aCommand.Name = sCommandName
    aCommand.Handle = -1 ' not available
    aCommand.Argument = aArgument
 
    ' Note: throws CommandAbortedException and Exception since
    ' we pass null for the XCommandEnvironment parameter
    UcbExecuteCommand = oContent.execute(aCommand, 0, Null)
    
End Function

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to