final String groupName, final String name, String version,
final ConflictResolution conflictResolution,
final Map<String, String> packageDefinitionProperties)
throws IOException, RepositoryException {
final JcrPackageManager jcrPackageManager = packaging.getPackageManager(session);
if (ConflictResolution.Replace.equals(conflictResolution)) {
this.removePackage(jcrPackageManager, groupName, name, version);
} else if (ConflictResolution.IncrementVersion.equals(conflictResolution)) {
version = this.getNextVersion(jcrPackageManager, groupName, name, version).toString();
}
final JcrPackage jcrPackage = jcrPackageManager.create(groupName, name, version);
final JcrPackageDefinition jcrPackageDefinition = jcrPackage.getDefinition();
final DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();
for (final PathFilterSet pathFilterSet : pathFilterSets) {
workspaceFilter.add(pathFilterSet);