public IdentityRepository[] getPluggedInIdentityRepositries() {

    IExtension[] extensions =
        Platform.getExtensionRegistry()
            .getExtensionPoint(JSchCorePlugin.ID, JSchCorePlugin.PT_IDENTITYREPOSITORY)
            .getExtensions();

    if (extensions.length == 0) return new IdentityRepository[0];

    ArrayList tmp = new ArrayList();
    for (int i = 0; i < extensions.length; i++) {
      IExtension extension = extensions[i];
      IConfigurationElement[] configs = extension.getConfigurationElements();
      if (configs.length == 0) {
        JSchCorePlugin.log(
            IStatus.ERROR,
            NLS.bind(
                "IdentityRepository {0} is missing required fields",
                (new Object[] {extension.getUniqueIdentifier()})),
            null); //$NON-NLS-1$
        continue;
      }
      try {
        IConfigurationElement config = configs[0];
        AbstractIdentityRepositoryFactory iirf =
            (AbstractIdentityRepositoryFactory)
                config.createExecutableExtension("run"); // $NON-NLS-1$
        tmp.add(iirf.create());
      } catch (CoreException ex) {
        JSchCorePlugin.log(
            IStatus.ERROR,
            NLS.bind(
                "Unable to instantiate identity repository {0}",
                (new Object[] {extension.getUniqueIdentifier()})),
            ex); //$NON-NLS-1$
      }
    }

    IdentityRepository[] repositories = new IdentityRepository[tmp.size()];
    for (int i = 0; i < tmp.size(); i++) {
      repositories[i] = (IdentityRepository) tmp.get(i);
    }
    return repositories;
  }
  private void extensionsToString(IExtension[] extensions) {
    extensionIDs = new ArrayList(extensions.length);
    for (int i = 0; i < extensions.length; i++) {
      IExtension extension = extensions[i];
      extensionIDs.add(extension.getUniqueIdentifier());

      // test navigation: to extension point
      String ownerId = extension.getExtensionPointUniqueIdentifier();
      if (extPointId != null) assertTrue(extPointId.equals(ownerId));
      // test navigation: all children
      assertTrue(validContents(extension.getConfigurationElements()));
    }
  }
 /** Initialize this nature descriptor based on the provided extension point. */
 protected void readExtension(IExtension natureExtension) throws CoreException {
   // read the extension
   id = natureExtension.getUniqueIdentifier();
   if (id == null) {
     fail(Messages.natures_missingIdentifier);
   }
   label = natureExtension.getLabel();
   IConfigurationElement[] elements = natureExtension.getConfigurationElements();
   int count = elements.length;
   ArrayList requiredList = new ArrayList(count);
   ArrayList setList = new ArrayList(count);
   ArrayList builderList = new ArrayList(count);
   ArrayList contentTypeList = new ArrayList(count);
   for (int i = 0; i < count; i++) {
     IConfigurationElement element = elements[i];
     String name = element.getName();
     if (name.equalsIgnoreCase("requires-nature")) { // $NON-NLS-1$
       String attribute = element.getAttribute("id"); // $NON-NLS-1$
       if (attribute == null) fail();
       requiredList.add(attribute);
     } else if (name.equalsIgnoreCase("one-of-nature")) { // $NON-NLS-1$
       String attribute = element.getAttribute("id"); // $NON-NLS-1$
       if (attribute == null) fail();
       setList.add(attribute);
     } else if (name.equalsIgnoreCase("builder")) { // $NON-NLS-1$
       String attribute = element.getAttribute("id"); // $NON-NLS-1$
       if (attribute == null) fail();
       builderList.add(attribute);
     } else if (name.equalsIgnoreCase("content-type")) { // $NON-NLS-1$
       String attribute = element.getAttribute("id"); // $NON-NLS-1$
       if (attribute == null) fail();
       contentTypeList.add(attribute);
     } else if (name.equalsIgnoreCase("options")) { // $NON-NLS-1$
       String attribute = element.getAttribute("allowLinking"); // $NON-NLS-1$
       // when in doubt (missing attribute, wrong value) default to allow linking
       allowLinking = !Boolean.FALSE.toString().equalsIgnoreCase(attribute);
     }
   }
   requiredNatures = (String[]) requiredList.toArray(new String[requiredList.size()]);
   natureSets = (String[]) setList.toArray(new String[setList.size()]);
   builderIds = (String[]) builderList.toArray(new String[builderList.size()]);
   contentTypeIds = (String[]) contentTypeList.toArray(new String[contentTypeList.size()]);
 }