[picketbox] Initial import (#801680)
Ricardo Arguello
ricardo at fedoraproject.org
Fri Mar 23 15:24:22 UTC 2012
commit 339346b46f0d6c1ed5efceffebd852c9919acfbb
Author: Ricardo Arguello <ricardo at fedoraproject.org>
Date: Fri Mar 23 10:23:55 2012 -0500
Initial import (#801680)
.gitignore | 1 +
picketbox-4.0.6.final-assembly.patch | 27 ++
picketbox-4.0.6.final-pom.patch | 143 +++++++
picketbox-4.0.6.final-pom.xml | 7 +
picketbox-4.0.6.final-ugly.patch | 780 ++++++++++++++++++++++++++++++++++
picketbox.spec | 174 ++++++++
sources | 1 +
7 files changed, 1133 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..32172c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/picketbox-4.0.6.final.tar.xz
diff --git a/picketbox-4.0.6.final-assembly.patch b/picketbox-4.0.6.final-assembly.patch
new file mode 100644
index 0000000..d49d6d1
--- /dev/null
+++ b/picketbox-4.0.6.final-assembly.patch
@@ -0,0 +1,27 @@
+diff -Naur picketbox-4.0.6.final/assembly/bin.xml picketbox-4.0.6.final-work/assembly/bin.xml
+--- picketbox-4.0.6.final/assembly/bin.xml 2011-01-21 10:10:44.000000000 -0500
++++ picketbox-4.0.6.final-work/assembly/bin.xml 2012-01-27 14:52:24.037000285 -0500
+@@ -1,4 +1,5 @@
+ <assembly>
++ <id>bin</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+diff -Naur picketbox-4.0.6.final/security-jboss-sx/assembly/src/assembly/bin.xml picketbox-4.0.6.final-work/security-jboss-sx/assembly/src/assembly/bin.xml
+--- picketbox-4.0.6.final/security-jboss-sx/assembly/src/assembly/bin.xml 2011-01-21 10:10:44.000000000 -0500
++++ picketbox-4.0.6.final-work/security-jboss-sx/assembly/src/assembly/bin.xml 2012-01-27 14:47:26.217000324 -0500
+@@ -1,4 +1,5 @@
+ <assembly>
++ <id>bin</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+diff -Naur picketbox-4.0.6.final/security-spi/assembly/bin.xml picketbox-4.0.6.final-work/security-spi/assembly/bin.xml
+--- picketbox-4.0.6.final/security-spi/assembly/bin.xml 2010-02-09 12:42:37.000000000 -0500
++++ picketbox-4.0.6.final-work/security-spi/assembly/bin.xml 2012-01-27 14:46:29.435999840 -0500
+@@ -1,4 +1,5 @@
+ <assembly>
++ <id>bin</id>
+ <formats>
+ <format>jar</format>
+ </formats>
diff --git a/picketbox-4.0.6.final-pom.patch b/picketbox-4.0.6.final-pom.patch
new file mode 100644
index 0000000..d9ca177
--- /dev/null
+++ b/picketbox-4.0.6.final-pom.patch
@@ -0,0 +1,143 @@
+diff -Naur picketbox-4.0.6.final/picketbox/pom.xml picketbox-4.0.6.final-work/picketbox/pom.xml
+--- picketbox-4.0.6.final/picketbox/pom.xml 2012-01-25 19:27:46.000000000 +0100
++++ picketbox-4.0.6.final-work/picketbox/pom.xml 2012-01-27 20:50:28.000000000 +0100
+@@ -59,8 +59,8 @@
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+- <artifactId>jboss-logging-spi</artifactId>
+- <version>2.1.1.GA</version>
++ <artifactId>jboss-logging</artifactId>
++ <version>3.1.0.CR1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+diff -Naur picketbox-4.0.6.final/picketbox-infinispan/pom.xml picketbox-4.0.6.final-work/picketbox-infinispan/pom.xml
+--- picketbox-4.0.6.final/picketbox-infinispan/pom.xml 2012-01-25 19:27:46.000000000 +0100
++++ picketbox-4.0.6.final-work/picketbox-infinispan/pom.xml 2012-01-31 19:28:08.000000000 +0100
+@@ -33,7 +33,7 @@
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+- <artifactId>jboss-logging-spi</artifactId>
++ <artifactId>jboss-logging</artifactId>
+ <version>2.1.1.GA</version>
+ <scope>compile</scope>
+ </dependency>
+diff -Naur picketbox-4.0.6.final/security-jboss-sx/acl/pom.xml picketbox-4.0.6.final-work/security-jboss-sx/acl/pom.xml
+--- picketbox-4.0.6.final/security-jboss-sx/acl/pom.xml 2012-01-25 19:27:46.000000000 +0100
++++ picketbox-4.0.6.final-work/security-jboss-sx/acl/pom.xml 2012-01-27 18:51:27.000000000 +0100
+@@ -51,26 +51,14 @@
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+- <artifactId>jboss-logging-spi</artifactId>
++ <artifactId>jboss-logging</artifactId>
+ </dependency>
+ <dependency>
+- <groupId>org.hibernate</groupId>
+- <artifactId>hibernate</artifactId>
+- <version>3.2.4.sp1</version>
++ <groupId>org.hibernate.javax.persistence</groupId>
++ <artifactId>hibernate-jpa-2.0-api</artifactId>
++ <version>1.0.1.Final</version>
+ <scope>compile</scope>
+- </dependency>
+- <dependency>
+- <groupId>org.hibernate</groupId>
+- <artifactId>hibernate-annotations</artifactId>
+- <version>3.3.0.ga</version>
+- <scope>compile</scope>
+- </dependency>
+- <dependency>
+- <groupId>org.hibernate</groupId>
+- <artifactId>hibernate-entitymanager</artifactId>
+- <version>3.3.1.ga</version>
+- <scope>compile</scope>
+- </dependency>
++ </dependency>
+ <dependency>
+ <groupId>org.picketbox</groupId>
+ <artifactId>authorization-spi</artifactId>
+diff -Naur picketbox-4.0.6.final/security-jboss-sx/jbosssx/pom.xml picketbox-4.0.6.final-work/security-jboss-sx/jbosssx/pom.xml
+--- picketbox-4.0.6.final/security-jboss-sx/jbosssx/pom.xml 2012-01-25 19:27:46.000000000 +0100
++++ picketbox-4.0.6.final-work/security-jboss-sx/jbosssx/pom.xml 2012-01-27 20:43:31.000000000 +0100
+@@ -111,7 +111,7 @@
+ </build>
+ <dependencies>
+ <dependency>
+- <groupId>oswego-concurrent</groupId>
++ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <scope>compile</scope>
+ </dependency>
+@@ -157,24 +157,27 @@
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+- <groupId>org.jboss.javaee</groupId>
+- <artifactId>jboss-javaee</artifactId>
+- <version>5.0.0.GA</version>
+- <scope>compile</scope>
+- <exclusions>
+- <exclusion>
+- <groupId>sun-jaxb</groupId>
+- <artifactId>jaxb-api</artifactId>
+- </exclusion>
+- </exclusions>
+- </dependency>
+- <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbossxacml</artifactId>
+ <version>2.0.4</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
++ <groupId>org.jboss.spec.javax.security.jacc</groupId>
++ <artifactId>jboss-jacc-api_1.4_spec</artifactId>
++ <version>1.0.1.Final</version>
++ </dependency>
++ <dependency>
++ <groupId>org.jboss.spec.javax.transaction</groupId>
++ <artifactId>jboss-transaction-api_1.1_spec</artifactId>
++ <version>1.0.0.Final</version>
++ </dependency>
++ <dependency>
++ <groupId>org.jboss.spec.javax.resource</groupId>
++ <artifactId>jboss-connector-api_1.6_spec</artifactId>
++ <version>1.0.0.Final</version>
++ </dependency>
++ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jnpserver</artifactId>
+ <version>4.2.3.GA</version>
+diff -Naur picketbox-4.0.6.final/security-spi/parent/pom.xml picketbox-4.0.6.final-work/security-spi/parent/pom.xml
+--- picketbox-4.0.6.final/security-spi/parent/pom.xml 2012-01-25 19:27:46.000000000 +0100
++++ picketbox-4.0.6.final-work/security-spi/parent/pom.xml 2012-03-01 10:37:47.457000037 +0100
+@@ -100,9 +100,9 @@
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+- <groupId>javax.servlet</groupId>
+- <artifactId>servlet-api</artifactId>
+- <version>2.5</version>
++ <groupId>org.jboss.spec.javax.servlet</groupId>
++ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
++ <version>1.0.0.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+diff -Naur picketbox-4.0.6.final/security-spi/spi/pom.xml picketbox-4.0.6.final-work/security-spi/spi/pom.xml
+--- picketbox-4.0.6.final/security-spi/spi/pom.xml 2012-01-25 19:27:46.000000000 +0100
++++ picketbox-4.0.6.final-work/security-spi/spi/pom.xml 2012-03-01 10:36:43.174000005 +0100
+@@ -50,8 +50,8 @@
+ <artifactId>authorization-spi</artifactId>
+ </dependency>
+ <dependency>
+- <groupId>javax.servlet</groupId>
+- <artifactId>servlet-api</artifactId>
++ <groupId>org.jboss.spec.javax.servlet</groupId>
++ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
diff --git a/picketbox-4.0.6.final-pom.xml b/picketbox-4.0.6.final-pom.xml
new file mode 100644
index 0000000..5c64409
--- /dev/null
+++ b/picketbox-4.0.6.final-pom.xml
@@ -0,0 +1,7 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.picketbox</groupId>
+ <artifactId>picketbox</artifactId>
+ <version>4.0.6.final</version>
+</project>
+
diff --git a/picketbox-4.0.6.final-ugly.patch b/picketbox-4.0.6.final-ugly.patch
new file mode 100644
index 0000000..19c843e
--- /dev/null
+++ b/picketbox-4.0.6.final-ugly.patch
@@ -0,0 +1,780 @@
+diff -Naur picketbox-4.0.6.final/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java picketbox-4.0.6.final-work/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java
+--- picketbox-4.0.6.final/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java 2011-10-28 19:19:53.000000000 -0400
++++ picketbox-4.0.6.final-work/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLEntryImpl.java 1969-12-31 19:00:00.000000000 -0500
+@@ -1,232 +0,0 @@
+-/*
+- * JBoss, Home of Professional Open Source
+- * Copyright 2005, JBoss Inc., and individual contributors as indicated
+- * by the @authors tag. See the copyright.txt in the distribution for a
+- * full listing of individual contributors.
+- *
+- * This is free software; you can redistribute it and/or modify it
+- * under the terms of the GNU Lesser General Public License as
+- * published by the Free Software Foundation; either version 2.1 of
+- * the License, or (at your option) any later version.
+- *
+- * This software is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * Lesser General Public License for more details.
+- *
+- * You should have received a copy of the GNU Lesser General Public
+- * License along with this software; if not, write to the Free
+- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+- */
+-package org.jboss.security.acl;
+-
+-import java.io.Serializable;
+-
+-import javax.persistence.Entity;
+-import javax.persistence.GeneratedValue;
+-import javax.persistence.Id;
+-import javax.persistence.ManyToOne;
+-import javax.persistence.PostLoad;
+-import javax.persistence.PrePersist;
+-import javax.persistence.Table;
+-import javax.persistence.Transient;
+-
+-import org.jboss.security.ErrorCodes;
+-import org.jboss.security.identity.Identity;
+-
+-/**
+- * <p>
+- * This class represents an entry in the Access Control List (ACL), and associates a permission to an identity. This
+- * implementation only stores permissions of type {@code BitMaskPermission}, and can also only check permissions of
+- * that type.
+- * </p>
+- *
+- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+- */
+- at Entity
+- at Table(name = "ACL_ENTRY")
+-public class ACLEntryImpl implements ACLEntry, Serializable
+-{
+- private static final long serialVersionUID = -2985214023383451768L;
+-
+- @Id
+- @GeneratedValue
+- private long entryID;
+-
+- @Transient
+- private BitMaskPermission permission;
+-
+- /* persist only the bitmask */
+- private int bitMask;
+-
+- @Transient
+- private Identity identity;
+-
+- /* persist the string representation of the identity or role */
+- private String identityOrRole;
+-
+- @ManyToOne
+- private ACLImpl acl;
+-
+- /**
+- * <p>
+- * Builds an instance of {@code ACLEntryImpl}. This constructor is required by the JPA specification.
+- * </p>
+- */
+- ACLEntryImpl()
+- {
+- }
+-
+- /**
+- * <p>
+- * Builds an instance of {@code ACLEntryImpl} with the specified permission and identity.
+- * </p>
+- *
+- * @param permission the {@code ACLPermission} granted to the associated identity.
+- * @param identity the {@code Identity} for which the permission is being granted.
+- */
+- public ACLEntryImpl(BitMaskPermission permission, Identity identity)
+- {
+- this.permission = permission;
+- this.identity = identity;
+- this.identityOrRole = identity.getName();
+- }
+-
+- /**
+- * <p>
+- * Builds an instance of {@code ACLEntryImpl} with the specified permission and identity/role name.
+- * </p>
+- *
+- * @param permission the {@code ACLPermission} granted to the associated identity.
+- * @param identityOrRole a {@code String} representing the identity or role name.
+- */
+- public ACLEntryImpl(BitMaskPermission permission, String identityOrRole)
+- {
+- this.permission = permission;
+- this.identityOrRole = identityOrRole;
+- }
+-
+- /**
+- * <p>
+- * Obtains the persistent id of this {@code ACLEntryImpl}.
+- * </p>
+- *
+- * @return a {@code long} representing the persistent id this entry.
+- */
+- public long getACLEntryId()
+- {
+- return this.entryID;
+- }
+-
+- /**
+- * <p>
+- * Method called by the JPA layer before persisting the fields.
+- * </p>
+- */
+- @PrePersist
+- @SuppressWarnings("unused")
+- private void setPersistentFields()
+- {
+- if (this.permission != null)
+- this.bitMask = this.permission.getMaskValue();
+- }
+-
+- /**
+- * <p>
+- * Method called by the JPA layer after loading the persisted object.
+- * </p>
+- */
+- @PostLoad
+- @SuppressWarnings("unused")
+- private void loadState()
+- {
+- if (this.permission != null)
+- throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "ACLEntry permission has already been set");
+- this.permission = new CompositeACLPermission(this.bitMask);
+- }
+-
+- public ACLImpl getAcl()
+- {
+- return this.acl;
+- }
+-
+- public void setAcl(ACLImpl acl)
+- {
+- this.acl = acl;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACLEntry#getIdentityOrRole()
+- */
+- public String getIdentityOrRole()
+- {
+- return this.identityOrRole;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACLEntry#getIdentity()
+- */
+- public Identity getIdentity()
+- {
+- return this.identity;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACLEntry#getPermission()
+- */
+- public ACLPermission getPermission()
+- {
+- return this.permission;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACLEntry#checkPermission(org.jboss.security.acl.ACLPermission)
+- */
+- public boolean checkPermission(ACLPermission permission)
+- {
+- if (!(permission instanceof BitMaskPermission))
+- return false;
+- BitMaskPermission bitmaskPermission = (BitMaskPermission) permission;
+- // an empty permission is always part of another permission.
+- if (bitmaskPermission.getMaskValue() == 0)
+- return true;
+- // simple implementation: if all bits match, return true.
+- return (this.permission.getMaskValue() & bitmaskPermission.getMaskValue()) == bitmaskPermission.getMaskValue();
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see java.lang.Object#equals(java.lang.Object)
+- */
+- @Override
+- public boolean equals(Object obj)
+- {
+- if (obj instanceof ACLEntryImpl)
+- {
+- ACLEntryImpl entry = (ACLEntryImpl) obj;
+- return this.identityOrRole.equals(entry.identityOrRole);
+- }
+- return false;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see java.lang.Object#hashCode()
+- */
+- @Override
+- public int hashCode()
+- {
+- return this.identityOrRole.hashCode();
+- }
+-}
+diff -Naur picketbox-4.0.6.final/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java picketbox-4.0.6.final-work/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java
+--- picketbox-4.0.6.final/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java 2011-10-28 19:19:53.000000000 -0400
++++ picketbox-4.0.6.final-work/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/ACLImpl.java 1969-12-31 19:00:00.000000000 -0500
+@@ -1,279 +0,0 @@
+-/*
+- * JBoss, Home of Professional Open Source
+- * Copyright 2005, JBoss Inc., and individual contributors as indicated
+- * by the @authors tag. See the copyright.txt in the distribution for a
+- * full listing of individual contributors.
+- *
+- * This is free software; you can redistribute it and/or modify it
+- * under the terms of the GNU Lesser General Public License as
+- * published by the Free Software Foundation; either version 2.1 of
+- * the License, or (at your option) any later version.
+- *
+- * This software is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * Lesser General Public License for more details.
+- *
+- * You should have received a copy of the GNU Lesser General Public
+- * License along with this software; if not, write to the Free
+- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+- */
+-package org.jboss.security.acl;
+-
+-import java.io.Serializable;
+-import java.util.ArrayList;
+-import java.util.Collection;
+-import java.util.Collections;
+-import java.util.HashMap;
+-import java.util.Map;
+-
+-import javax.persistence.CascadeType;
+-import javax.persistence.Column;
+-import javax.persistence.Entity;
+-import javax.persistence.FetchType;
+-import javax.persistence.GeneratedValue;
+-import javax.persistence.Id;
+-import javax.persistence.OneToMany;
+-import javax.persistence.Table;
+-import javax.persistence.Transient;
+-
+-import org.hibernate.annotations.Cascade;
+-import org.jboss.security.ErrorCodes;
+-import org.jboss.security.authorization.Resource;
+-import org.jboss.security.identity.Identity;
+-
+-/**
+- * <p>
+- * Simple ACL implementation that keeps the entries in a Map whose keys are the identities of the entries, to provide
+- * fast access.
+- * </p>
+- *
+- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+- */
+- at Entity
+- at Table(name = "ACL")
+-public class ACLImpl implements ACL, Serializable
+-{
+- private static final long serialVersionUID = -6390609071167528812L;
+-
+- @Id
+- @GeneratedValue
+- private long aclID;
+-
+- @Transient
+- private Resource resource;
+-
+- @Column(name = "resource")
+- private String resourceAsString;
+-
+- @Transient
+- private Map<String, ACLEntry> entriesMap;
+-
+- @OneToMany(mappedBy = "acl", fetch = FetchType.EAGER, cascade =
+- {CascadeType.REMOVE, CascadeType.PERSIST})
+- @Cascade(
+- {org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
+- private Collection<ACLEntryImpl> entries;
+-
+- /**
+- * <p>
+- * Builds an instance of {@code ACLImpl}. This constructor is required by the JPA specification.
+- * </p>
+- */
+- ACLImpl()
+- {
+- }
+-
+- /**
+- * <p>
+- * Builds an instance of {@code ACLImpl} for the specified resource.
+- * </p>
+- *
+- * @param resource a reference to the {@code Resource} associated with the ACL being constructed.
+- */
+- public ACLImpl(Resource resource)
+- {
+- this(resource, new ArrayList<ACLEntry>());
+- }
+-
+- /**
+- * <p>
+- * Builds an instance of {@code ACLImpl} for the specified resource, and initialize it with the specified entries.
+- * </p>
+- *
+- * @param resource a reference to the {@code Resource} associated with the ACL being constructed.
+- * @param entries a {@code Collection} containing the ACL's initial entries.
+- */
+- public ACLImpl(Resource resource, Collection<ACLEntry> entries)
+- {
+- this(Util.getResourceAsString(resource), entries);
+- this.resource = resource;
+- }
+-
+- public ACLImpl(String resourceString, Collection<ACLEntry> entries)
+- {
+- this.resourceAsString = resourceString;
+- this.entries = new ArrayList<ACLEntryImpl>();
+- if (entries != null)
+- {
+- for (ACLEntry entry : entries)
+- {
+- ACLEntryImpl entryImpl = (ACLEntryImpl) entry;
+- entryImpl.setAcl(this);
+- this.entries.add(entryImpl);
+- }
+- }
+- this.initEntriesMap();
+- }
+-
+- /**
+- * <p>
+- * Obtains the persistent id of this {@code ACLImpl}.
+- * </p>
+- *
+- * @return a {@code long} representing the persistent id this ACL.
+- */
+- public long getACLId()
+- {
+- return this.aclID;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACL#addEntry(org.jboss.security.acl.ACLEntry)
+- */
+- public boolean addEntry(ACLEntry entry)
+- {
+- if (this.entriesMap == null)
+- this.initEntriesMap();
+-
+- // don't add a null entry or an entry that already existSELECT * FROM ACL_ENTRYs.
+- if (entry == null || this.entriesMap.get(entry.getIdentityOrRole()) != null)
+- return false;
+- this.entries.add((ACLEntryImpl) entry);
+- ((ACLEntryImpl) entry).setAcl(this);
+- this.entriesMap.put(entry.getIdentityOrRole(), entry);
+- return true;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACL#removeEntry(org.jboss.security.acl.ACLEntry)
+- */
+- public boolean removeEntry(ACLEntry entry)
+- {
+- if (this.entriesMap == null)
+- this.initEntriesMap();
+- this.entriesMap.remove(entry.getIdentityOrRole());
+- return this.entries.remove(entry);
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACL#getEntries()
+- */
+- public Collection<? extends ACLEntry> getEntries()
+- {
+- if (this.entriesMap == null)
+- this.initEntriesMap();
+- return Collections.unmodifiableCollection(this.entries);
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACL#getEntry(org.jboss.security.identity.Identity)
+- */
+- public ACLEntry getEntry(Identity identity)
+- {
+- if (this.entriesMap == null)
+- this.initEntriesMap();
+- return this.entriesMap.get(identity.getName());
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACL#getEntry(java.lang.String)
+- */
+- public ACLEntry getEntry(String identityOrRole)
+- {
+- if (this.entriesMap == null)
+- this.initEntriesMap();
+- return this.entriesMap.get(identityOrRole);
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACL#isGranted(org.jboss.security.acl.ACLPermission,
+- * org.jboss.security.identity.Identity)
+- */
+- public boolean isGranted(ACLPermission permission, Identity identity)
+- {
+- if (this.entriesMap == null)
+- this.initEntriesMap();
+-
+- // lookup the entry corresponding to the specified identity.
+- ACLEntry entry = this.entriesMap.get(identity.getName());
+- if (entry != null)
+- {
+- // check the permission associated with the identity.
+- return entry.checkPermission(permission);
+- }
+- return false;
+- }
+-
+- /**
+- * <p>
+- * Obtains the stringfied representation of the resource associated with this {@code ACL}.
+- * </p>
+- *
+- * @return a {@code String} representation of the resource.
+- */
+- public String getResourceAsString()
+- {
+- return this.resourceAsString;
+- }
+-
+- /*
+- * (non-Javadoc)
+- *
+- * @see org.jboss.security.acl.ACL#getResource()
+- */
+- public Resource getResource()
+- {
+- return this.resource;
+- }
+-
+- /**
+- * <p>
+- * Sets the resource associated with this {@code ACL}.
+- * </p>
+- *
+- * @param resource a reference to the {@code Resource} associated with this {@code ACL}.
+- */
+- public void setResource(Resource resource)
+- {
+- if (this.resource != null)
+- throw new IllegalStateException(ErrorCodes.PROCESSING_FAILED + "ACL resource has already been set");
+- this.resource = resource;
+- }
+-
+- /**
+- * <p>
+- * Initializes the entries map of this {@code ACL} instance.
+- * </p>
+- */
+- private void initEntriesMap()
+- {
+- this.entriesMap = new HashMap<String, ACLEntry>();
+- for (ACLEntry entry : this.entries)
+- this.entriesMap.put(entry.getIdentityOrRole(), entry);
+- }
+-
+-}
+diff -Naur picketbox-4.0.6.final/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java picketbox-4.0.6.final-work/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java
+--- picketbox-4.0.6.final/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java 2011-10-28 19:19:53.000000000 -0400
++++ picketbox-4.0.6.final-work/security-jboss-sx/acl/src/main/java/org/jboss/security/acl/JPAPersistenceStrategy.java 1969-12-31 19:00:00.000000000 -0500
+@@ -1,257 +0,0 @@
+-package org.jboss.security.acl;
+-
+-import java.util.ArrayList;
+-import java.util.Collection;
+-import java.util.HashMap;
+-import java.util.Map;
+-
+-import javax.persistence.EntityManager;
+-import javax.persistence.EntityManagerFactory;
+-import javax.persistence.EntityTransaction;
+-import javax.persistence.NoResultException;
+-import javax.persistence.Persistence;
+-
+-import org.jboss.security.ErrorCodes;
+-import org.jboss.security.authorization.Resource;
+-
+-/**
+- * <p>
+- * Implementation of {@code ACLPersistenceStrategy} that uses the Java Persistence API (JPA) to
+- * persist the {@code ACL}s.
+- * </p>
+- *
+- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+- */
+-public class JPAPersistenceStrategy implements ACLPersistenceStrategy
+-{
+-
+- // in memory cache of the created ACLs.
+- private final Map<Resource, ACL> aclMap;
+-
+- private final EntityManagerFactory managerFactory;
+-
+- private final ACLResourceFactory resourceFactory;
+-
+- public JPAPersistenceStrategy()
+- {
+- this(null);
+- }
+-
+- public JPAPersistenceStrategy(ACLResourceFactory resourceFactory)
+- {
+- this.aclMap = new HashMap<Resource, ACL>();
+- this.managerFactory = Persistence.createEntityManagerFactory("ACL");
+- this.resourceFactory = resourceFactory;
+- }
+-
+- /*
+- * (non-Javadoc)
+- * @see org.jboss.security.acl.ACLProvider#createACL(org.jboss.security.authorization.Resource)
+- */
+- public ACL createACL(Resource resource)
+- {
+- return this.createACL(resource, new ArrayList<ACLEntry>());
+- }
+-
+- /*
+- * (non-Javadoc)
+- * @see org.jboss.security.acl.ACLProvider#createACL(org.jboss.security.authorization.Resource, java.util.Collection)
+- */
+- public ACL createACL(Resource resource, Collection<ACLEntry> entries)
+- {
+- if (resource == null)
+- throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "ACLs cannot be created for null resources");
+-
+- // check the cache first.
+- ACL acl = this.aclMap.get(resource);
+- if (acl == null)
+- {
+- EntityManager entityManager = this.managerFactory.createEntityManager();
+- EntityTransaction transaction = entityManager.getTransaction();
+- transaction.begin();
+- try
+- {
+- // create a new ACL and persist it to the database.
+- acl = new ACLImpl(resource, entries);
+- entityManager.persist(acl);
+- // add the newly-created ACL to the cache.
+- this.aclMap.put(resource, acl);
+- transaction.commit();
+- }
+- catch (RuntimeException re)
+- {
+- re.printStackTrace();
+- transaction.rollback();
+- }
+- finally
+- {
+- entityManager.close();
+- }
+- }
+- return acl;
+- }
+-
+- /*
+- * (non-Javadoc)
+- * @see org.jboss.security.acl.ACLProvider#removeACL(org.jboss.security.acl.ACL)
+- */
+- public boolean removeACL(ACL acl)
+- {
+- return this.removeACL(acl.getResource());
+- }
+-
+- /*
+- * (non-Javadoc)
+- * @see org.jboss.security.acl.ACLProvider#removeACL(org.jboss.security.authorization.Resource)
+- */
+- public boolean removeACL(Resource resource)
+- {
+- boolean result = false;
+-
+- EntityManager entityManager = this.managerFactory.createEntityManager();
+- EntityTransaction transaction = entityManager.getTransaction();
+- transaction.begin();
+- try
+- {
+- // find the ACL associated with the specified resource and remove it from the database.
+- ACL acl = this.findACLByResource(resource, entityManager);
+- if (acl != null)
+- {
+- entityManager.remove(acl);
+- // remove the ACL from the cache.
+- result = this.aclMap.remove(resource) != null;
+- }
+- transaction.commit();
+- }
+- catch (RuntimeException re)
+- {
+- re.printStackTrace();
+- transaction.rollback();
+- }
+- finally
+- {
+- entityManager.close();
+- }
+- return result;
+- }
+-
+- /*
+- * (non-Javadoc)
+- * @see org.jboss.security.acl.ACLProvider#getACL(org.jboss.security.authorization.Resource)
+- */
+- public ACL getACL(Resource resource)
+- {
+- // check the cache first.
+- ACL acl = this.aclMap.get(resource);
+- if (acl == null)
+- {
+- EntityManager entityManager = this.managerFactory.createEntityManager();
+- try
+- {
+- acl = this.findACLByResource(resource, entityManager);
+- if (acl != null)
+- this.aclMap.put(resource, acl);
+- }
+- finally
+- {
+- entityManager.close();
+- }
+- }
+- return acl;
+- }
+-
+- /*
+- * (non-Javadoc)
+- * @see org.jboss.security.acl.ACLPersistenceStrategy#getACLs()
+- */
+- @SuppressWarnings("unchecked")
+- public Collection<ACL> getACLs()
+- {
+- Collection<ACL> acls = null;
+- EntityManager entityManager = this.managerFactory.createEntityManager();
+- try
+- {
+- acls = entityManager.createQuery("SELECT a FROM ACLImpl a").getResultList();
+- if (acls != null && this.resourceFactory != null)
+- {
+- for (ACL acl : acls)
+- {
+- ACLImpl impl = (ACLImpl) acl;
+- String[] resourceName = impl.getResourceAsString().split(":");
+- impl.setResource(this.resourceFactory.instantiateResource(resourceName[0], resourceName[1]));
+- }
+- }
+- }
+- finally
+- {
+- entityManager.close();
+- }
+- return acls;
+- }
+-
+- /*
+- * (non-Javadoc)
+- * @see org.jboss.security.acl.ACLProvider#updateACL(org.jboss.security.acl.ACL)
+- */
+- public boolean updateACL(ACL acl)
+- {
+- if (((ACLImpl) acl).getACLId() == 0)
+- return false;
+-
+- EntityManager entityManager = this.managerFactory.createEntityManager();
+- EntityTransaction transaction = entityManager.getTransaction();
+- transaction.begin();
+- try
+- {
+- for (ACLEntry entry : acl.getEntries())
+- {
+- // persist the new entries that might have been added to the ACL.
+- ACLEntryImpl entryImpl = (ACLEntryImpl) entry;
+- if (entryImpl.getACLEntryId() == 0)
+- entityManager.persist(entryImpl);
+- }
+- // merge will take care of the entries that might have been removed.
+- entityManager.merge(acl);
+- // update the cache.
+- this.aclMap.put(acl.getResource(), acl);
+- transaction.commit();
+- return true;
+- }
+- catch (RuntimeException re)
+- {
+- re.printStackTrace();
+- transaction.rollback();
+- }
+- finally
+- {
+- entityManager.close();
+- }
+- return false;
+- }
+-
+- /**
+- * <p>
+- * Searches the database for the {@code ACL} associated with the specified resource.
+- * </p>
+- *
+- * @param resource the {@code Resource} that is associated with the {@code ACL} being searched.
+- * @param entityManager the {@code EntityManager} used to search the database.
+- * @return the {@code ACL} retrieved from the database, or {@code null} if no {@code ACL} could be found.
+- */
+- private ACLImpl findACLByResource(Resource resource, EntityManager entityManager)
+- {
+- ACLImpl acl = null;
+- try
+- {
+- acl = (ACLImpl) entityManager.createQuery(
+- "SELECT a FROM ACLImpl a WHERE a.resourceAsString LIKE '" + Util.getResourceAsString(resource) + "'")
+- .getSingleResult();
+- acl.setResource(resource);
+- }
+- catch (NoResultException nre)
+- {
+- // ignore the exception when no ACL could be found for the given resource.
+- }
+- return acl;
+- }
+-}
diff --git a/picketbox.spec b/picketbox.spec
new file mode 100644
index 0000000..f494317
--- /dev/null
+++ b/picketbox.spec
@@ -0,0 +1,174 @@
+%global namedreltag .final
+%global namedversion %{version}%{?namedreltag}
+
+Name: picketbox
+Version: 4.0.6
+Release: 4%{?dist}
+Summary: Security framework for Java Applications
+Group: Development/Libraries
+License: LGPLv2+
+URL: http://www.jboss.org/picketbox
+
+# svn export http://anonsvn.jboss.org/repos/picketbox/tags/4.0.6.final/ picketbox-4.0.6.final
+# tar cafJ picketbox-4.0.6.final.tar.xz picketbox-4.0.6.final
+Source0: %{name}-%{namedversion}.tar.xz
+Source1: %{name}-%{namedversion}-pom.xml
+
+Patch0: %{name}-%{namedversion}-assembly.patch
+Patch1: %{name}-%{namedversion}-pom.patch
+# REMOVE THIS! (at some point)
+Patch2: %{name}-%{namedversion}-ugly.patch
+
+BuildArch: noarch
+
+BuildRequires: concurrent
+BuildRequires: hibernate-jpa-2.0-api >= 1.0.1-5
+BuildRequires: hsqldb
+BuildRequires: infinispan
+BuildRequires: javacc-maven-plugin
+BuildRequires: java-devel
+BuildRequires: jboss-connector-1.6-api
+BuildRequires: jboss-jacc-1.4-api
+BuildRequires: jboss-jaspi-1.0-api
+BuildRequires: jboss-parent
+BuildRequires: jboss-servlet-3.0-api
+BuildRequires: jboss-transaction-1.1-api
+BuildRequires: jpackage-utils
+BuildRequires: maven
+BuildRequires: maven-compiler-plugin
+BuildRequires: maven-injection-plugin
+BuildRequires: maven-install-plugin
+BuildRequires: maven-jar-plugin
+BuildRequires: maven-javadoc-plugin
+BuildRequires: maven-release-plugin
+BuildRequires: maven-resources-plugin
+BuildRequires: maven-surefire-plugin
+BuildRequires: picketbox-commons
+BuildRequires: picketbox-xacml
+
+Requires: concurrent
+Requires: hibernate-jpa-2.0-api >= 1.0.1-5
+Requires: hsqldb
+Requires: infinispan
+Requires: java
+Requires: jboss-connector-1.6-api
+Requires: jboss-jacc-1.4-api
+Requires: jboss-jaspi-1.0-api
+Requires: jboss-servlet-3.0-api
+Requires: jboss-transaction-1.1-api
+Requires: jpackage-utils
+Requires: picketbox
+Requires: picketbox-xacml
+
+%description
+Java Security Framework that provides Java developers the following
+functionality:
+
+- Authentication Support
+- Authorization Support
+- Audit Support
+- Security Mapping Support
+- An Oasis XACML v2.0 compliant engine
+
+%package javadoc
+Summary: Javadocs for %{name}
+Group: Documentation
+Requires: jpackage-utils
+
+%description javadoc
+This package contains the API documentation for %{name}.
+
+%prep
+%setup -q -n %{name}-%{namedversion}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+%build
+# Because of ugly patch
+mvn-rpmbuild -Dmaven.test.skip=true install javadoc:aggregate
+
+%install
+install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name}
+install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
+install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}
+
+# JAR
+install -pm 644 assembly/target/picketbox-%{namedversion}-bin.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}.jar
+install -pm 644 picketbox/target/picketbox-bare-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/bare.jar
+
+install -pm 644 security-spi/acl/target/acl-spi-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/security-spi-acl.jar
+install -pm 644 security-spi/identity/target/identity-spi-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/security-spi-identity.jar
+install -pm 644 security-spi/authorization/target/authorization-spi-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/security-spi-authorization.jar
+install -pm 644 security-spi/spi/target/picketbox-spi-bare-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/spi-bare.jar
+install -pm 644 picketbox-infinispan/target/picketbox-infinispan-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/infinispan.jar
+
+install -pm 644 security-jboss-sx/acl/target/picketbox-acl-impl-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/acl-impl.jar
+install -pm 644 security-jboss-sx/identity/target/picketbox-identity-impl-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/identity-impl.jar
+install -pm 644 security-jboss-sx/jbosssx-client/target/jbosssx-client-%{namedversion}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/jbosssx-client.jar
+install -pm 644 security-jboss-sx/jbosssx/target/jbosssx-bare.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/jbosssx-bare.jar
+
+# POM
+install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}.pom
+install -pm 644 parent/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-parent.pom
+install -pm 644 security-spi/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-security-spi-parent.pom
+install -pm 644 security-spi/parent/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-security-spi-parent-parent.pom
+install -pm 644 security-jboss-sx/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-impl-parent.pom
+install -pm 644 security-jboss-sx/parent/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-impl-parent-parent.pom
+install -pm 644 picketbox-infinispan/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-infinispan.pom
+
+install -pm 644 picketbox/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-bare.pom
+install -pm 644 security-spi/acl/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-security-spi-acl.pom
+install -pm 644 security-spi/identity/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-security-spi-identity.pom
+install -pm 644 security-spi/authorization/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-security-spi-authorization.pom
+install -pm 644 security-spi/spi/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-spi-bare.pom
+install -pm 644 security-jboss-sx/acl/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-acl-impl.pom
+install -pm 644 security-jboss-sx/identity/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-identity-impl.pom
+install -pm 644 security-jboss-sx/jbosssx/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-jbosssx-bare.pom
+install -pm 644 security-jboss-sx/jbosssx-client/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-jbosssx-client.pom
+
+# DEPMAP
+%add_maven_depmap JPP.%{name}-%{name}.pom %{name}/%{name}.jar
+%add_maven_depmap JPP.%{name}-parent.pom
+%add_maven_depmap JPP.%{name}-security-spi-parent.pom
+%add_maven_depmap JPP.%{name}-security-spi-parent-parent.pom
+%add_maven_depmap JPP.%{name}-impl-parent.pom
+%add_maven_depmap JPP.%{name}-impl-parent-parent.pom
+
+%add_maven_depmap JPP.%{name}-bare.pom %{name}/bare.jar
+%add_maven_depmap JPP.%{name}-security-spi-acl.pom %{name}/security-spi-acl.jar
+%add_maven_depmap JPP.%{name}-security-spi-identity.pom %{name}/security-spi-identity.jar
+%add_maven_depmap JPP.%{name}-security-spi-authorization.pom %{name}/security-spi-authorization.jar
+%add_maven_depmap JPP.%{name}-spi-bare.pom %{name}/spi-bare.jar
+%add_maven_depmap JPP.%{name}-acl-impl.pom %{name}/acl-impl.jar
+%add_maven_depmap JPP.%{name}-identity-impl.pom %{name}/identity-impl.jar
+%add_maven_depmap JPP.%{name}-jbosssx-bare.pom %{name}/jbosssx-bare.jar
+%add_maven_depmap JPP.%{name}-jbosssx-client.pom %{name}/jbosssx-client.jar
+%add_maven_depmap JPP.%{name}-infinispan.pom %{name}/infinispan.jar
+
+# APIDOCS
+cp -rp target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
+
+%files
+%{_mavenpomdir}/*
+%{_mavendepmapfragdir}/*
+%{_javadir}/*
+
+%files javadoc
+%{_javadocdir}/%{name}
+
+%changelog
+* Thu Mar 22 2012 Ricardo Arguello <ricardo at fedoraproject.org> 4.0.6-4
+- Fixed description to be shorter than 80 chars
+- Removed macro char from changelog
+
+* Fri Mar 16 2012 Ricardo Arguello <ricardo at fedoraproject.org> 4.0.6-3
+- Replaced dependency for geronimo-jpa with hibernate-jpa-2.0-api
+- Added dependencies jboss-servlet-3.0-api and jboss-transaction-1.1-api
+- Fixed add_maven_depmap for picketbox/bare.jar
+
+* Thu Mar 8 2012 Ricardo Arguello <ricardo at fedoraproject.org> 4.0.6-2
+- Cleanup of the spec file
+
+* Fri Jan 27 2011 Marek Goldmann <mgoldman at redhat.com> 4.0.6-1
+- Initial packaging
diff --git a/sources b/sources
index e69de29..efa947c 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+8f85cd21a421341d67298b3907bd7cb1 picketbox-4.0.6.final.tar.xz
More information about the scm-commits
mailing list