Package gov.nasa.arc.mct.components

Examples of gov.nasa.arc.mct.components.AbstractComponent


    Mockito.when(mockEnumComponent.getData()).thenReturn(data);
    Mockito.when(registry.newInstance(EvaluatorComponent.class, null)).thenReturn(mockEnumComponent);
    service.setComponentRegistry(registry);
    final String languageType = "lang";
    final String code = "123";
    AbstractComponent component = service.createEvaluator(languageType, code, null);
    Assert.assertSame(component, mockEnumComponent);
   
    Assert.assertEquals(data.getLanguage(), languageType);
    Assert.assertEquals(data.getCode(), code);
   
View Full Code Here


    @Override
    public void createDefaultComponents() {
        Platform platform = PlatformAccess.getPlatform();
        CoreComponentRegistry componentRegistry = platform.getComponentRegistry();
       
        AbstractComponent dropBoxes = componentRegistry.newInstance(TelemetryDataTaxonomyComponent.class.getName());
        dropBoxes.setDisplayName("User Drop Boxes");
        dropBoxes.setExternalKey("/UserDropBoxes");
        ComponentInitializer dropBoxesCapability = dropBoxes.getCapability(ComponentInitializer.class);
        dropBoxesCapability.setCreator("admin");
        dropBoxesCapability.setOwner("admin");
       
        platform.getPersistenceProvider().persist(Collections.singleton(dropBoxes));
        platform.getPersistenceProvider().tagComponents("bootstrap:admin", Collections.singleton(dropBoxes));
View Full Code Here

                new Object[] { 5, 4, 5 },
        };
    }
    private MCTMutableTreeNode createChild(int id) {
        View mockManifestation = mock(View.class);
        AbstractComponent comp = mock(AbstractComponent.class);
       
        when(mockManifestation.getManifestedComponent()).thenReturn(comp);
        when(comp.getId()).thenReturn(String.valueOf(id));
       
        return new MCTMutableTreeNode(mockManifestation);
    }
View Full Code Here

       
        final String name = getNewMulti(sourceComponents);
        if (name.isEmpty())
            return;
       
        final AbstractComponent multi = createNewMulti(sourceComponents);
        if (multi == null) {
            showErrorInCreateMulti();
        } else {
          multi.setDisplayName(name);
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              openNewMulti(name, multi);
            }
          });
View Full Code Here

     * @param sourceComponents the collection of components.
     * @return newly created abstract component.
     */
    AbstractComponent createNewMulti(Collection<AbstractComponent> sourceComponents) {
      MultiCreationServiceImpl e = new MultiCreationServiceImpl();
      AbstractComponent ac = e.createMulti(MultiEvaluator.LANGUAGE_STRING, "");
    ((MultiComponent)ac).getData().setFallThroughDisplayValue("????");
    if (sourceComponents.size() == 1) {
      ((MultiComponent)ac).getData().setPassThrough(true);
      FeedProvider fp = sourceComponents.iterator().next().getCapability(FeedProvider.class);
      ((MultiComponent)ac).getData().setPassThroughParameterId(fp.getSubscriptionId());
    } else {
      ((MultiComponent)ac).getData().setPassThrough(false);
    }
      ac.addDelegateComponents(sourceComponents);
      return ac;
    }
View Full Code Here

        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

    }
   
    private AbstractComponent createMySandbox(PersistenceProvider persistenceService, CoreComponentRegistry componentRegistry,
            String session, Map<AbstractComponent, Collection<AbstractComponent>> userMap, String userId, String group) {
        // Create My Sandbox, which goes under All
        AbstractComponent all = PlatformAccess.getPlatform().getRootComponent();
        AbstractComponent mySandbox = createComponent(MineTaxonomyComponent.class);       
        mySandbox.setDisplayName("My Sandbox");
        mySandbox.setOwner(userId);
        all.addDelegateComponent(mySandbox);
       
        userMap.put(mySandbox, Collections.singleton(all));
        return mySandbox;
    }   
View Full Code Here

  public ExecutionResult execute(PolicyContext context) {
    boolean result = true;
   
    ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class);
    if (InfoViewManifestation.class.equals(viewInfo.getViewClass())) {
      AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class);
     
      result = hasFeedProvider(targetComponent);
    }
   
    String message = null;
View Full Code Here

    }
   
    @Override
    public void actionPerformed(ActionEvent e) {
       
        AbstractComponent mineComponent = PlatformAccess.getPlatform().getMySandbox();
        mineComponent.open();
    }
View Full Code Here

    private void createUserDropbox(PersistenceProvider persistenceProvider, String session,
            Map<AbstractComponent, Collection<AbstractComponent>> userMap,
            String userId, String group, AbstractComponent mySandbox) {
       
        // Create DropBox under My Sandbox
        AbstractComponent userDropBox = createComponent(TelemetryUserDropBoxComponent.class);
        userDropBox.setOwner(userId);
        ComponentInitializer ci = userDropBox.getCapability(ComponentInitializer.class);
        ci.setCreator(userId);
        ci.setCreationDate(new Date());
       
        userDropBox.setDisplayName(userId + "'s Drop Box");
        mySandbox.addDelegateComponent(userDropBox);
        Collection<AbstractComponent> dropboxParents = new LinkedHashSet<AbstractComponent>();
        dropboxParents.add(mySandbox);
       
        userMap.put(userDropBox, dropboxParents);
       
        // Place user dropbox under the Discpline's Drop Boxes
        AbstractComponent dropboxContainer = null;//ownedByAdmin(persistenceProvider.findComponentByName(session, group + "\'s Drop Boxes"));
       
        assert dropboxContainer != null : "Cannot find " + group + "'s Drop Boxes component";
        dropboxContainer.addDelegateComponents(Collections.singleton(userDropBox));
       
        dropboxParents.add(dropboxContainer);
    }
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.components.AbstractComponent

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.