Author: ate
Date: Fri Jul 18 17:23:57 2008
New Revision: 678082
URL: http://svn.apache.org/viewvc?rev=678082&view=rev
Log:
first draft proposal for a new "GenericAttributes" model which might be
feasible to use for Security entity (Role/Group/User) attributes.
As an example, I've also added a new JetspeedPrincipal interface which could be
used as base interface for our current Role,Group and User interfaces (when we
drop their Preferences access).
Please note: the GenericAttributes model is far for complete or anywhere
definitive, just the outcome of a quick and dirty braindump of what I could
think of as possible solution...
Added:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java
(with props)
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java
(with props)
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java
(with props)
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java
(with props)
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java
(with props)
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
(with props)
Added:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java?rev=678082&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java
(added)
+++
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java
Fri Jul 18 17:23:57 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file 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 org.apache.jetspeed.attribute;
+
+/**
+ * @version $Id$
+ *
+ */
+public interface GenericAttribute extends GenericAttributeType
+{
+ boolean isNew();
+ Object getValue();
+ String getStringValue();
+ Boolean getBooleanValue();
+ Long getLongValue();
+ void setValue(Object value) throws GenericAttributeException;
+ void setValues(Object[] values) throws GenericAttributeException;
+ void setStringValue(String value) throws GenericAttributeException;
+ void setStringValues(String[] value) throws GenericAttributeException;
+ void setBooleanValue(Boolean value) throws GenericAttributeException;
+ void setBooleanValues(Boolean[] value) throws GenericAttributeException;
+ void setBinaryValue(byte[] value) throws GenericAttributeException;
+ void setBinaryValues(byte[][] values) throws GenericAttributeException;
+}
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttribute.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java?rev=678082&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java
(added)
+++
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java
Fri Jul 18 17:23:57 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file 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 org.apache.jetspeed.attribute;
+
+import org.apache.jetspeed.exception.JetspeedException;
+import org.apache.jetspeed.i18n.KeyedMessage;
+
+/**
+ * @version $Id$
+ *
+ */
+public class GenericAttributeException extends JetspeedException
+{
+ public GenericAttributeException(KeyedMessage typedMessage)
+ {
+ super(typedMessage);
+ }
+
+ public GenericAttributeException(KeyedMessage keyedMessage, Throwable
nested)
+ {
+ super(keyedMessage, nested);
+ }
+}
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java?rev=678082&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java
(added)
+++
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java
Fri Jul 18 17:23:57 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file 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 org.apache.jetspeed.attribute;
+
+import org.apache.jetspeed.exception.JetspeedRuntimeException;
+import org.apache.jetspeed.i18n.KeyedMessage;
+
+/**
+ * @version $Id$
+ *
+ */
+public class GenericAttributeRuntimeException extends JetspeedRuntimeException
+{
+ public static final KeyedMessage ATTRIBUTE_UNSUPPORTED = new
KeyedMessage("Attribute {0} is not supported for a {1}.");
+
+ public GenericAttributeRuntimeException(KeyedMessage typedMessage)
+ {
+ super(typedMessage);
+ }
+ public GenericAttributeRuntimeException(KeyedMessage keyedMessage,
Throwable nested)
+ {
+ super(keyedMessage, nested);
+ }
+}
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeRuntimeException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java?rev=678082&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java
(added)
+++
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java
Fri Jul 18 17:23:57 2008
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file 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 org.apache.jetspeed.attribute;
+
+/**
+ * @version $Id$
+ *
+ */
+public interface GenericAttributeType
+{
+ int MAX_UNDEFINED = 0;
+
+ enum TYPE { STRING, BOOLEAN, LONG, BINARY, OBJECT };
+
+ String getName();
+
+ TYPE getType();
+
+ boolean isReadOnly();
+
+ boolean isRequired();
+
+ int maxValueLength();
+
+ int maxValues();
+}
\ No newline at end of file
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributeType.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java?rev=678082&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java
(added)
+++
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java
Fri Jul 18 17:23:57 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file 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 org.apache.jetspeed.attribute;
+
+import java.util.Set;
+
+/**
+ * [EMAIL PROTECTED] GenericAttribute} container
+ * <p>
+ * Generic Attributes can be leveraged to store value(s) for a fixed set of
predefined attribute names.
+ * </p>
+ * <p>
+ * The whole set of provided attributes can be readonly, or individual
attributes can be readonly.<br/>
+ * When the whole set is readonly, all similar sets (e.g. with the same [EMAIL
PROTECTED] will be readonly.
+ * </p>
+ * <p>
+ * The [EMAIL PROTECTED] #getAttribute(), current} set of attributes can
contain a subset of all the [EMAIL PROTECTED] #getSupportedNames() supported}
+ * attributes.
+ * </p>
+ * Trying to access an unsupported attribute through [EMAIL PROTECTED]
#getAttribute(String)} will throw a [EMAIL PROTECTED]
GenericAttributeRuntimeException}
+ * of type [EMAIL PROTECTED]
GenericAttributeRuntimeException#ATTRIBUTE_UNSUPPORTED}.
+ * @version $Id$
+ *
+ */
+public interface GenericAttributes
+{
+ String getType();
+ int size();
+ boolean isEmpty();
+ boolean isReadOnly();
+ Set<String> getNames();
+ Set<String> getSupportedNames();
+ Set<GenericAttribute> getAttributes();
+ GenericAttribute getAttribute(String name) throws
GenericAttributeRuntimeException;
+}
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/attribute/GenericAttributes.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java?rev=678082&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
(added)
+++
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
Fri Jul 18 17:23:57 2008
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file 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 org.apache.jetspeed.security;
+
+import java.security.Principal;
+
+import org.apache.jetspeed.attribute.GenericAttributes;
+
+/**
+ * Base interface for User/Group/Role security entities providing access to
the GenericAttributes for a Principal
+ * @version $Id$
+ *
+ */
+public interface JetspeedPrincipal
+{
+ /**
+ * <p>Getter for the [EMAIL PROTECTED] Principal}.</p>
+ * @return The [EMAIL PROTECTED] Principal}.
+ */
+ Principal getPrincipal();
+
+ /**
+ * <p>Setter for the [EMAIL PROTECTED] Principal}.</p>
+ * @param principal The [EMAIL PROTECTED] Principal}.
+ */
+ void setPrincipal(Principal principal);
+
+ GenericAttributes getAttribute();
+}
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange:
portals/jetspeed-2/portal/branches/JS2-869/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]