Author: ate
Date: Tue Sep 2 06:47:55 2008
New Revision: 691248
URL: http://svn.apache.org/viewvc?rev=691248&view=rev
Log:
(start of) OJB mapping for new security principal and attributes (unfinished)
Added:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/ojb/
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/ojb/JetspeedPrincipalTypeFieldConversion.java
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributeValue.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml?rev=691248&r1=691247&r2=691248&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/JETSPEED-INF/ojb/security_repository.xml
Tue Sep 2 06:47:55 2008
@@ -662,7 +662,7 @@
<!--
- - S E C U R I T Y A T T R I B U T E S
+ - S E C U R I T Y A T T R I B U T E S ( D E P R E C A T E D )
-->
<class-descriptor
class="org.apache.jetspeed.security.attributes.SecurityAttributeImpl"
@@ -705,4 +705,135 @@
/>
</class-descriptor>
+
+ <!--
+ - J E T S P E E D P R I N C I P A L
+ -->
+ <class-descriptor
+ class="org.apache.jetspeed.security.impl.BaseJetspeedPrincipal"
+ table="SECURITY_PRINCIPAL"
+ >
+ <documentation>Represents a security principal in the security
policy.</documentation>
+ <field-descriptor
+ name="id"
+ column="principal_id"
+ jdbc-type="BIGINT"
+ primarykey="true"
+ indexed="true"
+ autoincrement="true"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="ojbConcreteClass"
+ column="sp_type"
+ jdbc-type="VARCHAR"
+ nullable="false"
+
conversion="org.apache.jetspeed.security.util.ojb.JetspeedPrincipalTypeFieldConversion"
+ length="20"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="mapped"
+ column="is_mapping_only"
+ jdbc-type="INTEGER"
+
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
+ nullable="false"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="readOnly"
+ column="is_readonly"
+ jdbc-type="INTEGER"
+
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
+ nullable="false"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="removable"
+ column="is_removable"
+ jdbc-type="INTEGER"
+
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
+ nullable="false"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="name"
+ column="sp_name"
+ jdbc-type="VARCHAR"
+ nullable="false"
+ length="200"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="creationDate"
+ column="creation_date"
+ jdbc-type="TIMESTAMP"
+ nullable="false"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="modifiedDate"
+ column="modified_date"
+ jdbc-type="TIMESTAMP"
+ nullable="false"
+ >
+ </field-descriptor>
+ <field-descriptor
+ name="enabled"
+ column="is_enabled"
+ jdbc-type="INTEGER"
+
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
+ nullable="false"
+ >
+ </field-descriptor>
+ <collection-descriptor
+ name="attributeValues"
+
element-class-ref="org.apache.jetspeed.security.impl.SecurityAttributeValue"
+ refresh="true"
+ auto-retrieve="true"
+ auto-update="true"
+ auto-delete="none"
+ >
+ <inverse-foreignkey field-ref="principalId"/>
+ </collection-descriptor>
+ </class-descriptor>
+
+ <!--
+ - S E C U R I T Y A T T R I B U T E S
+ -->
+ <class-descriptor
+ class="org.apache.jetspeed.security.SecurityAttributeValue"
+ table="security_attributes"
+ >
+ <documentation>Represents a Security Principal Attribute
definition.</documentation>
+ <field-descriptor
+ name="id"
+ column="attr_id"
+ jdbc-type="BIGINT"
+ primarykey="true"
+ autoincrement="true"
+ />
+ <field-descriptor
+ name="principalId"
+ column="principal_id"
+ jdbc-type="BIGINT"
+ nullable="false"
+ access="anonymous"
+ />
+ <field-descriptor
+ name="name"
+ column="attr_name"
+ jdbc-type="VARCHAR"
+ nullable="false"
+ length="200"
+ />
+ <field-descriptor
+ name="value"
+ column="attr_value"
+ jdbc-type="VARCHAR"
+ nullable="true"
+ length="1000"
+ />
+ </class-descriptor>
+
</descriptor-repository>
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributeValue.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributeValue.java?rev=691248&r1=691247&r2=691248&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributeValue.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityAttributeValue.java
Tue Sep 2 06:47:55 2008
@@ -27,6 +27,9 @@
{
private static final long serialVersionUID = -5305625934872996140L;
+ @SuppressWarnings("unused")
+ private long id;
+
private String name;
private String stringValue;
Added:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/ojb/JetspeedPrincipalTypeFieldConversion.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/ojb/JetspeedPrincipalTypeFieldConversion.java?rev=691248&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/ojb/JetspeedPrincipalTypeFieldConversion.java
(added)
+++
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/ojb/JetspeedPrincipalTypeFieldConversion.java
Tue Sep 2 06:47:55 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.util.ojb;
+
+import org.apache.jetspeed.security.JetspeedPrincipalManagerProvider;
+import org.apache.ojb.broker.accesslayer.conversions.ConversionException;
+import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
+
+/**
+ * @version $Id$
+ *
+ */
+public class JetspeedPrincipalTypeFieldConversion implements FieldConversion
+{
+ private static final long serialVersionUID = -4210390887451224757L;
+
+ private static JetspeedPrincipalManagerProvider jpmp;
+
+ public static void
setJetspeedPrincipalManagerProvider(JetspeedPrincipalManagerProvider jpmp)
+ {
+ JetspeedPrincipalTypeFieldConversion.jpmp = jpmp;
+ }
+
+ public Object javaToSql(Object javaObject) throws ConversionException
+ {
+ return jpmp.getPrincipalTypeByClassName((String)javaObject).getName();
+ }
+
+ public Object sqlToJava(Object sqlObject) throws ConversionException
+ {
+ return jpmp.getPrincipalType((String)sqlObject).getClassName();
+ }
+
+}
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml?rev=691248&r1=691247&r2=691248&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
Tue Sep 2 06:47:55 2008
@@ -39,9 +39,12 @@
-->
<table name="SECURITY_PRINCIPAL">
<column name="PRINCIPAL_ID" primaryKey="true" required="true"
type="INTEGER"/>
+ <!-- column "CLASSNAME" is deprecated: will be dropped once all
InternalPrincipal usages are removed -->
<column name="CLASSNAME" required="true" size="254" type="VARCHAR"/>
<column name="IS_MAPPING_ONLY" required="true" type="BOOLEANINT"/>
- <column name="IS_ENABLED" required="true" type="BOOLEANINT"/>
+ <column name="IS_ENABLED" required="true" type="BOOLEANINT"/>
+ <column name="IS_READONLY" required="true" type="BOOLEANINT"/>
+ <column name="IS_REMOVABLE" required="true" type="BOOLEANINT"/>
<column name="SP_TYPE" required="true" size="20" type="VARCHAR"/>
<column name="SP_NAME" required="true" size="200" type="VARCHAR"/>
<column name="CREATION_DATE" required="true" type="TIMESTAMP"/>
@@ -231,19 +234,17 @@
-->
<table name="SECURITY_ATTRIBUTES">
+ <column name="PRINCIPAL_ID" primaryKey="true" required="true"
type="INTEGER"/>
+ <column name="ATTR_NAME" primaryKey="true" required="true" size="200"
type="VARCHAR"/>
<column name="ATTR_ID" primaryKey="true" required="true"
type="INTEGER"/>
- <column name="PRINCIPAL_ID" required="true" type="INTEGER"/>
- <column name="ATTR_NAME" required="true" size="200" type="VARCHAR"/>
+ <!-- column "ATTR_TYPE" is deprecated: will be dropped with
transition to new SecurityAttributes implementation is complete -->
<column name="ATTR_TYPE" required="true" size="20" type="VARCHAR"/>
- <column name="PRINCIPAL_TYPE" size="10" type="VARCHAR"/>
<column name="ATTR_VALUE" size="1000" type="VARCHAR"/>
- <index name="IX_PRINCIPAL_ID">
- <index-column name="PRINCIPAL_ID"/>
- </index>
<index name="IX_NAMEVALUE_LOOKUP">
<index-column name="ATTR_NAME"/>
<index-column name="ATTR_VALUE"/>
</index>
+ <
<foreign-key foreignTable="SECURITY_PRINCIPAL"
name="FK_PRINCIPAL_ATTR" onDelete="cascade">
<reference foreign="PRINCIPAL_ID" local="PRINCIPAL_ID"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]