1 AclEntryImpl synopsis
Document Sample


AclEntryImpl -- synopsis by Florian Mueller (http://fosspatents.blogspot.com -- Twitter:FOSSpatents)
Source code generated by decompilation of AclEntryImpl.class Source code shipped by Google
(jdk1.5.0.22; spaces and blank lines inserted manually) (Android "Froyo" release; spaces and blank lines inserted manually)
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel /*
Kouznetsov. * Licensed to the Apache Software Foundation (ASF)
// Jad home page: http://www.kpdus.com/jad.html under one or more
// Decompiler options: packimports(3) * contributor license agreements. See the NOTICE file
// Source File Name: AclEntryImpl.java distributed with
* this work for additional information regarding
copyright ownership.
* The ASF licenses this file to You under the Apache
License, Version 2.0
* (the "License"); you may not use this file except in
compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in
writing, software
* distributed under the License is distributed on an
"AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
* See the License for the specific language governing
permissions and
* limitations under the License.
*/
package sun.security.acl; package org.apache.harmony.security.tests.support.acl;
import java.security.Principal; import java.security.Principal;
import java.security.acl.*; import java.security.acl.*;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Vector; import java.util.Vector;
AclEntryImpl synopsis -- page 1 of 5
/**
* Additional class for verification AclEntry interface
*/
public class AclEntryImpl public class AclEntryImpl implements AclEntry {
implements AclEntry
{
private Principal user;
private Vector permissionSet;
private boolean negative;1
public AclEntryImpl(Principal principal) public AclEntryImpl(Principal principal) {
{
user = null; user = null;
permissionSet = new Vector(10, 10); permissionSet = new Vector(10, 10);
negative = false; negative = false;
user = principal; user = principal;
} }
public AclEntryImpl() public AclEntryImpl() {
{
user = null; user = null;
permissionSet = new Vector(10, 10); permissionSet = new Vector(10, 10);
negative = false; negative = false;
} }
public boolean setPrincipal(Principal principal) public boolean setPrincipal(Principal principal) {
{
if(user != null) if(user != null) {
{
return false; return false;
} else } else {
{
user = principal; user = principal;
return true; return true;
} }
} }
1 In the left column, the same three declarations appear at the end of the class definition.
AclEntryImpl synopsis -- page 2 of 5
public void setNegativePermissions() public void setNegativePermissions() {
{
negative = true; negative = true;
} }
public boolean isNegative() public boolean isNegative() {
{
return negative; return negative;
} }
public boolean addPermission(Permission permission) public boolean addPermission(Permission permission) {
{
if(permissionSet.contains(permission)) if(permissionSet.contains(permission)) {
{
return false; return false;
} else } else {
{
permissionSet.addElement(permission); permissionSet.addElement(permission);
return true; return true;
} }
} }
public boolean removePermission(Permission public boolean removePermission(Permission
permission) permission) {
{
return permissionSet.removeElement(permission); return permissionSet.removeElement(permission);
} }
public boolean checkPermission(Permission permission) public boolean checkPermission(Permission permission)
{ {
return permissionSet.contains(permission); return permissionSet.contains(permission);
} }
public Enumeration permissions() public Enumeration permissions() {
{
return permissionSet.elements(); return permissionSet.elements();
} }
AclEntryImpl synopsis -- page 3 of 5
public String toString() public String toString() {
{
StringBuffer stringbuffer = new StringBuffer(); StringBuffer stringbuffer = new StringBuffer();
if(negative) if(negative)
stringbuffer.append("-"); stringbuffer.append("-");
else else
stringbuffer.append("+"); stringbuffer.append("+");
if(user instanceof Group) if(user instanceof Group)
stringbuffer.append("Group."); stringbuffer.append("Group.");
else else
stringbuffer.append("User."); stringbuffer.append("User.");
stringbuffer.append((new stringbuffer.append((new
StringBuilder()).append(user).append("=").toString()); StringBuilder()).append(user).append("=").toString());
Enumeration enumeration = permissions(); Enumeration enumeration = permissions();
do do {
{
if(!enumeration.hasMoreElements()) if(!enumeration.hasMoreElements())
break; break;
Permission permission = Permission permission =
(Permission)enumeration.nextElement(); (Permission)enumeration.nextElement();
stringbuffer.append(permission); stringbuffer.append(permission);
if(enumeration.hasMoreElements()) if(enumeration.hasMoreElements())
stringbuffer.append(","); stringbuffer.append(",");
} while(true); } while(true);
return new String(stringbuffer); return new String(stringbuffer);
} }
public synchronized Object clone() public synchronized Object clone() {
{
AclEntryImpl aclentryimpl = new AclEntryImpl aclentryimpl = new
AclEntryImpl(user); AclEntryImpl(user);
aclentryimpl.permissionSet = aclentryimpl.permissionSet =
(Vector)permissionSet.clone(); (Vector)permissionSet.clone();
aclentryimpl.negative = negative; aclentryimpl.negative = negative;
return aclentryimpl; return aclentryimpl;
} }
AclEntryImpl synopsis -- page 4 of 5
public Principal getPrincipal() public Principal getPrincipal() {
{
return user; return user;
} }
private Principal user;
private Vector permissionSet;
private boolean negative;
} }
AclEntryImpl synopsis -- page 5 of 5
Related docs
Other docs by FlorianMueller
Apple v Samsung order to propose schedules for preliminary injunction process
Views: 404 | Downloads: 4
Lodsys patent infringement lawsuit against New York Times Co. and five other defendants
Views: 683 | Downloads: 13
Get documents about "