Package org.sonatype.nexus.componentviews.config

Examples of org.sonatype.nexus.componentviews.config.ViewConfig


    final String viewName = document.field(P_VIEWNAME, OType.STRING);
    final String internalId = document.field(P_VIEWID, OType.STRING);
    final String factoryName = document.field(P_FACTORYNAME, OType.STRING);
    final Map<String, Object> config = document.field(P_CONFIGURATION, OType.EMBEDDEDMAP);
    ViewConfig entity = new ViewConfig(new ViewId(viewName, internalId), factoryName, config);

    return entity;
  }
View Full Code Here


    Map<ViewConfigId, ViewConfig> items = Maps.newHashMap();

    try (ODatabaseDocumentTx db = openDb()) {
      for (ODocument doc : entityAdapter.browse(db)) {
        ORID rid = doc.getIdentity();
        ViewConfig item = entityAdapter.read(doc);
        items.put(convertId(rid), item);
      }
    }

    return items;
View Full Code Here

  public void reloadView() {
    final ViewFactorySource factorySource = mock(ViewFactorySource.class);
    final ViewRegistry viewRegistry = mock(ViewRegistry.class);

    // A changed (and persisted) configuration created by an admin
    final ViewConfig config = mock(ViewConfig.class);

    final ViewFactory factory = factorySource.getFactory(config.getFactoryName());
    final View newView = factory.createView(config);

    // De-register the existing view
    final View existingView = viewRegistry.findViewByName(config.getViewName());
    if (existingView != null) {
      viewRegistry.unregisterView(existingView);
    }
    // Register its replacement
    viewRegistry.registerView(newView);
View Full Code Here

  private static final String PROXY_INTERNAL_ID = "bar_34wfe32434";

  @Override
  public void contributeTo(final ViewConfigStore viewConfigStore) throws IOException {

    final ViewConfig hostedViewConfig = new ViewConfig(new ViewId(VIEW_NAME, INTERNAL_ID),
        RawBinaryViewFactory.FACTORY_NAME,
        Collections.<String, Object>emptyMap());

    addIfAbsent(hostedViewConfig, viewConfigStore);

    final ViewConfig proxyViewConfig = new ViewConfig(new ViewId(PROXY_VIEW_NAME, PROXY_INTERNAL_ID),
        RawBinaryProxyViewFactory.FACTORY_NAME,
        ImmutableMap.of("sourceName", (Object) RawSourceConfigContribution.SOURCE_NAME));

    addIfAbsent(proxyViewConfig, viewConfigStore);
  }
View Full Code Here

    addIfAbsent(proxyViewConfig, viewConfigStore);
  }

  private void addIfAbsent(final ViewConfig config, final ViewConfigStore viewConfigStore) throws IOException {
    final ViewConfig viewConfig = viewConfigStore.get(config.getViewName());
    if (viewConfig == null) {

      log.info("Force-adding config for /views/{}.", config.getViewName());

      viewConfigStore.add(config);
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.componentviews.config.ViewConfig

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.