Пример #1
0
  /** TODO: cache this to improve performance? */
  public AbstractContextStructureBridge getStructureBridge(Object object) {
    BridgesExtensionPointReader.initExtensions();

    for (Map.Entry<String, AbstractContextStructureBridge> entry : bridges.entrySet()) {
      // check to see if there is shadowing of content types going on.
      String shadowsContentType = getShadowedContentType(entry.getKey());
      if (shadowsContentType != null) {
        AbstractContextStructureBridge structureBridge = bridges.get(shadowsContentType);
        if (structureBridge.acceptsObject(object)) {
          return structureBridge;
        }
      }

      // no shadowing...look at actual content type
      AbstractContextStructureBridge bridge = entry.getValue();
      if (bridge != null && bridge.acceptsObject(object)) {
        return bridge;
      }
    }

    // use the default if not found
    return (defaultBridge != null && defaultBridge.acceptsObject(object))
        ? defaultBridge
        : DEFAULT_BRIDGE;
  }
Пример #2
0
  public AbstractContextStructureBridge getStructureBridge(String contentType) {
    BridgesExtensionPointReader.initExtensions();
    if (contentType != null) {
      // find the content type that shadows this one
      // if one exists.
      String shadowsContentType = getShadowedContentType(contentType);
      if (shadowsContentType != null) {
        AbstractContextStructureBridge bridge = bridges.get(shadowsContentType);
        if (bridge != null) {
          return bridge;
        }
      }

      // no shadowing of content, look at original content type
      AbstractContextStructureBridge bridge = bridges.get(contentType);
      if (bridge != null) {
        return bridge;
      }
    }
    return (defaultBridge == null) ? DEFAULT_BRIDGE : defaultBridge;
  }
Пример #3
0
 public Set<String> getContentTypes() {
   BridgesExtensionPointReader.initExtensions();
   return bridges.keySet();
 }
Пример #4
0
 public Map<String, AbstractContextStructureBridge> getStructureBridges() {
   BridgesExtensionPointReader.initExtensions();
   return bridges;
 }