1 package complex
.ofopxmlstorages
;
3 import com
.sun
.star
.uno
.UnoRuntime
;
4 import com
.sun
.star
.uno
.XInterface
;
5 import com
.sun
.star
.uno
.AnyConverter
;
7 import com
.sun
.star
.lang
.*;
8 import com
.sun
.star
.embed
.*;
9 import com
.sun
.star
.packages
.*;
10 import com
.sun
.star
.io
.*;
11 import com
.sun
.star
.beans
.*;
13 import share
.LogWriter
;
15 public class TestHelper
{
17 LogWriter m_aLogWriter
;
20 public TestHelper( LogWriter aLogWriter
, String sTestPrefix
)
22 m_aLogWriter
= aLogWriter
;
23 m_sTestPrefix
= sTestPrefix
;
26 public boolean WriteBytesToStream( XStream xStream
,
31 StringPair
[][] aRelations
)
33 // get output stream of substream
34 XOutputStream xOutput
= xStream
.getOutputStream();
35 if ( xOutput
== null )
37 Error( "Can't get XOutputStream implementation from substream '" + sStreamName
+ "'!" );
41 // get XTrucate implementation from output stream
42 XTruncate xTruncate
= (XTruncate
) UnoRuntime
.queryInterface( XTruncate
.class, xOutput
);
43 if ( xTruncate
== null )
45 Error( "Can't get XTruncate implementation from substream '" + sStreamName
+ "'!" );
49 // write requested byte sequence
53 xOutput
.writeBytes( pBytes
);
57 Error( "Can't write to stream '" + sStreamName
+ "', exception: " + e
);
61 // get access to the XPropertySet interface
62 XPropertySet xPropSet
= (XPropertySet
) UnoRuntime
.queryInterface( XPropertySet
.class, xStream
);
63 if ( xPropSet
== null )
65 Error( "Can't get XPropertySet implementation from substream '" + sStreamName
+ "'!" );
69 // set properties to the stream
72 xPropSet
.setPropertyValue( "MediaType", sMediaType
);
73 xPropSet
.setPropertyValue( "Compressed", new Boolean( bCompressed
) );
77 Error( "Can't set properties to substream '" + sStreamName
+ "', exception: " + e
);
81 // check size property of the stream
84 int nSize
= AnyConverter
.toInt( xPropSet
.getPropertyValue( "Size" ) );
85 if ( nSize
!= pBytes
.length
)
87 Error( "The 'Size' property of substream '" + sStreamName
+ "' contains wrong value!" );
93 Error( "Can't get 'Size' property from substream '" + sStreamName
+ "', exception: " + e
);
97 // get access to the relationship information
98 XRelationshipAccess xRelAccess
= (XRelationshipAccess
) UnoRuntime
.queryInterface( XRelationshipAccess
.class, xStream
);
99 if ( xRelAccess
== null )
101 Error( "Can't get XRelationshipAccess implementation from substream '" + sStreamName
+ "'!" );
105 // set the relationship information
108 xRelAccess
.insertRelationships( aRelations
, false );
112 Error( "Can't set relationships to substream '" + sStreamName
+ "', exception: " + e
);
116 // free the stream resources, garbage collector may remove the object too late
117 if ( !disposeStream( xStream
, sStreamName
) )
123 public boolean WriteBytesToSubstream( XStorage xStorage
,
128 StringPair
[][] aRelations
)
130 // open substream element
131 XStream xSubStream
= null;
134 Object oSubStream
= xStorage
.openStreamElement( sStreamName
, ElementModes
.WRITE
);
135 xSubStream
= (XStream
) UnoRuntime
.queryInterface( XStream
.class, oSubStream
);
136 if ( xSubStream
== null )
138 Error( "Can't create substream '" + sStreamName
+ "'!" );
144 Error( "Can't create substream '" + sStreamName
+ "', exception : " + e
+ "!" );
148 return WriteBytesToStream( xSubStream
, sStreamName
, sMediaType
, bCompressed
, pBytes
, aRelations
);
151 public boolean setStorageTypeAndCheckProps( XStorage xStorage
,
154 StringPair
[][] aRelations
)
158 // get access to the XPropertySet interface
159 XPropertySet xPropSet
= (XPropertySet
) UnoRuntime
.queryInterface( XPropertySet
.class, xStorage
);
160 if ( xPropSet
!= null )
164 // get "IsRoot" and "OpenMode" properties and control there values
165 boolean bPropIsRoot
= AnyConverter
.toBoolean( xPropSet
.getPropertyValue( "IsRoot" ) );
166 int nPropMode
= AnyConverter
.toInt( xPropSet
.getPropertyValue( "OpenMode" ) );
169 if ( bPropIsRoot
!= bIsRoot
)
171 Error( "'IsRoot' property contains wrong value!" );
176 && ( nPropMode
| ElementModes
.READ
) != ( nMode
| ElementModes
.READ
) )
177 || ( !bIsRoot
&& ( nPropMode
& nMode
) != nMode
) )
179 Error( "'OpenMode' property contains wrong value, expected " + nMode
+ ", in reality " + nPropMode
+ "!" );
185 Error( "Can't control properties of substorage, exception: " + e
);
190 Error( "Can't get XPropertySet implementation from storage!" );
193 // get access to the relationship information
194 XRelationshipAccess xRelAccess
= (XRelationshipAccess
) UnoRuntime
.queryInterface( XRelationshipAccess
.class, xStorage
);
196 if ( xRelAccess
== null )
198 Error( "Can't get XRelationshipAccess implementation from the storage!" );
202 // set the relationship information
205 xRelAccess
.insertRelationships( aRelations
, false );
209 Error( "Can't set relationships to the storage, exception: " + e
);
217 public boolean checkRelations( StringPair
[][] aStorRels
, StringPair
[][] aTestRels
)
219 // Message( "StorageRels:" );
220 // PrintRelations( aStorRels );
221 // Message( "TestRels:" );
222 // PrintRelations( aTestRels );
224 if ( aStorRels
.length
!= aTestRels
.length
)
226 Error( "The provided relations sequence has different size than the storage's one!" );
230 for ( int nStorInd
= 0; nStorInd
< aStorRels
.length
; nStorInd
++ )
233 for ( int nStorTagInd
= 0; nStorTagInd
< aStorRels
[nStorInd
].length
; nStorTagInd
++ )
235 if ( aStorRels
[nStorInd
][nStorTagInd
].First
.equals( "Id" ) )
237 nStorIDInd
= nStorTagInd
;
242 if ( nStorIDInd
== -1 )
244 Error( "One of the storage relations entries has no ID!" );
248 for ( int nInd
= 0; nInd
< aTestRels
.length
; nInd
++ )
251 for ( int nTagInd
= 0; nTagInd
< aTestRels
[nInd
].length
; nTagInd
++ )
253 if ( aTestRels
[nInd
][nTagInd
].First
.equals( "Id" ) )
262 Error( "One of the test hardcoded entries has no ID, num = " + nInd
+ ", length = " + aTestRels
[nInd
].length
+ ", global length = " + aTestRels
.length
+ "!" );
266 if ( aStorRels
[nStorInd
][nStorIDInd
].Second
.equals( aTestRels
[nInd
][nIDInd
].Second
) )
268 boolean[] pRelCheckMark
= new boolean[ aTestRels
[nInd
].length
];
269 for ( int nCheckInd
= 0; nCheckInd
< pRelCheckMark
.length
; nCheckInd
++ )
271 pRelCheckMark
[nCheckInd
] = false;
274 for ( int nStorTagInd
= 0; nStorTagInd
< aStorRels
[nStorInd
].length
; nStorTagInd
++ )
276 boolean bFound
= false;
277 for ( int nTagInd
= 0; nTagInd
< aTestRels
[nInd
].length
; nTagInd
++ )
279 if ( aTestRels
[nInd
][nTagInd
].First
.equals( aStorRels
[nStorInd
][nStorTagInd
].First
) )
281 if ( !aTestRels
[nInd
][nTagInd
].Second
.equals( aStorRels
[nStorInd
][nStorTagInd
].Second
) )
283 Error( "Test rel. num. " + nInd
+ " has different tag \"" + aTestRels
[nInd
][nTagInd
].First
+ "\" value!" );
288 pRelCheckMark
[nTagInd
] = true;
295 Error( "Stor rel. num. " + nStorInd
+ " has unexpected tag \"" + aStorRels
[nStorInd
][nStorTagInd
].First
+ "\", ID = \"" + aStorRels
[nStorInd
][nStorIDInd
].Second
+ "\"!" );
300 for ( int nCheckInd
= 0; nCheckInd
< pRelCheckMark
.length
; nCheckInd
++ )
302 if ( !pRelCheckMark
[nCheckInd
] && !aTestRels
[nInd
][nCheckInd
].Second
.equals( "" ) )
304 Error( "Test rel. num. " + nInd
+ " has unexpected tag \"" + aTestRels
[nInd
][nCheckInd
].First
+ "\" with nonempty value!" );
317 public boolean checkStorageProperties( XStorage xStorage
,
320 StringPair
[][] aRelations
)
324 // get access to the XPropertySet interface
325 XPropertySet xPropSet
= (XPropertySet
) UnoRuntime
.queryInterface( XPropertySet
.class, xStorage
);
326 if ( xPropSet
!= null )
330 // get "IsRoot" and "OpenMode" properties and control there values
331 boolean bPropIsRoot
= AnyConverter
.toBoolean( xPropSet
.getPropertyValue( "IsRoot" ) );
332 int nPropMode
= AnyConverter
.toInt( xPropSet
.getPropertyValue( "OpenMode" ) );
335 if ( bPropIsRoot
!= bIsRoot
)
337 Error( "'IsRoot' property contains wrong value!" );
342 && ( nPropMode
| ElementModes
.READ
) != ( nMode
| ElementModes
.READ
) )
343 || ( !bIsRoot
&& ( nPropMode
& nMode
) != nMode
) )
345 Error( "'OpenMode' property contains wrong value, expected " + nMode
+ ", in reality " + nPropMode
+ "!" );
351 Error( "Can't get properties of substorage, exception: " + e
);
356 Error( "Can't get XPropertySet implementation from storage!" );
359 // get access to the relationship information
360 XRelationshipAccess xRelAccess
= (XRelationshipAccess
) UnoRuntime
.queryInterface( XRelationshipAccess
.class, xStorage
);
362 if ( xRelAccess
== null )
364 Error( "Can't get XRelationshipAccess implementation from the checked storage!" );
368 // get the relationship information
369 StringPair
[][] aStorRels
;
372 aStorRels
= xRelAccess
.getAllRelationships();
376 Error( "Can't get relationships of the checked storage, exception: " + e
);
380 if ( !checkRelations( aStorRels
, aRelations
) )
382 Error( "StorageRelationsChecking has failed!" );
389 public boolean InternalCheckStream( XStream xStream
,
393 StringPair
[][] aRelations
)
395 // get input stream of substream
396 XInputStream xInput
= xStream
.getInputStream();
397 if ( xInput
== null )
399 Error( "Can't get XInputStream implementation from substream '" + sName
+ "'!" );
403 byte pContents
[][] = new byte[1][]; // ???
408 xInput
.readBytes( pContents
, pBytes
.length
+ 1 );
412 Error( "Can't read from stream '" + sName
+ "', exception: " + e
);
416 // check size of stream data
417 if ( pContents
.length
== 0 )
419 Error( "SubStream '" + sName
+ "' reading produced disaster!" );
423 if ( pBytes
.length
!= pContents
[0].length
)
425 Error( "SubStream '" + sName
+ "' contains wrong amount of data! (" + pContents
[0].length
+ "/" + pBytes
.length
+ ")" );
430 for ( int ind
= 0; ind
< pBytes
.length
; ind
++ )
432 if ( pBytes
[ind
] != pContents
[0][ind
] )
434 Error( "SubStream '" + sName
+ "' contains wrong data! ( byte num. "
435 + ind
+ " should be" + pBytes
[ind
] + " but it is " + pContents
[0][ind
] + ")" );
443 // get access to the XPropertySet interface
444 XPropertySet xPropSet
= (XPropertySet
) UnoRuntime
.queryInterface( XPropertySet
.class, xStream
);
445 if ( xPropSet
!= null )
449 // get "MediaType" and "Size" properties and control there values
450 String sPropMediaType
= AnyConverter
.toString( xPropSet
.getPropertyValue( "MediaType" ) );
451 int nPropSize
= AnyConverter
.toInt( xPropSet
.getPropertyValue( "Size" ) );
454 if ( !sPropMediaType
.equals( sMediaType
) )
456 Error( "'MediaType' property contains wrong value for stream '" + sName
+ "',\nexpected: '"
457 + sMediaType
+ "', set: '" + sPropMediaType
+ "'!" );
461 if ( nPropSize
!= pBytes
.length
)
463 Error( "'Size' property contains wrong value for stream'" + sName
+ "'!" );
469 Error( "Can't get properties of substream '" + sName
+ "', exception: " + e
);
474 Error( "Can't get XPropertySet implementation from stream '" + sName
+ "'!" );
478 // get access to the relationship information
479 XRelationshipAccess xRelAccess
= (XRelationshipAccess
) UnoRuntime
.queryInterface( XRelationshipAccess
.class, xStream
);
481 if ( xRelAccess
== null )
483 Error( "Can't get XRelationshipAccess implementation from the stream\"" + sName
+ "\"!" );
487 // get the relationship information
488 StringPair
[][] aStorRels
;
491 aStorRels
= xRelAccess
.getAllRelationships();
495 Error( "Can't get relationships of the substream '" + sName
+ "', exception: " + e
);
499 if ( !checkRelations( aStorRels
, aRelations
) )
501 Error( "Stream '" + sName
+ "' RelationsChecking has failed!" );
508 public boolean checkStream( XStorage xParentStorage
,
512 StringPair
[][] aRelations
)
514 // open substream element first
515 XStream xSubStream
= null;
518 Object oSubStream
= xParentStorage
.openStreamElement( sName
, ElementModes
.READ
);
519 xSubStream
= (XStream
) UnoRuntime
.queryInterface( XStream
.class, oSubStream
);
520 if ( xSubStream
== null )
522 Error( "Can't open substream '" + sName
+ "'!" );
528 Error( "Can't open substream '" + sName
+ "', exception : " + e
+ "!" );
532 boolean bResult
= InternalCheckStream( xSubStream
, sName
, sMediaType
, pBytes
, aRelations
);
534 // free the stream resources, garbage collector may remove the object too late
535 if ( !disposeStream( xSubStream
, sName
) )
541 public boolean copyStorage( XStorage xSourceStorage
, XStorage xDestStorage
)
543 // copy xSourceStorage to xDestStorage
546 xSourceStorage
.copyToStorage( xDestStorage
);
550 Error( "Storage copying failed, exception: " + e
);
557 public boolean commitStorage( XStorage xStorage
)
559 // XTransactedObject must be supported by storages
560 XTransactedObject xTransact
= (XTransactedObject
) UnoRuntime
.queryInterface( XTransactedObject
.class, xStorage
);
561 if ( xTransact
== null )
563 Error( "Storage doesn't implement transacted access!" );
573 Error( "Storage commit failed, exception:" + e
);
580 public boolean disposeStream( XStream xStream
, String sStreamName
)
582 XComponent xComponent
= (XComponent
) UnoRuntime
.queryInterface( XComponent
.class, xStream
);
583 if ( xComponent
== null )
585 Error( "Can't get XComponent implementation from substream '" + sStreamName
+ "'!" );
591 xComponent
.dispose();
595 Error( "Substream '" + sStreamName
+ "' disposing throws exception: " + e
);
602 public boolean disposeStorage( XStorage xStorage
)
604 // dispose the storage
605 XComponent xComponent
= (XComponent
) UnoRuntime
.queryInterface( XComponent
.class, xStorage
);
606 if ( xComponent
== null )
608 Error( "Can't retrieve XComponent implementation from storage!" );
614 xComponent
.dispose();
618 Error( "Storage disposing failed!" );
625 public XInputStream
getInputStream( XStream xStream
)
627 XInputStream xInTemp
= null;
630 xInTemp
= xStream
.getInputStream();
631 if ( xInTemp
== null )
632 Error( "Can't get the input part of a stream!" );
634 catch ( Exception e
)
636 Error( "Can't get the input part of a stream, exception :" + e
);
642 public boolean closeOutput( XStream xStream
)
644 XOutputStream xOutTemp
= null;
647 xOutTemp
= xStream
.getOutputStream();
648 if ( xOutTemp
== null )
650 Error( "Can't get the output part of a stream!" );
654 catch ( Exception e
)
656 Error( "Can't get the output part of a stream, exception :" + e
);
662 xOutTemp
.closeOutput();
664 catch ( Exception e
)
666 Error( "Can't close output part of a stream, exception :" + e
);
673 public XStorage
openSubStorage( XStorage xStorage
, String sName
, int nMode
)
675 // open existing substorage
678 Object oSubStorage
= xStorage
.openStorageElement( sName
, nMode
);
679 XStorage xSubStorage
= (XStorage
) UnoRuntime
.queryInterface( XStorage
.class, oSubStorage
);
684 Error( "Can't open substorage '" + sName
+ "', exception: " + e
);
690 public XStream
CreateTempFileStream( XMultiServiceFactory xMSF
)
692 // try to get temporary file representation
693 XStream xTempFileStream
= null;
696 Object oTempFile
= xMSF
.createInstance( "com.sun.star.io.TempFile" );
697 xTempFileStream
= (XStream
)UnoRuntime
.queryInterface( XStream
.class, oTempFile
);
702 if ( xTempFileStream
== null )
703 Error( "Can't create temporary file!" );
705 return xTempFileStream
;
708 public String
CreateTempFile( XMultiServiceFactory xMSF
)
710 String sResult
= null;
712 // try to get temporary file representation
713 XPropertySet xTempFileProps
= null;
716 Object oTempFile
= xMSF
.createInstance( "com.sun.star.io.TempFile" );
717 xTempFileProps
= (XPropertySet
)UnoRuntime
.queryInterface( XPropertySet
.class, oTempFile
);
722 if ( xTempFileProps
!= null )
726 xTempFileProps
.setPropertyValue( "RemoveFile", new Boolean( false ) );
727 sResult
= AnyConverter
.toString( xTempFileProps
.getPropertyValue( "Uri" ) );
731 Error( "Can't control TempFile properties, exception: " + e
);
736 Error( "Can't create temporary file representation!" );
739 // close temporary file explicitly
742 XStream xStream
= (XStream
)UnoRuntime
.queryInterface( XStream
.class, xTempFileProps
);
743 if ( xStream
!= null )
745 XOutputStream xOut
= xStream
.getOutputStream();
749 XInputStream xIn
= xStream
.getInputStream();
754 Error( "Can't close TempFile!" );
758 Error( "Can't close TempFile, exception: " + e
);
764 public boolean copyElementTo( XStorage xSource
, String sName
, XStorage xDest
)
766 // copy element with name sName from xSource to xDest
769 xSource
.copyElementTo( sName
, xDest
, sName
);
773 Error( "Element copying failed, exception: " + e
);
780 public boolean copyElementTo( XStorage xSource
, String sName
, XStorage xDest
, String sTargetName
)
782 // copy element with name sName from xSource to xDest
785 xSource
.copyElementTo( sName
, xDest
, sTargetName
);
789 Error( "Element copying failed, exception: " + e
);
796 public boolean moveElementTo( XStorage xSource
, String sName
, XStorage xDest
)
798 // move element with name sName from xSource to xDest
801 xSource
.moveElementTo( sName
, xDest
, sName
);
805 Error( "Element moving failed, exception: " + e
);
812 public boolean renameElement( XStorage xStorage
, String sOldName
, String sNewName
)
814 // rename element with name sOldName to sNewName
817 xStorage
.renameElement( sOldName
, sNewName
);
821 Error( "Element renaming failed, exception: " + e
);
828 public boolean removeElement( XStorage xStorage
, String sName
)
830 // remove element with name sName
833 xStorage
.removeElement( sName
);
837 Error( "Element removing failed, exception: " + e
);
844 public XStream
OpenStream( XStorage xStorage
,
848 // open substream element
849 XStream xSubStream
= null;
852 Object oSubStream
= xStorage
.openStreamElement( sStreamName
, nMode
);
853 xSubStream
= (XStream
) UnoRuntime
.queryInterface( XStream
.class, oSubStream
);
854 if ( xSubStream
== null )
855 Error( "Can't create substream '" + sStreamName
+ "'!" );
859 Error( "Can't create substream '" + sStreamName
+ "', exception : " + e
+ "!" );
865 public boolean cantOpenStorage( XStorage xStorage
, String sName
)
867 // try to open an opened substorage, open call must fail
870 Object oDummyStorage
= xStorage
.openStorageElement( sName
, ElementModes
.READ
);
871 Error( "The trying to reopen opened substorage '" + sName
+ "' must fail!" );
881 public boolean cantOpenStream( XStorage xStorage
, String sName
, int nMode
)
883 // try to open the substream with specified mode must fail
886 Object oDummyStream
= xStorage
.openStreamElement( sName
, nMode
);
887 Error( "The trying to open substoream '" + sName
+ "' must fail!" );
897 public XStorage
createStorageFromURL(
898 XSingleServiceFactory xFactory
,
902 XStorage xResult
= null;
906 PropertyValue
[] aAddArgs
= new PropertyValue
[1];
907 aAddArgs
[0] = new PropertyValue();
908 aAddArgs
[0].Name
= "StorageFormat";
909 aAddArgs
[0].Value
= "OFOPXMLFormat";
911 Object pArgs
[] = new Object
[3];
912 pArgs
[0] = (Object
) aURL
;
913 pArgs
[1] = new Integer( nMode
);
914 pArgs
[2] = (Object
) aAddArgs
;
916 Object oTempStorage
= xFactory
.createInstanceWithArguments( pArgs
);
917 xResult
= (XStorage
) UnoRuntime
.queryInterface( XStorage
.class, oTempStorage
);
921 Error( "Can't create storage from URL, exception: " + e
);
925 if ( xResult
== null )
926 Error( "Can't create storage from URL!" );
931 public XStorage
createStorageFromStream(
932 XSingleServiceFactory xFactory
,
936 XStorage xResult
= null;
940 PropertyValue
[] aAddArgs
= new PropertyValue
[1];
941 aAddArgs
[0] = new PropertyValue();
942 aAddArgs
[0].Name
= "StorageFormat";
943 aAddArgs
[0].Value
= "OFOPXMLFormat";
945 Object pArgs
[] = new Object
[3];
946 pArgs
[0] = (Object
) xStream
;
947 pArgs
[1] = new Integer( nMode
);
948 pArgs
[2] = (Object
) aAddArgs
;
950 Object oTempStorage
= xFactory
.createInstanceWithArguments( pArgs
);
951 xResult
= (XStorage
) UnoRuntime
.queryInterface( XStorage
.class, oTempStorage
);
955 Error( "Can't create storage from stream, exception: " + e
);
959 if ( xResult
== null )
960 Error( "Can't create storage from stream!" );
965 public XStorage
createStorageFromInputStream(
966 XSingleServiceFactory xFactory
,
967 XInputStream xInStream
)
969 XStorage xResult
= null;
973 PropertyValue
[] aAddArgs
= new PropertyValue
[1];
974 aAddArgs
[0] = new PropertyValue();
975 aAddArgs
[0].Name
= "StorageFormat";
976 aAddArgs
[0].Value
= "OFOPXMLFormat";
978 Object pArgs
[] = new Object
[3];
979 pArgs
[0] = (Object
) xInStream
;
980 pArgs
[1] = new Integer( ElementModes
.READ
);
981 pArgs
[2] = (Object
) aAddArgs
;
983 Object oTempStorage
= xFactory
.createInstanceWithArguments( pArgs
);
984 xResult
= (XStorage
) UnoRuntime
.queryInterface( XStorage
.class, oTempStorage
);
988 Error( "Can't create storage from input stream, exception: " + e
);
992 if ( xResult
== null )
993 Error( "Can't create storage from input stream!" );
998 public XStorage
createTempStorage( XMultiServiceFactory xMSF
, XSingleServiceFactory xFactory
)
1000 // create a temporary storage
1001 XStorage xResult
= null;
1002 XStream xStream
= CreateTempFileStream( xMSF
);
1003 if ( xStream
== null )
1005 Error( "Can't create temp file stream!" );
1011 xResult
= createStorageFromStream( xFactory
, xStream
, ElementModes
.WRITE
);
1013 catch( Exception e
)
1015 Error( "Can't create temp storage, exception: " + e
);
1021 public XStorage
cloneStorage( XMultiServiceFactory xMSF
, XSingleServiceFactory xFactory
, XStorage xStorage
)
1023 // create a copy of a last commited version of specified storage
1024 XStorage xResult
= null;
1027 xResult
= createTempStorage( xMSF
, xFactory
);
1028 if ( xResult
!= null )
1029 xStorage
.copyLastCommitTo( xResult
);
1031 catch( Exception e
)
1033 Error( "Can't clone storage, exception: " + e
);
1040 public XStorage
cloneSubStorage( XMultiServiceFactory xMSF
, XSingleServiceFactory xFactory
, XStorage xStorage
, String sName
)
1042 // create a copy of a last commited version of specified substorage
1043 XStorage xResult
= null;
1046 xResult
= createTempStorage( xMSF
, xFactory
);
1047 if ( xResult
!= null )
1048 xStorage
.copyStorageElementLastCommitTo( sName
, xResult
);
1050 catch( Exception e
)
1052 Error( "Can't clone substorage '" + sName
+ "', exception: " + e
);
1059 public XStream
cloneSubStream( XStorage xStorage
, String sName
)
1061 // clone existing substream
1064 XStream xStream
= xStorage
.cloneStreamElement( sName
);
1067 catch( Exception e
)
1069 Error( "Can't clone substream '" + sName
+ "', exception: " + e
);
1075 public void Error( String sError
)
1077 m_aLogWriter
.println( m_sTestPrefix
+ "Error: " + sError
);
1080 public void Message( String sMessage
)
1082 m_aLogWriter
.println( m_sTestPrefix
+ sMessage
);
1085 public void PrintRelations( StringPair
[][] aRels
)
1087 m_aLogWriter
.println( "========" );
1088 for ( int nInd1
= 0; nInd1
< aRels
.length
; nInd1
++ )
1090 for ( int nInd2
= 0; nInd2
< aRels
[nInd1
].length
; nInd2
++ )
1092 m_aLogWriter
.println( "\"" + aRels
[nInd1
][nInd2
].First
+ "\" = \"" + aRels
[nInd1
][nInd2
].Second
+ "\", " );
1094 m_aLogWriter
.println( "========" );