private final static int ensureSchemasAvailable ( byte [ ] buffer , int offset , Object store ) throws MessageRestoreFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "ensureSchemasAvailable" , new Object [ ] { offset , store } ) ; // If we have a message store we need to ensure all the schemas we'll // need to decode the message are restored from the store. int temp = ArrayUtil . readInt ( buffer , offset ) ; // the number of encoding Ids offset += ArrayUtil . INT_SIZE ; long [ ] decodeIds = new long [ temp ] ; for ( int i = 0 ; i < temp ; i ++ ) { decodeIds [ i ] = ArrayUtil . readLong ( buffer , offset ) ; // each encoding schema id offset += ArrayUtil . LONG_SIZE ; } if ( store != null && decodeIds . length > 0 ) { if ( ! ( store instanceof MessageStore ) ) throw new IllegalArgumentException ( "store is not a MessageStore instance" ) ; SchemaStore . loadSchemas ( ( MessageStore ) store , decodeIds ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "ensureSchemasAvailable" , offset ) ; return offset ; }
Utility method to extract the schema ids from a message buffer and if a message store is supplied check that all the necessary schemas are available .