class PathNamingServiceImpl implements PathNamingService {

    public Path buildTargetPath(Path originalPath,
                                String targetFileName) {
        final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath);
        String extension = "";

        if (!Files.isDirectory(_originalPath)) {
            extension = getExtension(originalPath.getFileName());
        }

        return Paths.convert(_originalPath.resolveSibling(targetFileName + extension));
    }

}