}
}
} else {
// This is not a file from the system folder. User is trying to access a resource in the repository.
// Get the RepositoryContentConverterHandler
IRepositoryContentConverterHandler converterHandler = PentahoSystem.get( IRepositoryContentConverterHandler.class);
RepositoryFile repositoryFile = null;
if ( locale == null ) {
repositoryFile = getRepository().getFile( filePath );
String extension = FilenameUtils.getExtension( filePath );
try {
// Try to get the converter for the extension. If there is not converter available then we will
//assume simple type and will get the data that way
if(converterHandler != null) {
Converter converter = converterHandler.getConverter( extension );
if(converter != null) {
inputStream = converter.convert( repositoryFile.getId() );
}
}
if(inputStream == null) {
inputStream =
getRepository().getDataForRead( repositoryFile.getId(), SimpleRepositoryFileData.class ).getStream();
}
} catch ( UnifiedRepositoryException ure ) {
//ignored
}
} else {
String extension = FilenameUtils.getExtension( filePath );
String baseName = FilenameUtils.removeExtension( filePath );
if ( extension.length() > 0 ) {
extension = "." + extension; //$NON-NLS-1$
}
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
if ( !variant.equals( "" ) ) { //$NON-NLS-1$
repositoryFile =
getRepository().getFile( baseName + "_" + language + "_" + country + "_" + variant + extension ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
try {
if ( repositoryFile != null ) {
// Try to get the converter for the extension. If there is not converter available then we will
//assume simple type and will get the data that way
if(converterHandler != null) {
Converter converter = converterHandler.getConverter( FilenameUtils.getExtension( filePath ) );
if(converter != null) {
inputStream = converter.convert( repositoryFile.getId() );
}
}
if(inputStream == null) {
inputStream =
getRepository().getDataForRead( repositoryFile.getId(), SimpleRepositoryFileData.class ).getStream();
}
}
} catch ( UnifiedRepositoryException ure ) {
//ignored
}
}
if ( inputStream == null ) {
repositoryFile = getRepository().getFile( baseName + "_" + language + "_" + country + extension ); //$NON-NLS-1$//$NON-NLS-2$
try {
if ( repositoryFile != null ) {
// Try to get the converter for the extension. If there is not converter available then we will
//assume simple type and will get the data that way
if(converterHandler != null) {
Converter converter = converterHandler.getConverter( FilenameUtils.getExtension( filePath ) );
if(converter != null) {
inputStream = converter.convert( repositoryFile.getId() );
}
}
if(inputStream == null) {
inputStream =
getRepository().getDataForRead( repositoryFile.getId(), SimpleRepositoryFileData.class ).getStream();
} }
} catch ( UnifiedRepositoryException ure ) {
//ignored
}
}
if ( inputStream == null ) {
repositoryFile = getRepository().getFile( baseName + "_" + language + extension ); //$NON-NLS-1$
try {
if ( repositoryFile != null ) {
// Try to get the converter for the extension. If there is not converter available then we will
//assume simple type and will get the data that way
if(converterHandler != null) {
Converter converter = converterHandler.getConverter( FilenameUtils.getExtension( filePath ) );
if(converter != null) {
inputStream = converter.convert( repositoryFile.getId() );
}
}
if(inputStream == null) {
inputStream =
getRepository().getDataForRead( repositoryFile.getId(), SimpleRepositoryFileData.class ).getStream();
}
}
} catch ( UnifiedRepositoryException ure ) {
//ignored
}
}
if ( inputStream == null ) {
repositoryFile = getRepository().getFile( filePath );
try {
if ( repositoryFile != null ) {
// Try to get the converter for the extension. If there is not converter available then we will
//assume simple type and will get the data that way
if(converterHandler != null) {
Converter converter = converterHandler.getConverter( FilenameUtils.getExtension( filePath ) );
if(converter != null) {
inputStream = converter.convert( repositoryFile.getId() );
}
}
if(inputStream == null) {