微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.security.acl.NotOwnerException的实例源码

项目:Openjsharp    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,an individual or a group)
 * with a set of permissions. Each principal can have at most one positive ACL entry
 * (specifying permissions to be granted to the principal) and one negative ACL entry
 * (specifying permissions to be denied). If there is already an ACL entry
 * of the same type (negative or positive) already in the ACL,false is returned.
 *
 * @param caller the principal invoking this method. It must be an owner
 *        of this ACL.
 * @param entry the ACL entry to be added to this ACL.
 * @return true on success,false if an entry of the same type (positive
 *       or negative) for the same principal is already present in this ACL.
 * @exception NotOwnerException if the caller principal is not an owner of
 *       this ACL.
 * @see java.security.Principal
 */
@Override
public boolean addEntry(Principal caller,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:Openjsharp    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,String aclFileName)
    throws UnkNownHostException,IllegalArgumentException {
    trapDestList= new Hashtable<InetAddress,Vector<String>>();
    informDestList= new Hashtable<InetAddress,Vector<String>>();

    // PrincipalImpl() take the current host as entry
    owner = new PrincipalImpl();
    try {
        acl = new Aclimpl(owner,Owner);
        AclEntry ownEntry = new AclEntryImpl(owner);
        ownEntry.addPermission(READ);
        ownEntry.addPermission(WRITE);
        acl.addEntry(owner,ownEntry);
    } catch (NotOwnerException ex) {
        if (SNMP_LOGGER.isLoggable(Level.FInesT)) {
            SNMP_LOGGER.logp(Level.FInesT,SnmpAcl.class.getName(),"SnmpAcl(String,String)","Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:Openjsharp    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,an exception is raised.
 *<P>
 * The caller principal must be an owner of the ACL in order to invoke this method.
 *
 * @param caller the principal invoking this method. It must be an owner
 *   of the ACL.
 * @param owner the owner to be removed from the list of owners.
 * @return true if successful,false if owner is already an owner.
 * @exception NotOwnerException if the caller principal is not an owner
 *   of the ACL.
 * @exception LastOwnerException if there is only one owner left,so that
 *   deleteOwner would leave the ACL owner-less.
 */
public boolean deleteOwner(Principal caller,Principal owner)
              throws NotOwnerException,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:jdk8u-jdk    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:jdk8u-jdk    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:jdk8u-jdk    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:java-cloud-filesystem-provider    文件DefaultCloudAclEntryConflictChecker.java   
/**
 * Requires that the set passed in does not use a fail-fast iterator
 */
@Override
public void mergeAcls(Principal aclOwner,CloudAclEntrySet acls) {
    // Return the current set if there is only one ACL
    if (acls.size() > 1) {
        forEachMergeableCloudAclEntry(acls,c -> {
                    try {
                        // Remove old ACL's,add new ones
                        acls.removeEntry(aclOwner,c.getEntry1());
                        acls.removeEntry(aclOwner,c.getEntry2());
                        acls.addEntry(aclOwner,mergeAcl(c));
                    } catch (NotOwnerException e) {
                        throw new RuntimeException(e);
                    }
                });
    }
}
项目:java-cloud-filesystem-provider    文件CloudAclEntrySet.java   
/**
 * Adds the ACL entry,determining if there are any conflicts and refusing to add to the set if
 * there were
 * @param aclEntry
 * @param force true if you would like to add this ACL and remove any conflicting ACL,false otherwise
 * @return If <em>force</em> was false then this returns the conflicting ACL entries and this ACL is not added.
 *          if <em>force</em> was true then this returns the conflicting ACL entries which were replaced by this
 *          new ACL entry.
 * @throws NotOwnerException 
 * @see #findConflictingAcls(CloudAclEntry)
 */
public Set<CloudAclEntry<?>> addAclEntry(Principal caller,CloudAclEntry<?> aclEntry,boolean force) throws NotOwnerException {
    checkWriteAccess(caller);
    Set<CloudAclEntry<?>> conflictingAclEntries = findConflictingAcls(aclEntry);

    if (force) {
        // Todo: This Could cause a race condition where we clear the conflicts and then add,// whilst another thread Could add another conflicting ACL entry. Consider using a R/W lock
        // for all add/delete operations as for the owners set.
        if (!conflictingAclEntries.isEmpty()) {
            aclSet.removeAll(conflictingAclEntries);
        }

        aclSet.add(aclEntry);
    } else if (conflictingAclEntries.isEmpty()) {
        aclSet.add(aclEntry);
    }

    return conflictingAclEntries;
}
项目:java-cloud-filesystem-provider    文件CloudAclEntrySet.java   
@Override
public boolean addOwner(Principal caller,Principal owner) throws NotOwnerException {
    ownersLock.readLock().lock();

    try {
        checkWriteAccess(caller);

        // Upgrade to a write lock
        ownersLock.readLock().unlock();
        ownersLock.writeLock().lock();
        boolean returnValue;

        try {
            returnValue = owners.add(owner);

            // Downgrade back to a read lock
            ownersLock.readLock().lock();
        } finally {
            ownersLock.writeLock().unlock();
        }

        return returnValue;
    } finally {
        ownersLock.readLock().unlock();
    }
}
项目:java-cloud-filesystem-provider    文件CloudAclEntrySetTest.java   
@Test
public void testCreateCloudAclEntrySetWithAUserOwnerWillNotAddTheSameOwnerMoreThanOnce() throws NotOwnerException,LastOwnerException {
    TestUserImpl user1 = new TestUserImpl("user1");
    TestUserImpl user2 = new TestUserImpl("user2");
    CloudAclEntrySet cloudAclEntrySet = new CloudAclEntrySet(Sets.newHashSet(user1,user2));
    Assert.assertTrue(cloudAclEntrySet.isOwner(user1));
    Assert.assertTrue(cloudAclEntrySet.isOwner(user2));
    Assert.assertEquals(2,cloudAclEntrySet.getowners().size());

    Assert.assertFalse(cloudAclEntrySet.addOwner(user1,user2));
    Assert.assertEquals(2,cloudAclEntrySet.getowners().size());

    TestUserImpl user3 = new TestUserImpl("user3");
    Assert.assertTrue(cloudAclEntrySet.addOwner(user1,user3));
    Assert.assertTrue(cloudAclEntrySet.isOwner(user1));
    Assert.assertTrue(cloudAclEntrySet.isOwner(user2));
    Assert.assertTrue(cloudAclEntrySet.isOwner(user3));
    Assert.assertEquals(3,cloudAclEntrySet.getowners().size());
}
项目:java-cloud-filesystem-provider    文件CloudAclEntrySetTest.java   
@Test
public void testAddAclEntryWithTheForceOptionWillForceTheConflictingEntryIntoTheSet() throws NotOwnerException {
    CloudAclEntrySet aclEntrySet = new CloudAclEntrySet(AnonymousUserPrincipal.INSTANCE,new DefaultCloudAclEntryConflictChecker());

    // Now add some entries
    CloudAclEntry<PublicPrivateCloudPermissionsprincipal> blobAccessEntry =
            new CloudAclEntryBuilder<PublicPrivateCloudPermissionsprincipal>(PublicPrivateCloudPermissionsprincipal.class)
                .setPrincipal(new PublicPrivateCloudPermissionsprincipal(BlobAccess.PRIVATE))
                .build();
    Assert.assertTrue(aclEntrySet.addEntry(AnonymousUserPrincipal.INSTANCE,blobAccessEntry));

    CloudAclEntry<PublicPrivateCloudPermissionsprincipal> blobAccessEntry2 =
            new CloudAclEntryBuilder<PublicPrivateCloudPermissionsprincipal>(PublicPrivateCloudPermissionsprincipal.class)
                .setPrincipal(new PublicPrivateCloudPermissionsprincipal(BlobAccess.PUBLIC_READ))
                .build();

    // Without the force it should keep the old entry
    Assert.assertEquals(blobAccessEntry,aclEntrySet.addAclEntry(AnonymousUserPrincipal.INSTANCE,blobAccessEntry2,false).iterator().next());
    Assert.assertEquals(blobAccessEntry,aclEntrySet.iterator().next());

    // With the force it should replace the old entry
    Assert.assertEquals(blobAccessEntry,true).iterator().next());
    Assert.assertEquals(blobAccessEntry2,aclEntrySet.iterator().next());
    Assert.assertEquals(1,aclEntrySet.size());
}
项目:java-cloud-filesystem-provider    文件CloudAclEntrySetTest.java   
@Test
public void testCloneProducesACloneEqualsToTheOriginalSet() throws NotOwnerException {
    UserPrincipal user1 = new TestUserImpl("user1");
    TestGroupImpl group1 = new TestGroupImpl("group1");
    CloudAclEntrySet acls = new CloudAclEntrySet(AnonymousUserPrincipal.INSTANCE);

    CloudAclEntry<UserPrincipal> cloudAclEntry1 = new CloudAclEntryBuilder<UserPrincipal>(UserPrincipal.class)
            .setPrincipal(user1)
            .setType(AclEntryType.DENY)
            .addPermissions(AclEntryPermission.ADD_FILE,AclEntryPermission.ADD_subdirectory)
            .build();

    CloudAclEntry<GroupPrincipal> cloudAclEntry2 = new CloudAclEntryBuilder<GroupPrincipal>(GroupPrincipal.class)
            .setPrincipal(group1)
            .setType(AclEntryType.ALLOW)
            .addPermissions(AclEntryPermission.ADD_subdirectory)
            .build();

    Assert.assertTrue(acls.addAllEntries(AnonymousUserPrincipal.INSTANCE,Arrays.asList(new CloudAclEntry<?>[] {cloudAclEntry1,cloudAclEntry2})));

    CloudAclEntrySet clone = acls.clone();
    Assert.assertEquals(acls,clone);
}
项目:java-cloud-filesystem-provider    文件CloudAclEntrySetTest.java   
@Test
public void testGetAclEntriesUsesClonedEntriesAndDoesNotModifyTheUnderlyingAclEntry() throws NotOwnerException {
    UserPrincipal user1 = new TestUserImpl("user1");
    CloudAclEntry<UserPrincipal> cloudAclEntry1 = new CloudAclEntryBuilder<UserPrincipal>(UserPrincipal.class)
            .setPrincipal(user1)
            .setType(AclEntryType.ALLOW)
            .addPermissions(AclConstants.ALL_DIRECTORY_READ_PERMISSIONS)
            .build();
    CloudAclEntrySet acls = new CloudAclEntrySet(user1,cloudAclEntry1);

    Set<CloudAclEntry<?>> aclEntries = acls.getAclEntries();
    Assert.assertEquals(1,aclEntries.size());
    CloudAclEntry<?> cloudAclEntryClone = aclEntries.stream().findFirst().get();
    Assert.assertEquals(cloudAclEntry1,cloudAclEntryClone);
    Assert.assertFalse(cloudAclEntry1 == cloudAclEntryClone);
    cloudAclEntryClone.setPermissions(AclConstants.ALL_FILE_WRITE_PERMISSIONS);
    Assert.assertEquals(AclConstants.ALL_FILE_WRITE_PERMISSIONS,cloudAclEntryClone.getPermissions());
    Assert.assertNotEquals(AclConstants.ALL_DIRECTORY_READ_PERMISSIONS,cloudAclEntryClone.getPermissions());
    Assert.assertEquals(AclConstants.ALL_DIRECTORY_READ_PERMISSIONS,cloudAclEntry1.getPermissions());
    Assert.assertNotEquals(AclConstants.ALL_FILE_WRITE_PERMISSIONS,cloudAclEntry1.getPermissions());
}
项目:jdk8u_jdk    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:jdk8u_jdk    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:jdk8u_jdk    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:lookaside_java-1.8.0-openjdk    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:lookaside_java-1.8.0-openjdk    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:lookaside_java-1.8.0-openjdk    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:infobip-open-jdk-8    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:infobip-open-jdk-8    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:infobip-open-jdk-8    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:jdk8u-dev-jdk    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:jdk8u-dev-jdk    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:jdk8u-dev-jdk    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:In-the-Box-Fork    文件NotOwnerException2Test.java   
/**
 * @tests java.security.acl.NotOwnerException#NotOwnerException()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,notes = "",method = "NotOwnerException",args = {}
)
public void test_Constructor() {
    // Test for method java.security.acl.NotOwnerException()
    try {
        throw new NotOwnerException();
    } catch (NotOwnerException e) {
        assertEquals("NotOwnerException.toString() should have been "
                + "'java.security.acl.NotOwnerException' but was "
                + e.toString(),"java.security.acl.NotOwnerException",e
                .toString());
    }
}
项目:jdk7-jdk    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,false if an entry of the same type (positive
 *       or negative) for the same principal is already present in this ACL.
 * @exception NotOwnerException if the caller principal is not an owner of
 *       this ACL.
 * @see java.security.Principal
 */
public boolean addEntry(Principal caller,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:jdk7-jdk    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:jdk7-jdk    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:openjdk-source-code-learn    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:openjdk-source-code-learn    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:openjdk-source-code-learn    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:OLD-OpenJDK8    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:OLD-OpenJDK8    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:OLD-OpenJDK8    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:openjdk-jdk7u-jdk    文件Aclimpl.java   
/**
 * Adds an ACL entry to this ACL. An entry associates a principal (e.g.,AclEntry entry)
      throws NotOwnerException {
        if (!isOwner(caller))
              throw new NotOwnerException();

        if (entryList.contains(entry))
              return false;
        /*
               for (Enumeration e = entryList.elements();e.hasMoreElements();){
               AclEntry ent = (AclEntry) e.nextElement();
               if (ent.getPrincipal().equals(entry.getPrincipal()))
               return false;
               }
               */

        entryList.addElement(entry);
        return true;
}
项目:openjdk-jdk7u-jdk    文件SnmpAcl.java   
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnkNownHostException If the local host is unkNown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner,"Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
项目:openjdk-jdk7u-jdk    文件OwnerImpl.java   
/**
 * Deletes an owner. If this is the last owner in the ACL,LastOwnerException {

      if (!ownerList.contains(caller))
        throw new NotOwnerException();

      if (!ownerList.contains(owner)){
        return false;
      } else {
        if (ownerList.size() == 1)
              throw new LastOwnerException();

        ownerList.removeElement(owner);
        return true;
      }
}
项目:incubator-netbeans    文件SPSCommonImpl.java   
@Override
public void requestPrivileges(
        final Collection<String> requestedPrivileges,boolean askForPassword) throws NotOwnerException,CancellationException {

    if (SwingUtilities.isEventdispatchThread()) {
        throw new RuntimeException("requestExecutionPrivileges " + // NOI18N
                "should never be called in AWT thread"); // NOI18N
    }

    if (askForPassword && cancelled) {
        return;
    }

    if (hasPrivileges(requestedPrivileges)) {
        return;
    }

    try {
        if (cachedPrivilegesRequestor.compute(
                new RequestPrivilegesTaskParams(this,requestedPrivileges,askForPassword)).booleanValue() == true) {
            invalidateCache();
        } else {
            throw new NotOwnerException();
        }
    } catch (InterruptedException ex) {
        Exceptions.printstacktrace(ex);
    }

}
项目:Openjsharp    文件SnmpAcl.java   
/**
 * Resets this ACL to the values contained in the configuration file.
 *
 * @exception NotOwnerException If the principal attempting the reset is not an owner of this ACL.
 * @exception UnkNownHostException If IP addresses for hosts contained in the ACL file Couldn't be found.
 */
public void rereadTheFile() throws NotOwnerException,UnkNownHostException {
    alwaysAuthorized = false;
    acl.removeAll(owner);
    trapDestList.clear();
    informDestList.clear();
    AclEntry ownEntry = new AclEntryImpl(owner);
    ownEntry.addPermission(READ);
    ownEntry.addPermission(WRITE);
    acl.addEntry(owner,ownEntry);
    readAuthorizedListFile();
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。