Search in sources :

Example 1 with FileSystemItemAdapterService

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;
}
Also used : FileSystemItemAdapterService(org.nuxeo.drive.service.FileSystemItemAdapterService) FileSystemItemAdapterServiceImpl(org.nuxeo.drive.service.impl.FileSystemItemAdapterServiceImpl) URL(java.net.URL) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Example 2 with FileSystemItemAdapterService

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();
}
Also used : FileSystemItemAdapterService(org.nuxeo.drive.service.FileSystemItemAdapterService) FileSystemItemAdapterServiceImpl(org.nuxeo.drive.service.impl.FileSystemItemAdapterServiceImpl) Before(org.junit.Before)

Example 3 with FileSystemItemAdapterService

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));
    }
}
Also used : FileSystemItemAdapterService(org.nuxeo.drive.service.FileSystemItemAdapterService) VersioningFileSystemItemFactory(org.nuxeo.drive.service.VersioningFileSystemItemFactory) OperationMethod(org.nuxeo.ecm.automation.core.annotations.OperationMethod)

Aggregations

FileSystemItemAdapterService (org.nuxeo.drive.service.FileSystemItemAdapterService)3 FileSystemItemAdapterServiceImpl (org.nuxeo.drive.service.impl.FileSystemItemAdapterServiceImpl)2 OperationMethod (org.nuxeo.ecm.automation.core.annotations.OperationMethod)2 URL (java.net.URL)1 Before (org.junit.Before)1 VersioningFileSystemItemFactory (org.nuxeo.drive.service.VersioningFileSystemItemFactory)1