protected ssl.resource.ssl.ISslReferenceCache getCache(org.eclipse.emf.ecore.EObject object) {
   org.eclipse.emf.ecore.EObject root =
       ssl.resource.ssl.util.SslEObjectUtil.findRootContainer(object);
   java.util.List<org.eclipse.emf.common.notify.Adapter> eAdapters = root.eAdapters();
   for (org.eclipse.emf.common.notify.Adapter adapter : eAdapters) {
     if (adapter instanceof ReferenceCache) {
       ReferenceCache cache = (ReferenceCache) adapter;
       return cache;
     }
   }
   ReferenceCache cache = new ReferenceCache();
   root.eAdapters().add(cache);
   return cache;
 }
  private String matches(
      org.eclipse.emf.ecore.EObject element, String identifier, boolean matchFuzzy) {
    // first check for attributes that have set the ID flag to true
    java.util.List<org.eclipse.emf.ecore.EStructuralFeature> features =
        element.eClass().getEStructuralFeatures();
    for (org.eclipse.emf.ecore.EStructuralFeature feature : features) {
      if (feature instanceof org.eclipse.emf.ecore.EAttribute) {
        org.eclipse.emf.ecore.EAttribute attribute = (org.eclipse.emf.ecore.EAttribute) feature;
        if (attribute.isID()) {
          Object attributeValue = element.eGet(attribute);
          String match = matches(identifier, attributeValue, matchFuzzy);
          if (match != null) {
            return match;
          }
        }
      }
    }

    // then check for an attribute that is called 'name'
    org.eclipse.emf.ecore.EStructuralFeature nameAttr =
        element.eClass().getEStructuralFeature(NAME_FEATURE);
    if (nameAttr instanceof org.eclipse.emf.ecore.EAttribute) {
      Object attributeValue = element.eGet(nameAttr);
      return matches(identifier, attributeValue, matchFuzzy);
    } else {
      // try any other string attribute found
      for (org.eclipse.emf.ecore.EAttribute stringAttribute :
          element.eClass().getEAllAttributes()) {
        if ("java.lang.String".equals(stringAttribute.getEType().getInstanceClassName())) {
          Object attributeValue = element.eGet(stringAttribute);
          String match = matches(identifier, attributeValue, matchFuzzy);
          if (match != null) {
            return match;
          }
        }
      }

      for (org.eclipse.emf.ecore.EOperation o : element.eClass().getEAllOperations()) {
        if (o.getName().toLowerCase().endsWith(NAME_FEATURE) && o.getEParameters().size() == 0) {
          String result = (String) ssl.resource.ssl.util.SslEObjectUtil.invokeOperation(element, o);
          String match = matches(identifier, result, matchFuzzy);
          if (match != null) {
            return match;
          }
        }
      }
    }
    return null;
  }
 /**
  * This standard implementation searches the tree for objects of the correct type with a name
  * attribute matching the identifier.
  */
 protected void resolve(
     String identifier,
     ContainerType container,
     org.eclipse.emf.ecore.EReference reference,
     int position,
     boolean resolveFuzzy,
     ssl.resource.ssl.ISslReferenceResolveResult<ReferenceType> result) {
   try {
     org.eclipse.emf.ecore.EClass type = reference.getEReferenceType();
     org.eclipse.emf.ecore.EObject root =
         ssl.resource.ssl.util.SslEObjectUtil.findRootContainer(container);
     // first check whether the root element matches
     boolean continueSearch = checkElement(root, type, identifier, resolveFuzzy, true, result);
     if (!continueSearch) {
       return;
     }
     // then check the contents
     for (java.util.Iterator<org.eclipse.emf.ecore.EObject> iterator = root.eAllContents();
         iterator.hasNext(); ) {
       org.eclipse.emf.ecore.EObject element = iterator.next();
       continueSearch = checkElement(element, type, identifier, resolveFuzzy, true, result);
       if (!continueSearch) {
         return;
       }
     }
     org.eclipse.emf.ecore.resource.Resource resource = container.eResource();
     if (resource != null) {
       org.eclipse.emf.common.util.URI uri = getURI(identifier, resource.getURI());
       if (uri != null) {
         org.eclipse.emf.ecore.EObject element =
             loadResource(container.eResource().getResourceSet(), uri);
         if (element == null) {
           return;
         }
         checkElement(element, type, identifier, resolveFuzzy, false, result);
       }
     }
   } catch (java.lang.RuntimeException rte) {
     // catch exception here to prevent EMF proxy resolution from swallowing it
     rte.printStackTrace();
   }
 }
 private String getName(ReferenceType element) {
   org.eclipse.emf.ecore.EStructuralFeature nameAttr =
       element.eClass().getEStructuralFeature(NAME_FEATURE);
   if (element.eIsProxy()) {
     String fragment = ((org.eclipse.emf.ecore.InternalEObject) element).eProxyURI().fragment();
     if (fragment != null
         && fragment.startsWith(
             ssl.resource.ssl.ISslContextDependentURIFragment.INTERNAL_URI_FRAGMENT_PREFIX)) {
       fragment =
           fragment.substring(
               ssl.resource.ssl.ISslContextDependentURIFragment.INTERNAL_URI_FRAGMENT_PREFIX
                   .length());
       fragment = fragment.substring(fragment.indexOf("_") + 1);
     }
     return fragment;
   } else if (nameAttr instanceof org.eclipse.emf.ecore.EAttribute) {
     return (String) element.eGet(nameAttr);
   } else {
     // try any other string attribute found
     for (org.eclipse.emf.ecore.EAttribute strAttribute : element.eClass().getEAllAttributes()) {
       if (!strAttribute.isMany()
           && strAttribute.getEType().getInstanceClassName().equals("String")) {
         return (String) element.eGet(strAttribute);
       }
     }
     for (org.eclipse.emf.ecore.EOperation o : element.eClass().getEAllOperations()) {
       if (o.getName().toLowerCase().endsWith(NAME_FEATURE) && o.getEParameters().size() == 0) {
         String result = (String) ssl.resource.ssl.util.SslEObjectUtil.invokeOperation(element, o);
         if (result != null) {
           return result;
         }
       }
     }
   }
   return null;
 }