Package gov.nasa.arc.mct.platform.spi

Examples of gov.nasa.arc.mct.platform.spi.PersistenceProvider


                            });
                            return;
                        }

                        Platform platform = PlatformAccess.getPlatform();
                        PersistenceProvider persistenceService = platform.getPersistenceProvider();
                        CoreComponentRegistry componentRegistry = platform.getComponentRegistry();
                        AbstractComponent mySandbox = componentRegistry.newInstance(MineTaxonomyComponent.class.getName());
                        ComponentInitializer mysandboxCapability = mySandbox.getCapability(ComponentInitializer.class);
                        mysandboxCapability.setCreator(userId);
                        mysandboxCapability.setOwner(userId);
                        mySandbox.setDisplayName("My Sandbox");
                                               
                        AbstractComponent dropbox = componentRegistry.newInstance(TelemetryUserDropBoxComponent.class.getName());
                        ComponentInitializer dropboxCapability = dropbox.getCapability(ComponentInitializer.class);
                        dropboxCapability.setCreator("admin");
                        dropboxCapability.setOwner("*");
                        dropbox.setDisplayName(userId + "\'s drop box");

                        persistenceService.addNewUser(userId, disciplineComponent.getDisplayName(), mySandbox, dropbox);
                        disciplineComponent.componentSaved();
                        textField.setText(EM_STR);
                    }
                }

View Full Code Here


           
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        PersistenceProvider persistenceProvider = PlatformAccess.getPlatform().getPersistenceProvider();
        View embeddedView = housingManifestation.getContentArea().getHousedViewManifestation();
        AbstractComponent updatedComponent = persistenceProvider.getComponent(housingManifestation.getContentArea().getOwnerComponent().getComponentId());       
        housingManifestation.getContentArea().setOwnerComponentCanvasManifestation(embeddedView.getInfo().createView(updatedComponent));
        housingManifestation.setManifestedComponent(updatedComponent);
    }
View Full Code Here

    }
   
    public void refresh() {
        clearRows();
        GenericUser genericUser = new GenericUser();
        PersistenceProvider persistenceService = PlatformAccess.getPlatform().getPersistenceProvider();
        for (String user : persistenceService.getUsersInGroup(discipline)) {
            genericUser.setUserId(user);
            genericUser.setDisciplineId(discipline);           
            tableModel.addRow(new Object[]{user, discipline, RoleAccess.getPrimaryRole(genericUser)});               
        }       
    }
View Full Code Here

        }
       
    }
   
    private static void runUnderUnitOfWork(Runnable r) {
        PersistenceProvider provider = PlatformAccess.getPlatform().getPersistenceProvider();
        boolean successfulAction = false;
        try {
            provider.startRelatedOperations();
            r.run();
            successfulAction = true;
        } catch (OptimisticLockException e) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    OptionBox.showMessageDialog(null,BUNDLE.getString("StaleObjectMessage"),BUNDLE.getString("StableObjectMessageTitle"),OptionBox.ERROR_MESSAGE);
                }
            });
        } finally {
            provider.completeRelatedOperations(successfulAction);
        }
    }
View Full Code Here

        Mockito.when(mockHousing.getContentArea()).thenReturn(mockContentArea);
        Mockito.when(mockContentArea.getHousedViewManifestation()).thenReturn(mockView);
        Mockito.when(mockView.getManifestedComponent()).thenReturn(comp);

        // Generate a new persistence provider each time
        PersistenceProvider persistence = Mockito.mock(PersistenceProvider.class);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(persistence);

        // Simulate menu activation cycle; also, verify expectations (even
        // though redundant to test below)
        Assert.assertTrue(action.canHandle(mockContext));
View Full Code Here

        Mockito.when(mockHousing.getContentArea()).thenReturn(mockContentArea);
        Mockito.when(mockContentArea.getHousedViewManifestation()).thenReturn(mockView);
        Mockito.when(mockView.getManifestedComponent()).thenReturn(comp);

        // Generate a new persistence provider each time
        PersistenceProvider persistence = Mockito.mock(PersistenceProvider.class);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(persistence);

        // Ensure dialog choice
        WindowManager windowing = Mockito.mock(WindowManager.class);
        Mockito.when(mockPlatform.getWindowManager()).thenReturn(windowing);
View Full Code Here

    @Override
    public void userAdded(String session, String userId, String group) {
        Map<AbstractComponent, Collection<AbstractComponent>> userMap = new HashMap<AbstractComponent, Collection<AbstractComponent>>();
        map.put(userId + DELIM + group, userMap);
       
        PersistenceProvider persistenceService = PlatformAccess.getPlatform().getPersistenceProvider();
        CoreComponentRegistry componentRegistry = PlatformAccess.getPlatform().getComponentRegistry();
                       
        AbstractComponent mySandbox = createMySandbox(persistenceService, componentRegistry, session, userMap, userId, group);
        createUserDropbox(persistenceService, session, userMap, userId, group, mySandbox);       
    }
View Full Code Here

                }
            }
        }
       
        if (!bootstraps.isEmpty()) {
            PersistenceProvider persistence = PlatformAccess.getPlatform().getPersistenceProvider();
            persistence.persist(bootstraps);
            persistence.tagComponents("bootstrap:admin", adminBootstraps);
            persistence.tagComponents("bootstrap:creator", userBootstraps);
        }
    }
View Full Code Here

     * Gets the components which are referencing this component. Currently, only delegate components are considered.
     * The result of this method is transient and thus requires overhead for each execution.
     * @return collection which can be empty but never null of components which reference this component.
     */
    public Collection<AbstractComponent> getReferencingComponents() {
        PersistenceProvider persistenceService = PlatformAccess.getPlatform().getPersistenceProvider();
        return persistenceService.getReferences(this);
    }
View Full Code Here

           
            final ExecutionResult result = PlatformAccess.getPlatform().getPolicyManager().execute(PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey(), context);
            if (result.getStatus()) {
               
                // Persist
                PersistenceProvider persistenceProvider = PlatformAccess.getPlatform().getPersistenceProvider();
                boolean successfulAction = false;
                try {
                    persistenceProvider.startRelatedOperations();
                    targetComponent.addDelegateComponents(sourceComponents);
                    targetComponent.save();
                    successfulAction = true;
                } finally {
                    persistenceProvider.completeRelatedOperations(successfulAction);
                }

                if (successfulAction) {
                    if (event.getTargetManifestation() instanceof DropboxCanvasView) {
                        StringBuilder sentObjects = new StringBuilder();
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.platform.spi.PersistenceProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.