Package org.eclipse.equinox.security.storage

Examples of org.eclipse.equinox.security.storage.ISecurePreferences


    Checksums.appendSHA1(bld, host);
    return preferences.node(bld.toString());
  }

  private String loadSecurePassword(String login) {
    ISecurePreferences node = getPasswordNode(login);
    if(node != null)
      try {
        return node.get("password", null);
      }
      catch(StorageException e) {
      }
    return null;
  }
View Full Code Here


      }
    return null;
  }

  private void saveSecurePassword(String login, String password) {
    ISecurePreferences node = getPasswordNode(login);
    if(node != null) {
      try {
        node.put("password", password, true); //$NON-NLS-1$
      }
      catch(StorageException ex) { /* ignored on purpose */
      }
    }
  }
 
View Full Code Here

    final ID newID = IDFactory.getDefault().createLongID(value);
    return idStore.store(newID);
  }

  public void testStoreGUID() throws Exception {
    final ISecurePreferences prefs = addGUID().getPreferences();
    assertNotNull(prefs);
  }
View Full Code Here

  }

  public void testGetNamespaceNode() throws Exception {
    final ID newGUID = IDFactory.getDefault().createGUID();
    idStore.store(newGUID);
    final ISecurePreferences namespacePrefs = idStore.getNamespaceEntry(newGUID.getNamespace()).getPreferences();
    assertNotNull(namespacePrefs);
    assertTrue(namespacePrefs.name().equals(newGUID.getNamespace().getName()));
  }
View Full Code Here

  }

  public ID testStoreContainer() throws Exception {
    final IContainer container = createContainer();
    final IContainerEntry containerEntry = storeContainer(getStorableContainerAdapter(container));
    final ISecurePreferences prefs = containerEntry.getPreferences();
    assertNotNull(prefs);
    return container.getID();
  }
View Full Code Here

    INamespaceEntry[] namespaceEntries = idStore.getNamespaceEntries();
    List results = new ArrayList();
    for (int i = 0; i < namespaceEntries.length; i++) {
      IIDEntry[] idEntries = namespaceEntries[i].getIDEntries();
      for (int j = 0; j < idEntries.length; j++) {
        ISecurePreferences pref = idEntries[j].getPreferences();
        String[] names = pref.childrenNames();
        for (int k = 0; k < names.length; k++) {
          if (names[k].equals(CONTAINER_NODE_NAME))
            results.add(new ContainerEntry(idEntries[j]));
        }
      }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.ecf.storage.IContainerStore#retrieve(org.eclipse.ecf.storage.IIDEntry)
   */
  public IContainerEntry retrieve(IIDEntry idEntry) {
    Assert.isNotNull(idEntry);
    ISecurePreferences pref = idEntry.getPreferences();
    String[] names = pref.childrenNames();
    IContainerEntry result = null;
    for (int k = 0; k < names.length; k++) {
      if (names[k].equals(CONTAINER_NODE_NAME))
        result = new ContainerEntry(idEntry);
    }
View Full Code Here

  /**
   * @param idEntry
   */
  public ContainerEntry(IIDEntry idEntry) {
    this.idEntry = idEntry;
    ISecurePreferences prefs = idEntry.getPreferences();
    this.prefs = prefs.node(ContainerStore.CONTAINER_NODE_NAME);
  }
View Full Code Here

      throws IDStoreException {
    if (key == null)
      throw new IDStoreException("key cannot be null"); //$NON-NLS-1$
    if (entry == null)
      throw new IDStoreException("entry cannot be null"); //$NON-NLS-1$
    ISecurePreferences associateNode = prefs.node(key);
    ISecurePreferences prefs = entry.getPreferences();
    // This is where associates are created with form:
    // <index>:<namespace>:<idname>
    String entryAssociate = String
        .valueOf(associateNode.childrenNames().length)
        + DELIMITER
        + prefs.parent().name() + DELIMITER + prefs.name();
    associateNode.node(entryAssociate);
  }
View Full Code Here

      index = name.indexOf(DELIMITER);
      if (index == -1)
        throw new IDStoreException("Associate ID not well-formed"); //$NON-NLS-1$
      // Get namespace name before index
      String namespaceName = name.substring(0, index);
      ISecurePreferences namespacePrefs = getPreferences(
          getNamespaceRoot(), namespaceName);
      if (namespacePrefs == null)
        throw new IDStoreException(
            "Cannot find Namespace=" + namespaceName); //$NON-NLS-1$
      // Get ID name after index
      String idName = name.substring(index + 1);
      ISecurePreferences idPrefs = getPreferences(namespacePrefs, idName);
      if (idPrefs == null)
        throw new IDStoreException(
            "ID="  + idName + " not found in Namespace=" + namespaceName); //$NON-NLS-1$ //$NON-NLS-2$
      // Put new IDEntry in sorted collection ordered by resultIndex
      results.put(resultIndex, new IDEntry(idPrefs));
View Full Code Here

TOP

Related Classes of org.eclipse.equinox.security.storage.ISecurePreferences

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.