use of org.nuxeo.drive.service.FileSystemItemAdapterService in project nuxeo-drive-server by nuxeo.
the class NuxeoDriveSetActiveFactories method run.
@OperationMethod
public boolean run() throws Exception {
NuxeoDriveIntegrationTestsHelper.checkOperationAllowed();
String contrib;
if ("userworkspace".equals(profile)) {
contrib = "/OSGI-INF/nuxeodrive-hierarchy-userworkspace-contrib.xml";
} else if ("permission".equals(profile)) {
contrib = "/OSGI-INF/nuxeodrive-hierarchy-permission-contrib.xml";
} else {
log.warn(String.format("No active file system item factory contribution for profile '%s'.", profile));
return false;
}
URL url = NuxeoDriveSetActiveFactories.class.getResource(contrib);
try {
if (enable) {
Framework.getRuntime().getContext().deploy(url);
} else {
Framework.getRuntime().getContext().undeploy(url);
}
} finally {
Framework.getRuntime().getComponentManager().unstash();
}
FileSystemItemAdapterServiceImpl fileSystemItemAdapterService = (FileSystemItemAdapterServiceImpl) Framework.getService(FileSystemItemAdapterService.class);
fileSystemItemAdapterService.setActiveFactories();
return true;
}
use of org.nuxeo.drive.service.FileSystemItemAdapterService in project nuxeo-drive-server by nuxeo.
the class TestPermissionHierarchyFileSystemChanges method init.
@Before
public void init() throws Exception {
// Enable deletion listener because the tear down disables it
eventServiceAdmin.setListenerEnabledFlag("nuxeoDriveFileSystemDeletionListener", true);
// Create test users
createUser("user1", "user1");
createUser("user2", "user2");
// Open a core session for each user
session1 = coreFeature.openCoreSession("user1");
session2 = coreFeature.openCoreSession("user2");
principal1 = session1.getPrincipal();
principal2 = session2.getPrincipal();
// Create personal workspace for user1
userWorkspace1 = userWorkspaceService.getCurrentUserPersonalWorkspace(session1, null);
userWorkspace1ItemId = USER_SYNC_ROOT_PARENT_ID_PREFIX + userWorkspace1.getId();
TransactionHelper.commitOrRollbackTransaction();
TransactionHelper.startTransaction();
// Wait for personal workspace creation event to be logged in the audit
eventService.waitForAsyncCompletion();
// Make sure to set ordered active factories
FileSystemItemAdapterServiceImpl fileSystemItemAdapterService = (FileSystemItemAdapterServiceImpl) Framework.getService(FileSystemItemAdapterService.class);
fileSystemItemAdapterService.setActiveFactories();
}
use of org.nuxeo.drive.service.FileSystemItemAdapterService in project nuxeo-drive-server by nuxeo.
the class NuxeoDriveSetVersioningOptions method run.
@OperationMethod
public void run() {
NuxeoDriveIntegrationTestsHelper.checkOperationAllowed();
FileSystemItemAdapterService fileSystemItemAdapterService = Framework.getService(FileSystemItemAdapterService.class);
VersioningFileSystemItemFactory defaultFileSystemItemFactory = (VersioningFileSystemItemFactory) ((FileSystemItemAdapterServiceImpl) fileSystemItemAdapterService).getFileSystemItemFactory("defaultFileSystemItemFactory");
if (delay != null) {
defaultFileSystemItemFactory.setVersioningDelay(Double.parseDouble(delay));
}
if (option != null) {
defaultFileSystemItemFactory.setVersioningOption(VersioningOption.valueOf(option));
}
}
Aggregations