JBoss Portal SVN: r12804 - in branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal: wsrp and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-02-10 07:45:05 -0500 (Tue, 10 Feb 2009)
New Revision: 12804
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
Log:
- JBPORTAL-2306: Fixed WSRPPortletURL.toString() method to properly add WSRP end rewriting token.
- Added test case.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-02-10 12:39:07 UTC (rev 12803)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-02-10 12:45:05 UTC (rev 12804)
@@ -51,7 +51,7 @@
public void testResource()
{
String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif" +
- "&wsrp-requiresRewrite=true/wsrp_rewrite";
+ "&wsrp-requiresRewrite=true/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertEquals("http://test.com/images/test.gif", url.toString());
@@ -61,7 +61,7 @@
public void testSecureInteraction()
{
String expected = "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-secureURL=true" +
- "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
+ "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertTrue(url instanceof WSRPActionURL);
@@ -195,25 +195,27 @@
checkInvalidURL(invalid, "Should have detected invalid URL: ", "invalidURL");
}
- private void checkInvalidURL(String invalid, String message, String mustBeInException)
+ public void testNullURL()
{
try
{
- WSRPPortletURL.create(invalid);
- fail(message + mustBeInException);
+ WSRPPortletURL.create(null);
+ fail("Should have detected null URL");
}
catch (IllegalArgumentException e)
{
- assertTrue(e.getLocalizedMessage().contains(mustBeInException));
+ // expected
}
}
- public void testNullURL()
+ public void testInvalidURLType()
{
+ String wrongURLType = "wsrp_rewrite?wsrp-urlType=pipo&wsrp-mode=help/wsrp_rewrite";
+
try
{
- WSRPPortletURL.create(null);
- fail("Should have detected null URL");
+ WSRPPortletURL.create(wrongURLType);
+ fail("Should have detected wrong URL type");
}
catch (IllegalArgumentException e)
{
@@ -221,18 +223,36 @@
}
}
- public void testInvalidURLType()
+ public void testProperEndTokenInRelaxedMode()
{
- String wrongURLType = "wsrp_rewrite?wsrp-urlType=pipo&wsrp-mode=help/wsrp_rewrite";
+ WSRPPortletURL.setStrict(false);
+ WSRPPortletURL url = new WSRPPortletURL()
+ {
+ @Override
+ protected String getURLType()
+ {
+ return WSRPRewritingConstants.URL_TYPE_BLOCKING_ACTION;
+ }
+
+ @Override
+ protected void appendEnd(StringBuffer sb)
+ {
+ }
+ };
+ assertTrue(url.toString().contains(WSRPRewritingConstants.END_WSRP_REWRITE));
+ }
+
+ private void checkInvalidURL(String invalid, String message, String mustBeInException)
+ {
try
{
- WSRPPortletURL.create(wrongURLType);
- fail("Should have detected wrong URL type");
+ WSRPPortletURL.create(invalid);
+ fail(message + mustBeInException);
}
catch (IllegalArgumentException e)
{
- // expected
+ assertTrue(e.getLocalizedMessage().contains(mustBeInException));
}
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-02-10 12:39:07 UTC (rev 12803)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-02-10 12:45:05 UTC (rev 12804)
@@ -144,7 +144,7 @@
}
encodedURL = encodedURL.substring(0, endTokenIndex)
- + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+ + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
// remember that we should position the extra params after the end token
extraAfterEnd = true;
@@ -154,7 +154,7 @@
{
// remove prefix and suffix
encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH,
- encodedURL.length() - WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+ encodedURL.length() - WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
}
// next param should be the url type
@@ -191,7 +191,7 @@
else
{
throw new IllegalArgumentException("Unrecognized URL type: " + encodedURL.substring(0, encodedURL.indexOf(PARAM_SEPARATOR))
- + "in " + originalURL);
+ + "in " + originalURL);
}
// other parameters
@@ -208,7 +208,7 @@
else if (WSRPRewritingConstants.URL_TYPE_RESOURCE.equals(urlType))
{
throw new IllegalArgumentException("Both the 'wsrp-url' and 'wsrp-requiresRewrite' parameters MUST also be specified for resource URL '"
- + originalURL + "'");
+ + originalURL + "'");
}
url.setParams(params, originalURL);
@@ -327,7 +327,7 @@
//
sb.append(WSRPRewritingConstants.BEGIN_WSRP_REWRITE).append(WSRPRewritingConstants.URL_TYPE_NAME)
- .append(EQUALS).append(getURLType());
+ .append(EQUALS).append(getURLType());
//
if (secure)
@@ -360,19 +360,15 @@
else
{
// we're in relaxed mode so we need to deal with extra params if they exist
- StringBuffer extras = null;
if (extraParams != null && !extraParams.isEmpty())
{
- extras = new StringBuffer();
+ StringBuffer extras = new StringBuffer();
for (Map.Entry<String, String> entry : extraParams.entrySet())
{
createURLParameter(extras, entry.getKey(), entry.getValue());
}
- }
- // if we had extra params, we need to figure out where thwy should be positioned wrt end token
- if (extras != null)
- {
+ // if we had extra params, we need to figure out where thwy should be positioned wrt end token
if (extraParamsAfterEndToken)
{
sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
@@ -384,6 +380,10 @@
sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
}
}
+ else
+ {
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
}
return sb.toString();
}
@@ -430,7 +430,7 @@
if (strict)
{
throw new IllegalArgumentException("Invalid parameter name in strict validation mode (see documentation): '"
- + name + "' in " + originalURL);
+ + name + "' in " + originalURL);
}
else
{
17 years, 2 months
JBoss Portal SVN: r12803 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal: wsrp and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-02-10 07:39:07 -0500 (Tue, 10 Feb 2009)
New Revision: 12803
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
Log:
- JBPORTAL-2306: Fixed WSRPPortletURL.toString() method to properly add WSRP end rewriting token.
- Added test case.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-02-09 20:56:52 UTC (rev 12802)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-02-10 12:39:07 UTC (rev 12803)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -51,7 +51,7 @@
public void testResource()
{
String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif" +
- "&wsrp-requiresRewrite=true/wsrp_rewrite";
+ "&wsrp-requiresRewrite=true/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertEquals("http://test.com/images/test.gif", url.toString());
@@ -61,7 +61,7 @@
public void testSecureInteraction()
{
String expected = "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-secureURL=true" +
- "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
+ "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertTrue(url instanceof WSRPActionURL);
@@ -195,25 +195,27 @@
checkInvalidURL(invalid, "Should have detected invalid URL: ", "invalidURL");
}
- private void checkInvalidURL(String invalid, String message, String mustBeInException)
+ public void testNullURL()
{
try
{
- WSRPPortletURL.create(invalid);
- fail(message + mustBeInException);
+ WSRPPortletURL.create(null);
+ fail("Should have detected null URL");
}
catch (IllegalArgumentException e)
{
- assertTrue(e.getLocalizedMessage().contains(mustBeInException));
+ // expected
}
}
- public void testNullURL()
+ public void testInvalidURLType()
{
+ String wrongURLType = "wsrp_rewrite?wsrp-urlType=pipo&wsrp-mode=help/wsrp_rewrite";
+
try
{
- WSRPPortletURL.create(null);
- fail("Should have detected null URL");
+ WSRPPortletURL.create(wrongURLType);
+ fail("Should have detected wrong URL type");
}
catch (IllegalArgumentException e)
{
@@ -221,18 +223,36 @@
}
}
- public void testInvalidURLType()
+ public void testProperEndTokenInRelaxedMode()
{
- String wrongURLType = "wsrp_rewrite?wsrp-urlType=pipo&wsrp-mode=help/wsrp_rewrite";
+ WSRPPortletURL.setStrict(false);
+ WSRPPortletURL url = new WSRPPortletURL()
+ {
+ @Override
+ protected String getURLType()
+ {
+ return WSRPRewritingConstants.URL_TYPE_BLOCKING_ACTION;
+ }
+
+ @Override
+ protected void appendEnd(StringBuffer sb)
+ {
+ }
+ };
+ assertTrue(url.toString().contains(WSRPRewritingConstants.END_WSRP_REWRITE));
+ }
+
+ private void checkInvalidURL(String invalid, String message, String mustBeInException)
+ {
try
{
- WSRPPortletURL.create(wrongURLType);
- fail("Should have detected wrong URL type");
+ WSRPPortletURL.create(invalid);
+ fail(message + mustBeInException);
}
catch (IllegalArgumentException e)
{
- // expected
+ assertTrue(e.getLocalizedMessage().contains(mustBeInException));
}
}
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java 2009-02-09 20:56:52 UTC (rev 12802)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java 2009-02-10 12:39:07 UTC (rev 12803)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -20,6 +20,7 @@
* 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.portal.wsrp;
import org.jboss.portal.Mode;
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-02-09 20:56:52 UTC (rev 12802)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-02-10 12:39:07 UTC (rev 12803)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -369,19 +369,15 @@
else
{
// we're in relaxed mode so we need to deal with extra params if they exist
- StringBuffer extras = null;
if (extraParams != null && !extraParams.isEmpty())
{
- extras = new StringBuffer();
+ StringBuffer extras = new StringBuffer();
for (Map.Entry<String, String> entry : extraParams.entrySet())
{
createURLParameter(extras, entry.getKey(), entry.getValue());
}
- }
- // if we had extra params, we need to figure out where thwy should be positioned wrt end token
- if (extras != null)
- {
+ // if we had extra params, we need to figure out where thwy should be positioned wrt end token
if (extraParamsAfterEndToken)
{
sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
@@ -393,6 +389,10 @@
sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
}
}
+ else
+ {
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
}
return sb.toString();
}
17 years, 2 months
JBoss Portal SVN: r12802 - in modules/authorization/trunk: policy-server and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-02-09 15:56:52 -0500 (Mon, 09 Feb 2009)
New Revision: 12802
Modified:
modules/authorization/trunk/documentation/reference-guide/
modules/authorization/trunk/policy-server/pom.xml
Log:
Starting the Reference Guide
Property changes on: modules/authorization/trunk/documentation/reference-guide
___________________________________________________________________
Name: svn:ignore
+ target
Modified: modules/authorization/trunk/policy-server/pom.xml
===================================================================
--- modules/authorization/trunk/policy-server/pom.xml 2009-02-09 20:51:20 UTC (rev 12801)
+++ modules/authorization/trunk/policy-server/pom.xml 2009-02-09 20:56:52 UTC (rev 12802)
@@ -28,12 +28,7 @@
<groupId>org.jboss.security.authz</groupId>
<artifactId>jboss-authz-enforcement</artifactId>
<version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.security.authz</groupId>
- <artifactId>jboss-authz-provisioning</artifactId>
- <version>${project.version}</version>
- </dependency>
+ </dependency>
<!-- jboss xacml -->
<dependency>
17 years, 2 months
JBoss Portal SVN: r12801 - in modules/authorization/trunk: documentation and 7 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-02-09 15:51:20 -0500 (Mon, 09 Feb 2009)
New Revision: 12801
Added:
modules/authorization/trunk/documentation/
modules/authorization/trunk/documentation/pom.xml
modules/authorization/trunk/documentation/reference-guide/
modules/authorization/trunk/documentation/reference-guide/en/
modules/authorization/trunk/documentation/reference-guide/en/images/
modules/authorization/trunk/documentation/reference-guide/en/images/sample/
modules/authorization/trunk/documentation/reference-guide/en/images/sample/partial-refresh.png
modules/authorization/trunk/documentation/reference-guide/en/master.xml
modules/authorization/trunk/documentation/reference-guide/en/modules/
modules/authorization/trunk/documentation/reference-guide/en/modules/sample.xml
modules/authorization/trunk/documentation/reference-guide/pom.xml
modules/authorization/trunk/documentation/reference-guide/src/
modules/authorization/trunk/documentation/reference-guide/src/assemble/
modules/authorization/trunk/documentation/reference-guide/src/assemble/reference-guide.xml
Modified:
modules/authorization/trunk/pom.xml
Log:
Starting the Reference Guide
Added: modules/authorization/trunk/documentation/pom.xml
===================================================================
--- modules/authorization/trunk/documentation/pom.xml (rev 0)
+++ modules/authorization/trunk/documentation/pom.xml 2009-02-09 20:51:20 UTC (rev 12801)
@@ -0,0 +1,71 @@
+<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">
+
+ <parent>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>jboss-portal-docs-parent</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>jboss-authz-documentation-parent</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Authorization Documentation</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss Authorization Documentation</description>
+
+ <modules>
+ <module>reference-guide</module>
+ </modules>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
Added: modules/authorization/trunk/documentation/reference-guide/en/images/sample/partial-refresh.png
===================================================================
(Binary files differ)
Property changes on: modules/authorization/trunk/documentation/reference-guide/en/images/sample/partial-refresh.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/authorization/trunk/documentation/reference-guide/en/master.xml
===================================================================
--- modules/authorization/trunk/documentation/reference-guide/en/master.xml (rev 0)
+++ modules/authorization/trunk/documentation/reference-guide/en/master.xml 2009-02-09 20:51:20 UTC (rev 12801)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<book lang="en">
+ <bookinfo>
+ <title>Change Title in master.xml</title>
+ <subtitle>Change SubTitle in master.xml</subtitle>
+ <releaseinfo>Change Release Info in master.xml</releaseinfo>
+ <releaseinfo>Change Release Info Date in master.xml</releaseinfo>
+ <author>
+ <firstname>Your first name</firstname>
+ <surname>Your last name</surname>
+ <email>your.email(a)your.domain.com</email>
+ </author>
+ </bookinfo>
+ <toc/>
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="modules/sample.xml" />
+
+</book>
Property changes on: modules/authorization/trunk/documentation/reference-guide/en/master.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/authorization/trunk/documentation/reference-guide/en/modules/sample.xml
===================================================================
--- modules/authorization/trunk/documentation/reference-guide/en/modules/sample.xml (rev 0)
+++ modules/authorization/trunk/documentation/reference-guide/en/modules/sample.xml 2009-02-09 20:51:20 UTC (rev 12801)
@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="sample">
+ <chapterinfo>
+ <author>
+ <firstname>Your first name</firstname>
+ <surname>Your last name</surname>
+ <email>your.email(a)your.domain.com</email>
+ </author>
+ </chapterinfo>
+ <title>Sample chapter</title>
+ <para>This is the beginning of the sample chapter.</para>
+ <sect1>
+ <title>sample section</title>
+ <para>This is the beginning of the sample section. It contains examples of how docbook should be used in the context
+ of a documentation for a Java related product.</para>
+
+ <sect2>
+ <title>Bullet points</title>
+ <programlisting><![CDATA[
+<itemizedlist>
+ <listitem>Item1</listitem>
+ <listitem>Item2</listitem>
+ <listitem>Item3</listitem>
+</itemizedlist>
+]]></programlisting>
+ <para>
+ <itemizedlist>
+ <listitem>Item1</listitem>
+ <listitem>Item2</listitem>
+ <listitem>Item3</listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Interface or annotation reference</title>
+ <programlisting><![CDATA[
+<interfacename>mypackage.MyInterface</interfacename>
+<interfacename>@MyAnnotation</interfacename>
+]]></programlisting>
+ <para>
+ <interfacename>mypackage.MyInterface</interfacename>
+ <interfacename>@MyAnnotation</interfacename>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Class reference</title>
+ <programlisting><![CDATA[
+<classname>mypackage.MyClass</classname>
+]]></programlisting>
+ <para>
+ <classname>mypackage.MyClass</classname>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Parameter reference</title>
+ <programlisting><![CDATA[
+<parameter>MyParameter</parameter>
+]]></programlisting>
+ <para>
+ <parameter>MyParameter</parameter>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Method referece</title>
+ <programlisting><![CDATA[
+<methodname>myMethod()</methodname>
+]]></programlisting>
+ <para>
+ <methodname>myMethod()</methodname>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Exception reference</title>
+ <programlisting><![CDATA[
+<exceptionname>mypackage.MyException</exceptionname>
+]]></programlisting>
+ <para>
+ <exceptionname>mypackage.MyException</exceptionname>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>A variable name</title>
+ <programlisting><![CDATA[
+<varname>myVariable</varname>
+]]></programlisting>
+ <para>
+ <varname>myVariable</varname>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>File reference</title>
+ <programlisting><![CDATA[
+<filename>MyFile</filename>
+]]></programlisting>
+ <para>
+ <filename>MyFile</filename>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Literal reference</title>
+ <programlisting><![CDATA[
+<literal>null</literal>
+<literal>1</literal>
+<literal>"foo"</literal>
+]]></programlisting>
+ <para>
+ <literal>null</literal>
+ <literal>1</literal>
+ <literal>"foo"</literal>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>A constant</title>
+ <programlisting><![CDATA[
+<constant>MAX_VALUE</constant>
+]]></programlisting>
+ <para>
+ <constant>MAX_VALUE</constant>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Inline code</title>
+ <programlisting><![CDATA[
+<code>System.out.println()</code>
+]]></programlisting>
+ <para>
+ <code>System.out.println()</code>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Code or XML with a caption</title>
+ <programlisting>
+<example>
+ <programlisting><![CDATA[public class MyClass
+{
+}
+]]></programlisting>
+ <caption>This is the MyClass class</caption>
+</example>
+</programlisting>
+ <para>
+ <example>
+ <programlisting><![CDATA[public class MyClass
+{
+}
+]]></programlisting>
+ <caption>This is the MyClass class</caption>
+ </example>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>A database name</title>
+ <programlisting><![CDATA[
+<database>MyDatabase</database>
+]]></programlisting>
+ <para>
+ <database>MyDatabase</database>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>A shell command</title>
+ <programlisting><![CDATA[
+<command>ls -l</command>
+]]></programlisting>
+ <para>
+ <command>ls -l</command>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>A shell example</title>
+ <programlisting><![CDATA[
+<screen><![CDATA[julien-viets-computer:~/java/jboss-portal-template/user-guide julien$ ls -l
+total 8
+drwxr-xr-x 3 julien julien 102 Oct 19 18:14 build
+-rwxr-xr-x 1 julien julien 923 Oct 19 17:40 build.xml
+drwxr-xr-x 6 julien julien 204 Oct 19 17:42 en
+]]></screen>
+]]></programlisting>
+ <para>
+ <screen><![CDATA[julien-viets-computer:~/java/jboss-portal-template/user-guide julien$ ls -l
+total 8
+drwxr-xr-x 3 julien julien 102 Oct 19 18:14 build
+-rwxr-xr-x 1 julien julien 923 Oct 19 17:40 build.xml
+drwxr-xr-x 6 julien julien 204 Oct 19 17:42 en
+]]></screen>
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Coloration</title>
+ <programlisting><![CDATA[
+<programlisting role="JAVA"><![CDATA[
+package org.jboss.portal.foo;
+public class Bar
+{
+}]]></programlisting>]]></programlisting>
+ <programlisting role="JAVA"><![CDATA[
+package org.jboss.portal.foo;
+public class Bar
+{
+}]]></programlisting>
+ </sect2>
+ <sect2>
+ <title>Annotations</title>
+ <programlisting><![CDATA[
+<programlistingco>
+ <areaspec>
+ <area id="sample.annotation.line2" coords='2' />
+ <area id="sample.annotation.line4" coords='4' />
+ </areaspec>
+ <programlisting><![CDATA[Line 1: Foo
+Line 2: Bar
+Line 3: Toto
+Line 4: FooBar
+Line 5: Titi]]></programlisting>
+ <calloutlist>
+ <callout arearefs="sample.annotation.line2">
+ <para>This is line 2</para>
+ </callout>
+ <callout arearefs="sample.annotation.line4">
+ <para>This is line 4</para>
+ </callout>
+ </calloutlist>
+</programlistingco>
+]]></programlisting>
+ <programlistingco>
+ <areaspec>
+ <area id="sample.annotation.line2" coords='2' />
+ <area id="sample.annotation.line4" coords='4' />
+ </areaspec>
+ <programlisting><![CDATA[Line 1: Foo
+Line 2: Bar
+Line 3: Toto
+Line 4: FooBar
+Line 5: Titi]]></programlisting>
+ <calloutlist>
+ <callout arearefs="sample.annotation.line2">
+ <para>This is line 2</para>
+ </callout>
+ <callout arearefs="sample.annotation.line4">
+ <para>This is line 4</para>
+ </callout>
+ </calloutlist>
+ </programlistingco>
+ </sect2>
+ </sect1>
+
+</chapter>
Added: modules/authorization/trunk/documentation/reference-guide/pom.xml
===================================================================
--- modules/authorization/trunk/documentation/reference-guide/pom.xml (rev 0)
+++ modules/authorization/trunk/documentation/reference-guide/pom.xml 2009-02-09 20:51:20 UTC (rev 12801)
@@ -0,0 +1,42 @@
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>jboss-authz-documentation-parent</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>reference-guide</artifactId>
+ <name>Reference_Guide</name>
+ <version>trunk-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <!--finalName>reference-guide</finalName-->
+ <descriptors>
+ <descriptor>src/assemble/reference-guide.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: modules/authorization/trunk/documentation/reference-guide/src/assemble/reference-guide.xml
===================================================================
--- modules/authorization/trunk/documentation/reference-guide/src/assemble/reference-guide.xml (rev 0)
+++ modules/authorization/trunk/documentation/reference-guide/src/assemble/reference-guide.xml 2009-02-09 20:51:20 UTC (rev 12801)
@@ -0,0 +1,16 @@
+<assembly>
+ <!--id>referenceGuide</id-->
+ <formats>
+ <format>zip</format>
+ </formats>
+ <!--baseDirectory>referenceGuide</baseDirectory-->
+ <fileSets>
+ <fileSet>
+ <directory>target/docbook/publish/en-US</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Modified: modules/authorization/trunk/pom.xml
===================================================================
--- modules/authorization/trunk/pom.xml 2009-02-09 09:17:04 UTC (rev 12800)
+++ modules/authorization/trunk/pom.xml 2009-02-09 20:51:20 UTC (rev 12801)
@@ -14,10 +14,8 @@
<module>core-components</module>
<module>enforcement</module>
<module>policy-server</module>
- <module>http-profile</module>
- <!--
- <module>security-console</module>
- -->
+ <module>http-profile</module>
+ <module>documentation</module>
</modules>
<properties>
17 years, 2 months
JBoss Portal SVN: r12800 - modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-02-09 04:17:04 -0500 (Mon, 09 Feb 2009)
New Revision: 12800
Modified:
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java
Log:
testing action implied functionality
Modified: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java 2009-02-09 09:06:31 UTC (rev 12799)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java 2009-02-09 09:17:04 UTC (rev 12800)
@@ -29,8 +29,6 @@
import org.jboss.security.authz.model.Attribute;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.model.PolicyMetaData;
-import org.jboss.security.authz.model.Rule;
-import org.jboss.security.authz.model.Effect;
import org.jboss.security.authz.model.Resource;
import org.jboss.security.authz.model.Subject;
import org.jboss.security.authz.enforcement.Request;
@@ -40,9 +38,8 @@
import org.jboss.security.authz.components.action.Read;
import org.jboss.security.authz.components.action.Write;
import org.jboss.security.authz.components.action.Manage;
-import org.jboss.security.authz.components.subject.Roles;
import org.jboss.security.authz.policy.server.PolicyServer;
-import org.jboss.security.authz.tools.GeneralTool;
+
import org.jboss.security.xacml.interfaces.XACMLConstants;
import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
@@ -82,6 +79,42 @@
//Go ahead and produce a RequestContext for a "Permit" Enforcement
this.enforce(this.createRequest(resource, new Write()), true);
}
+
+ public void testWriteImpliedWithManage() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/blah/index.html"));
+ resource.setOperation(new Write());
+ resource.addAllowed("user");
+
+
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+
+ policyServer.newPolicy(metadata);
+ this.assertServerState();
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ this.enforce(this.createRequest(resource, new Manage()), true);
+ }
+
+ public void testWriteNotImpliedWithRead() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/blah/index.html"));
+ resource.setOperation(new Write());
+ resource.addAllowed("user");
+
+
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+
+ policyServer.newPolicy(metadata);
+ this.assertServerState();
+
+ //Go ahead and produce a RequestContext for a "Deny" Enforcement
+ this.enforce(this.createRequest(resource, new Read()), false);
+ }
//------------------------------------------------------------------------------------------------------------------------------------------------------
private Request createRequest(URIResource uriResource, Operation operation) throws Exception
{
17 years, 2 months
JBoss Portal SVN: r12799 - in modules/authorization/trunk: core-components/src/main/java/org/jboss/security/authz/components/action and 8 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-02-09 04:06:31 -0500 (Mon, 09 Feb 2009)
New Revision: 12799
Added:
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Operation.java
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/URIResource.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java
Removed:
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/http/
Modified:
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Manage.java
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Read.java
modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Write.java
modules/authorization/trunk/core-components/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java
modules/authorization/trunk/policy-server/pom.xml
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/HierarchialPolicy.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java
Log:
more core-component robustness
Modified: modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Manage.java
===================================================================
--- modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Manage.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Manage.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -22,69 +22,38 @@
package org.jboss.security.authz.components.action;
import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.model.AttributeExpression;
import org.jboss.security.authz.model.Action;
-import org.jboss.security.authz.model.Target;
import org.jboss.security.xacml.interfaces.XACMLConstants;
import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
/**
- * Read represents a "Manage" action that can be performed on a Resource
+ * Read represents a "manage" action that can be performed on a Resource
*
- * Management of a Resource involves all kinds of operations including Reading and Writing
+ * Management of a Resource involves all kinds of operations including read, write, delete, rename, move etc
*
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public class Manage
+public class Manage extends Operation
{
public Manage()
{
-
- }
- //-----Services for Policy Generation------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * A Target used for Matching a "MANAGE" Action within a Policy Definition
- *
- * @return target
- */
- public Target getTarget()
- {
- Target target = new Target();
-
- AttributeExpression expression = new AttributeExpression();
- expression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING, "MANAGE");
- expression.setAttribute(attribute);
-
- target.addActionMatch(expression);
-
- return target;
+ this.name = "manage";
}
- //-----Services for Request Generation----------------------------------------------------------------------------------------------------------------------
- /**
- * Creates a "MANAGE" Action for the RequestContext
- *
- * @return action
- */
+
+ @Override
public Action getAction()
{
- Action action = new Action();
-
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING,
- "MANAGE"
- );
- Attribute impliesRead = new Attribute(XACMLConstants.ATTRIBUTEID_IMPLIED_ACTION,
+ Action action = super.getAction();
+
+ Attribute impliesRead = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
XMLSchemaConstants.DATATYPE_STRING,
- "READ"
+ new Read().getName()
);
- Attribute impliesWrite = new Attribute(XACMLConstants.ATTRIBUTEID_IMPLIED_ACTION,
+ Attribute impliesWrite = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
XMLSchemaConstants.DATATYPE_STRING,
- "WRITE"
+ new Write().getName()
);
- action.addAttribute(attribute);
action.addAttribute(impliesRead);
action.addAttribute(impliesWrite);
Added: modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Operation.java
===================================================================
--- modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Operation.java (rev 0)
+++ modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Operation.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -0,0 +1,87 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.authz.components.action;
+
+import org.jboss.security.authz.model.Attribute;
+import org.jboss.security.authz.model.AttributeExpression;
+import org.jboss.security.authz.model.Target;
+import org.jboss.security.authz.model.Action;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
+
+/**
+ * Represents any Operation that can be performed on a Resource
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public abstract class Operation
+{
+ protected String name;
+
+ public Operation()
+ {
+
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+ //-------Policy Generation Services---------------------------------------------------------------------------------------------------------------------
+ /**
+ * A Target used for Matching this Action within a Policy Definition
+ *
+ * @return target
+ */
+ public Target getTarget()
+ {
+ Target target = new Target();
+
+ AttributeExpression expression = new AttributeExpression();
+ expression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
+ Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
+ XMLSchemaConstants.DATATYPE_STRING, this.name);
+ expression.setAttribute(attribute);
+
+ target.addActionMatch(expression);
+
+ return target;
+ }
+ //-------Request Context Generation Services-------------------------------------------------------------------------------------------------------------
+ /**
+ * Creates this Action for the RequestContext
+ *
+ * @return action
+ */
+ public Action getAction()
+ {
+ Action action = new Action();
+
+ Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
+ XMLSchemaConstants.DATATYPE_STRING,
+ this.name
+ );
+ action.addAttribute(attribute);
+
+ return action;
+ }
+}
Modified: modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Read.java
===================================================================
--- modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Read.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Read.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -21,61 +21,15 @@
*/
package org.jboss.security.authz.components.action;
-import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.model.AttributeExpression;
-import org.jboss.security.authz.model.Action;
-import org.jboss.security.authz.model.Target;
-
-import org.jboss.security.xacml.interfaces.XACMLConstants;
-import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
-
/**
* Read represents a "read" action that can be performed on a Resource
*
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public class Read
+public class Read extends Operation
{
public Read()
{
-
- }
- //-----Services for Policy Generation------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * A Target used for Matching a "READ" Action within a Policy Definition
- *
- * @return target
- */
- public Target getTarget()
- {
- Target target = new Target();
-
- AttributeExpression expression = new AttributeExpression();
- expression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING, "READ");
- expression.setAttribute(attribute);
-
- target.addActionMatch(expression);
-
- return target;
- }
- //-----Services for Request Generation----------------------------------------------------------------------------------------------------------------------
- /**
- * Creates a "READ" Action for the RequestContext
- *
- * @return action
- */
- public Action getAction()
- {
- Action action = new Action();
-
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING,
- "READ"
- );
- action.addAttribute(attribute);
-
- return action;
- }
+ this.name = "read";
+ }
}
Modified: modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Write.java
===================================================================
--- modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Write.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/action/Write.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -22,65 +22,34 @@
package org.jboss.security.authz.components.action;
import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.model.AttributeExpression;
import org.jboss.security.authz.model.Action;
-import org.jboss.security.authz.model.Target;
import org.jboss.security.xacml.interfaces.XACMLConstants;
import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
/**
- * Read represents a "Write" action that can be performed on a Resource
+ * Read represents a "write" action that can be performed on a Resource
*
* Write operation also implies that read operations are implied
*
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public class Write
+public class Write extends Operation
{
public Write()
{
-
+ this.name = "write";
}
- //-----Services for Policy Generation------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * A Target used for Matching a "WRITE" Action within a Policy Definition
- *
- * @return target
- */
- public Target getTarget()
- {
- Target target = new Target();
-
- AttributeExpression expression = new AttributeExpression();
- expression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING, "WRITE");
- expression.setAttribute(attribute);
-
- target.addActionMatch(expression);
-
- return target;
- }
- //-----Services for Request Generation----------------------------------------------------------------------------------------------------------------------
- /**
- * Creates a "WRITE" Action for the RequestContext
- *
- * @return action
- */
+
+ @Override
public Action getAction()
{
- Action action = new Action();
-
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING,
- "WRITE"
- );
- Attribute impliesRead = new Attribute(XACMLConstants.ATTRIBUTEID_IMPLIED_ACTION,
+ Action action = super.getAction();
+
+ Attribute impliesRead = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
XMLSchemaConstants.DATATYPE_STRING,
- "READ"
+ new Read().getName()
);
- action.addAttribute(attribute);
action.addAttribute(impliesRead);
return action;
Copied: modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java (from rev 12795, modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/http/HttpResource.java)
===================================================================
--- modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java (rev 0)
+++ modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.authz.components.resource;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
+
+import org.jboss.security.authz.model.AttributeExpression;
+import org.jboss.security.authz.model.Attribute;
+import org.jboss.security.authz.model.Resource;
+import org.jboss.security.authz.model.PolicyMetaData;
+import org.jboss.security.authz.xacml.ExpressionBuilder;
+
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
+
+/**
+ * The HttpResource Policy Component represents a System Resource available via the HTTP Protocol
+ *
+ * This Component provides an easy to use Developer API for generating commonly used Expressions/Logic related to Http information that must be
+ * represented within an Authorization Policy
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class HttpResource extends URIResource
+{
+ /**
+ * The HTTP Parameters that are used to access this resource
+ */
+ private Map<String, String> parameters;
+
+ /**
+ *
+ */
+ public HttpResource()
+ {
+ this.parameters = new HashMap<String, String>();
+ }
+
+ public Map<String, String> getParameters()
+ {
+ if(this.parameters == null)
+ {
+ this.parameters = new HashMap<String, String>();
+ }
+ return parameters;
+ }
+
+
+ public void setParameters(Map<String, String> parameters)
+ {
+ this.parameters = parameters;
+ }
+
+ public void addParameter(String name, String value)
+ {
+ this.getParameters().put(name, value);
+ }
+ //-------Services for Policy Creation---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Produces PolicyMeta used to generate a Policy object to be registered with the Policy Server
+ *
+ * @return the policy meta data
+ */
+ public PolicyMetaData getPolicyMetaData()
+ {
+ PolicyMetaData metadata = super.getPolicyMetaData();
+
+ if(!this.getParameters().isEmpty())
+ {
+ Set<String> names = this.parameters.keySet();
+ for(String name: names)
+ {
+ String value = this.parameters.get(name);
+
+ AttributeExpression paramExpression = ExpressionBuilder.getInstance().createCustomResourceExpression(name, value);
+ metadata.getTarget().addResourceMatch(paramExpression);
+ }
+ }
+
+ return metadata;
+ }
+ //---------Services for RequestContext Generation------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Represents the Resource that is currently being accessed
+ *
+ * @return the Resource
+ */
+ public Resource getResource()
+ {
+ Resource urlResource = super.getResource();
+
+ if(!this.getParameters().isEmpty())
+ {
+ Set<String> names = this.parameters.keySet();
+ for(String name: names)
+ {
+ String value = this.parameters.get(name);
+
+ Attribute customAttribute = new Attribute();
+ customAttribute.setUri(name);
+ customAttribute.setDatatType(XMLSchemaConstants.DATATYPE_STRING);
+ customAttribute.setValue(value);
+ urlResource.addAttribute(customAttribute);
+ }
+ }
+
+ return urlResource;
+ }
+}
Added: modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/URIResource.java
===================================================================
--- modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/URIResource.java (rev 0)
+++ modules/authorization/trunk/core-components/src/main/java/org/jboss/security/authz/components/resource/URIResource.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -0,0 +1,235 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.authz.components.resource;
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.security.authz.model.PolicyMetaData;
+import org.jboss.security.authz.model.Target;
+import org.jboss.security.authz.model.Rule;
+import org.jboss.security.authz.model.AttributeExpression;
+import org.jboss.security.authz.model.Resource;
+import org.jboss.security.authz.model.Attribute;
+import org.jboss.security.authz.xacml.ExpressionBuilder;
+import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.components.action.Operation;
+
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
+
+/**
+ * Represents any System Resource uniquely identified by a URI
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class URIResource
+{
+ /**
+ * The unique URI that identifies this resource
+ */
+ protected URI uri;
+
+ /**
+ * Roles that are allowed access to this resource
+ */
+ protected Roles allowed;
+
+ /**
+ * Roles that are denied access to this resource
+ */
+ protected Roles denied;
+
+ /**
+ * Operation allowed on this resource
+ */
+ protected Operation operation;
+
+
+ public URIResource()
+ {
+
+ }
+
+ public URI getUri()
+ {
+ return uri;
+ }
+
+ public void setUri(URI uri)
+ {
+ this.uri = uri;
+ }
+
+ public Roles getAllowed()
+ {
+ if(this.allowed == null)
+ {
+ this.allowed = new Roles();
+ }
+ return allowed;
+ }
+
+ public void setAllowed(Roles allowed)
+ {
+ this.allowed = allowed;
+ }
+
+ public void addAllowed(String name)
+ {
+ this.getAllowed().addName(name);
+ }
+
+ public Roles getDenied()
+ {
+ if(this.denied == null)
+ {
+ this.denied = new Roles();
+ }
+ return denied;
+ }
+
+ public void setDenied(Roles denied)
+ {
+ this.denied = denied;
+ }
+
+ public void addDenied(String name)
+ {
+ this.getDenied().addName(name);
+ }
+
+ public Operation getOperation()
+ {
+ return operation;
+ }
+
+ public void setOperation(Operation operation)
+ {
+ this.operation = operation;
+ }
+ //-------Policy Services--------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Creates a Policy Target suggesting that the Policy should apply to this HttpResource
+ *
+ * @param matchAllParameters 'true' = include matching of all the parameters, 'false' = only url matching, parameters are excluded
+ */
+ private Target getTarget()
+ {
+ if(this.uri == null)
+ {
+ throw new IllegalStateException("URI Cannot Be Empty");
+ }
+
+ Target target = new Target();
+
+ AttributeExpression urlExpression = ExpressionBuilder.getInstance().createResourceIdExpression(this.uri.toString());
+ target.addResourceMatch(urlExpression);
+
+
+ return target;
+ }
+
+ /**
+ * Creates a Policy Rule suggesting the allowed roles are permitted access to the 'Resource' designated in the Policy
+ *
+ * @return the rule
+ */
+ private Rule allowIfUserHasRole()
+ {
+ Rule rule = this.getAllowed().allowIfUserHasRole();
+
+ if(this.operation != null)
+ {
+ rule.setTarget(this.operation.getTarget());
+ }
+
+ return rule;
+ }
+
+ /**
+ * Creates a Policy Rule suggesting the denied roles are denied access to the 'Resource' designated in the Policy
+ *
+ * @return the role
+ */
+ private Rule denyIfUserHasRole()
+ {
+ Rule rule = this.getDenied().denyIfUserHasRole();
+
+ if(this.operation != null)
+ {
+ rule.setTarget(this.operation.getTarget());
+ }
+
+ return rule;
+ }
+
+ /**
+ * Produces PolicyMeta used to generate a Policy object to be registered with the Policy Server
+ *
+ * @return the policy meta data
+ */
+ public PolicyMetaData getPolicyMetaData()
+ {
+ PolicyMetaData metadata = new PolicyMetaData();
+
+ Target target = this.getTarget();
+
+ Set<Rule> rules = new HashSet<Rule>();
+
+ //Permitted Roles
+ if(this.allowed != null)
+ {
+ rules.add(this.allowIfUserHasRole());
+ }
+
+ //Denied Roles
+ if(this.denied != null)
+ {
+ rules.add(this.denyIfUserHasRole());
+ }
+
+ metadata.setTarget(target);
+ metadata.setRules(rules);
+
+ return metadata;
+ }
+ //-------Request Context Services---------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Represents the Resource that is currently being accessed
+ *
+ * @return the Resource
+ */
+ public Resource getResource()
+ {
+ Resource uriResource = new Resource();
+
+ Attribute attribute = new Attribute();
+ attribute.setUri(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
+ attribute.setDatatType(XMLSchemaConstants.DATATYPE_STRING);
+ attribute.setValue(this.uri.toString());
+ uriResource.addAttribute(attribute);
+
+ return uriResource;
+ }
+}
Modified: modules/authorization/trunk/core-components/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java
===================================================================
--- modules/authorization/trunk/core-components/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/core-components/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -23,12 +23,13 @@
import java.util.HashSet;
import java.util.Set;
+import java.net.URI;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
-import org.jboss.security.authz.components.http.HttpResource;
+import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.model.Target;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.model.Rule;
@@ -45,9 +46,9 @@
public void testGetURLTargetNoParameters() throws Exception
{
HttpResource httpResource = new HttpResource();
- httpResource.setUrl("/portal/admin-tool/modifyLayout");
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
- Policy policy = new MockPolicy("testGetURLTargetNoParameters", httpResource.getPolicyMetaData(false));
+ Policy policy = new MockPolicy("testGetURLTargetNoParameters", httpResource.getPolicyMetaData());
log.info("------------------------------------------------------------------");
log.info(policy.generateXACMLPolicy());
@@ -56,12 +57,12 @@
public void testGetURLTargetWithParameters() throws Exception
{
HttpResource httpResource = new HttpResource();
- httpResource.setUrl("/portal/admin-tool/modifyLayout");
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
httpResource.addParameter("test1", "test1://value");
httpResource.addParameter("test2", "test2://value");
- Policy policy = new MockPolicy("testGetURLTargetWithParameters", httpResource.getPolicyMetaData(true));
+ Policy policy = new MockPolicy("testGetURLTargetWithParameters", httpResource.getPolicyMetaData());
log.info("------------------------------------------------------------------");
log.info(policy.generateXACMLPolicy());
@@ -70,13 +71,13 @@
public void testRoleRules() throws Exception
{
HttpResource httpResource = new HttpResource();
- httpResource.setUrl("/portal/admin-tool/modifyLayout");
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
httpResource.addParameter("test1", "test1://value");
httpResource.addParameter("test2", "test2://value");
- httpResource.addAllowedRole("admin");
- httpResource.addDeniedRole("anonymous");
+ httpResource.addAllowed("admin");
+ httpResource.addDenied("anonymous");
- Policy policy = new MockPolicy("testRoleRules", httpResource.getPolicyMetaData(true));
+ Policy policy = new MockPolicy("testRoleRules", httpResource.getPolicyMetaData());
log.info("------------------------------------------------------------------");
log.info(policy.generateXACMLPolicy());
@@ -85,13 +86,13 @@
public void testIPRules() throws Exception
{
HttpResource httpResource = new HttpResource();
- httpResource.setUrl("/portal/admin-tool/modifyLayout");
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
httpResource.addParameter("test1", "test1://value");
httpResource.addParameter("test2", "test2://value");
- httpResource.addAllowedRole("admin");
- httpResource.addDeniedRole("anonymous");
+ httpResource.addAllowed("admin");
+ httpResource.addDenied("anonymous");
- Policy policy = new MockPolicy("testIPRules", httpResource.getPolicyMetaData(true));
+ Policy policy = new MockPolicy("testIPRules", httpResource.getPolicyMetaData());
log.info("------------------------------------------------------------------");
log.info(policy.generateXACMLPolicy());
Modified: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.security.authz.http.configuration;
+import java.net.URI;
import java.io.IOException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -37,7 +38,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-import org.jboss.security.authz.components.http.HttpResource;
+import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.policy.server.plugin.HierarchialPolicy;
import org.jboss.security.authz.policy.server.spi.PolicyConfig;
@@ -82,7 +83,7 @@
this.parseRules(httpResource, aclRuleElem);
//Generate the policy from the HttpResource component
- Policy policy = new HierarchialPolicy(policyUri, httpResource.getPolicyMetaData(true));
+ Policy policy = new HierarchialPolicy(policyUri, httpResource.getPolicyMetaData());
cour.add(policy);
}
@@ -116,7 +117,7 @@
//Add RequestUri as a Resource To Match
String requestUri = requestUriElem.getTextContent();
- httpResource.setUrl(requestUri);
+ httpResource.setUri(new URI(requestUri));
//Process Parameters
NodeList parameters = resourceElem.getElementsByTagName("param");
@@ -166,7 +167,7 @@
{
Element roleNameElem = (Element)roleNodes.item(j);
String roleName = roleNameElem.getTextContent();
- httpResource.addAllowedRole(roleName);
+ httpResource.addAllowed(roleName);
}
}
Modified: modules/authorization/trunk/policy-server/pom.xml
===================================================================
--- modules/authorization/trunk/policy-server/pom.xml 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/policy-server/pom.xml 2009-02-09 09:06:31 UTC (rev 12799)
@@ -65,7 +65,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<configuration>
- <includes>
+ <includes>
</includes>
</configuration>
</plugin>
Modified: modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java
===================================================================
--- modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -25,6 +25,7 @@
import org.apache.log4j.Logger;
+import org.jboss.security.authz.xacml.PolicyUtil;
import org.jboss.security.authz.enforcement.Request;
import org.jboss.security.authz.enforcement.Response;
import org.jboss.security.authz.policy.server.PolicyServerException;
@@ -101,15 +102,19 @@
{
Response response = new Response();
- RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
requestContext.setRequest(request.encode());
+ //requestContext.marshall(System.out);
+
RequestCtx xacmlRequestCtx = (RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX);
ResponseCtx xacmlResponseCtx = this.policyDecisionPoint.evaluate(xacmlRequestCtx);
ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
responseContext.set(XACMLConstants.RESPONSE_CTX, xacmlResponseCtx);
+ //responseContext.marshall(System.out);
+
if(responseContext.getDecision() == XACMLConstants.DECISION_PERMIT)
{
response.setAccessGranted(true);
Modified: modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/HierarchialPolicy.java
===================================================================
--- modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/HierarchialPolicy.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/HierarchialPolicy.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -156,8 +156,11 @@
}
//Process the Rule Expression/Condition
- ConditionType condition = this.generateCondition(objectFactory, rule.getExpression());
- ruleType.setCondition(condition);
+ if(rule.getExpression() != null)
+ {
+ ConditionType condition = this.generateCondition(objectFactory, rule.getExpression());
+ ruleType.setCondition(condition);
+ }
policyType.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(ruleType);
}
Added: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java (rev 0)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -0,0 +1,136 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.authz.policy.server;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.model.Attribute;
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.model.PolicyMetaData;
+import org.jboss.security.authz.model.Rule;
+import org.jboss.security.authz.model.Effect;
+import org.jboss.security.authz.model.Resource;
+import org.jboss.security.authz.model.Subject;
+import org.jboss.security.authz.enforcement.Request;
+import org.jboss.security.authz.enforcement.Response;
+import org.jboss.security.authz.components.resource.URIResource;
+import org.jboss.security.authz.components.action.Operation;
+import org.jboss.security.authz.components.action.Read;
+import org.jboss.security.authz.components.action.Write;
+import org.jboss.security.authz.components.action.Manage;
+import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.policy.server.PolicyServer;
+import org.jboss.security.authz.tools.GeneralTool;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class TestImpliedActions extends TestCase
+{
+ private static Logger log = Logger.getLogger(TestImpliedActions.class);
+
+ private PolicyServer policyServer;
+
+ public void setUp() throws Exception
+ {
+ Server.bootstrap();
+ this.policyServer = (PolicyServer)Server.lookup("/policy-server/PolicyServer");
+ }
+
+ public void tearDown() throws Exception
+ {
+ }
+
+ public void testReadImpliedWithWrite() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/blah/index.html"));
+ resource.setOperation(new Read());
+ resource.addAllowed("user");
+
+
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+
+ policyServer.newPolicy(metadata);
+ this.assertServerState();
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ this.enforce(this.createRequest(resource, new Write()), true);
+ }
+ //------------------------------------------------------------------------------------------------------------------------------------------------------
+ private Request createRequest(URIResource uriResource, Operation operation) throws Exception
+ {
+ //Create a RequestType
+ Request request = new Request();
+
+ //Create Resource
+ Resource urlResource = uriResource.getResource();
+ request.addResource(urlResource);
+
+ //Create Subjects
+ Subject subject = new Subject();
+ Attribute subjectAttr = new Attribute(XACMLConstants.ATTRIBUTEID_ROLE,
+ XMLSchemaConstants.DATATYPE_STRING, "user");
+ subject.addAttribute(subjectAttr);
+ request.addSubject(subject);
+
+ //Create Action
+ request.setAction(operation.getAction());
+
+ return request;
+ }
+
+ private void enforce(Request request, boolean mustBePermitted) throws Exception
+ {
+
+ Response response = this.policyServer.evaluate(request);
+
+ assertNotNull(response);
+ log.info("-----------------------------------");
+ log.info("Decision="+response.getMessage());
+
+ if(mustBePermitted)
+ {
+ assertTrue("Access must be granted!!!", response.isAccessGranted());
+ }
+ else
+ {
+ assertFalse("Access must be denied!!!", response.isAccessGranted());
+ }
+ }
+
+ private void assertServerState() throws Exception
+ {
+ //Assert Policy State of the Server
+ Policy[] policies = policyServer.readAllPolicies();
+
+ assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
+ log.info("------------------------------------------------------------------------------");
+ log.info(policies[0].generateXACMLPolicy());
+ }
+}
Modified: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -21,11 +21,12 @@
*/
package org.jboss.security.authz.policy.server;
+import java.net.URI;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.components.http.HttpResource;
+import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.policy.server.PolicyServer;
/**
@@ -50,10 +51,10 @@
public void testNewPolicy() throws Exception
{
HttpResource httpResource = new HttpResource();
- httpResource.setUrl("/blah/index.html");
+ httpResource.setUri(new URI("/blah/index.html"));
httpResource.addParameter("param1", "param1Value");
- policyServer.newPolicy(httpResource.getPolicyMetaData(true));
+ policyServer.newPolicy(httpResource.getPolicyMetaData());
//Assert Policy State of the Server
Policy[] policies = policyServer.readAllPolicies();
Modified: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java 2009-02-09 04:14:02 UTC (rev 12798)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java 2009-02-09 09:06:31 UTC (rev 12799)
@@ -21,6 +21,8 @@
*/
package org.jboss.security.authz.policy.server.plugin;
+import java.net.URI;
+
import junit.framework.TestCase;
import org.apache.log4j.Logger;
@@ -30,7 +32,7 @@
import org.jboss.security.authz.model.Subject;
import org.jboss.security.authz.model.Action;
import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.components.http.HttpResource;
+import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.enforcement.Request;
import org.jboss.security.authz.enforcement.Response;
import org.jboss.security.authz.policy.server.PolicyServer;
@@ -61,12 +63,12 @@
public void testNewPolicyEnforcement() throws Exception
{
HttpResource httpResource = new HttpResource();
- httpResource.setUrl("/blah/index.html");
+ httpResource.setUri(new URI("/blah/index.html"));
httpResource.addParameter("param1", "param1Value");
httpResource.addParameter("param2", "param2Value");
- httpResource.addAllowedRole("Admin");
+ httpResource.addAllowed("Admin");
- PolicyMetaData policyMetaData = httpResource.getPolicyMetaData(true);
+ PolicyMetaData policyMetaData = httpResource.getPolicyMetaData();
policyServer.newPolicy(policyMetaData);
17 years, 2 months
JBoss Portal SVN: r12798 - modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet.
by portal-commits@lists.jboss.org
Author: mwringe
Date: 2009-02-08 23:14:02 -0500 (Sun, 08 Feb 2009)
New Revision: 12798
Modified:
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java
Log:
Fix issue with NPE if the security constraints did not exist in the instances.xml file.
Modified: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java 2009-02-09 04:01:50 UTC (rev 12797)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java 2009-02-09 04:14:02 UTC (rev 12798)
@@ -164,7 +164,11 @@
PolicyPermissionMetaData policyPermission = new PolicyPermissionMetaData();
policyPermission.setActionName("view");
policyPermission.setRoleName("__unchecked__".intern());
- securityConstraints.getPolicyPermission().add(policyPermission);
+
+ List<PolicyPermissionMetaData> policyPermissions = new ArrayList<PolicyPermissionMetaData>();
+ policyPermissions.add(policyPermission);
+
+ securityConstraints.setPolicyPermission(policyPermissions);
}
HashSet<RoleSecurityBinding> bindings = new HashSet<RoleSecurityBinding>();
17 years, 2 months
JBoss Portal SVN: r12797 - modules/deployer/trunk.
by portal-commits@lists.jboss.org
Author: mwringe
Date: 2009-02-08 23:01:50 -0500 (Sun, 08 Feb 2009)
New Revision: 12797
Modified:
modules/deployer/trunk/pom.xml
Log:
Fix accidental overwrite that happened with the last commit.
Modified: modules/deployer/trunk/pom.xml
===================================================================
--- modules/deployer/trunk/pom.xml 2009-02-09 03:49:06 UTC (rev 12796)
+++ modules/deployer/trunk/pom.xml 2009-02-09 04:01:50 UTC (rev 12797)
@@ -1,159 +1,41 @@
<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">
-<!-- <parent>
- <groupId>org.jboss.portal</groupId>
- <artifactId>jboss-portal-parent</artifactId>
- <version>1-SNAPSHOT</version>
- </parent> -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.deployer</groupId>
- <artifactId>module-parent</artifactId>
+ <artifactId>module-aggregator</artifactId>
<packaging>pom</packaging>
<name>JBoss Portal Deployer</name>
<version>trunk-SNAPSHOT</version>
- <url>http://labs.jboss.com/jbossportal</url>
- <properties>
- <version.assembly>2.2-beta-2</version.assembly>
- <version.jboss.aop>1.0.0.GA</version.jboss.aop>
- <version.jboss.aspects>1.0.0.GA</version.jboss.aspects>
- <version.jboss-deployers>2.2.0-SNAPSHOT</version.jboss-deployers>
- <version.jboss-metadata>1.0.0.CR1</version.jboss-metadata>
- <version.jboss.portal>2.8-SNAPSHOT</version.jboss.portal>
- <version.jboss.portal.metadata>trunk-SNAPSHOT</version.jboss.portal.metadata>
- <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
- <version.jboss.portal.portlet>2.1.0-SNAPSHOT</version.jboss.portal.portlet>
- <version.jboss.portal.server>2.7.0.GA</version.jboss.portal.server>
- <version.jboss.portlet.server>2.7.0</version.jboss.portlet.server>
- <version.jboss-as>5.0.0.CR2</version.jboss-as>
- <version.saxon>6.5.3</version.saxon>
- </properties>
-
- <repositories>
+ <distributionManagement>
<repository>
+ <!--Copy the distribution jar file to a local checkout of the maven repository
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
<id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
+ <url>file://${jboss.repository.root}</url>
</repository>
- <repository>
+ <snapshotRepository>
<id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-<!-- <pluginRepositories>
- <pluginRepository>
- <id>maven.jboss.org</id>
- <name>JBoss Maven Repository</name>
- <url>http://repository.jboss.com/maven2</url>
- </pluginRepository>
- </pluginRepositories> -->
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ <uniqueVersion>true</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+ <modules>
+ <module>build</module>
+ <module>deployer</module>
+ </modules>
- <build>
+ <reporting>
<plugins>
<plugin>
- <artifactId>maven-source-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
</plugin>
</plugins>
- </build>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-spi</artifactId>
- <version>${version.jboss-deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <version>${version.jboss-deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata</artifactId>
- <version>${version.jboss-metadata}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-server</artifactId>
- <version>${version.jboss-as}</version>
- </dependency>
- <dependency>
- <groupId>saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>${version.saxon}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.metadata</groupId>
- <artifactId>metadata-metadata</artifactId>
- <version>${version.jboss.portal.metadata}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.web</groupId>
- <artifactId>web-web</artifactId>
- <version>${version.jboss.portal.web}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.portlet</groupId>
- <artifactId>portlet-portlet</artifactId>
- <version>${version.jboss.portal.portlet}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.portlet</groupId>
- <artifactId>portlet-mc</artifactId>
- <version>${version.jboss.portal.portlet}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.core</groupId>
- <artifactId>server</artifactId>
- <version>${version.jboss.portal.server}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.server</groupId>
- <artifactId>portlet-server</artifactId>
- <version>${version.jboss.portlet.server}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.core</groupId>
- <artifactId>core</artifactId>
- <version>${version.jboss.portal.server}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.portal.core</groupId>
- <artifactId>security</artifactId>
- <version>${version.jboss.portal.server}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jbossaop-plugin</artifactId>
- <version>${version.jboss.aop}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-transaction-aspects</artifactId>
- <version>${version.jboss.aspects}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-security-aspects</artifactId>
- <version>${version.jboss.aspects}</version>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
+ </reporting>
</project>
17 years, 2 months
JBoss Portal SVN: r12796 - in modules/deployer/trunk: build and 10 other directories.
by portal-commits@lists.jboss.org
Author: mwringe
Date: 2009-02-08 22:49:06 -0500 (Sun, 08 Feb 2009)
New Revision: 12796
Added:
modules/deployer/trunk/deployer/src/main/deployer/conf/
modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml
modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java
modules/deployer/trunk/deployer/src/main/resources/base-aop.xml
modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml
Modified:
modules/deployer/trunk/build/pom.xml
modules/deployer/trunk/deployer/pom.xml
modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/WebDeploymentListener.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java
modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java
modules/deployer/trunk/pom.xml
Log:
Update deployer code improvements.
Modified: modules/deployer/trunk/build/pom.xml
===================================================================
--- modules/deployer/trunk/build/pom.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/build/pom.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -1,10 +1,10 @@
<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">
- <parent>
+<!-- <parent>
<groupId>org.jboss.portal</groupId>
<artifactId>jboss-portal-parent</artifactId>
<version>1.0.0</version>
- </parent>
+ </parent> -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.deployer</groupId>
<artifactId>module-parent</artifactId>
@@ -15,7 +15,9 @@
<properties>
<version.assembly>2.2-beta-2</version.assembly>
- <version.jboss-deployers>2.0.0.CR1</version.jboss-deployers>
+ <version.jboss.aop>1.0.0.GA</version.jboss.aop>
+ <version.jboss.aspects>1.0.0.GA</version.jboss.aspects>
+ <version.jboss-deployers>2.2.0-SNAPSHOT</version.jboss-deployers>
<version.jboss-metadata>1.0.0.CR1</version.jboss-metadata>
<version.jboss.portal>2.8-SNAPSHOT</version.jboss.portal>
<version.jboss.portal.metadata>trunk-SNAPSHOT</version.jboss.portal.metadata>
@@ -50,7 +52,15 @@
</releases>
</repository>
</repositories>
+<!-- <pluginRepositories>
+ <pluginRepository>
+ <id>maven.jboss.org</id>
+ <name>JBoss Maven Repository</name>
+ <url>http://repository.jboss.com/maven2</url>
+ </pluginRepository>
+ </pluginRepositories> -->
+
<build>
<plugins>
<plugin>
@@ -121,7 +131,28 @@
<artifactId>core</artifactId>
<version>${version.jboss.portal.server}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>security</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>${version.jboss.aop}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-transaction-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
Modified: modules/deployer/trunk/deployer/pom.xml
===================================================================
--- modules/deployer/trunk/deployer/pom.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/pom.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -66,21 +66,59 @@
<groupId>org.jboss.portal.core</groupId>
<artifactId>core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>security</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>test</artifactId>
+ <version>0.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-transaction-aspects</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
<build>
+
+<pluginManagement>
+<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+</plugin>
+</plugins>
+</pluginManagement>
+
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>iso-8859-1</encoding>
+ <source>1.5</source>
+ <target>1.5</target>
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
- <version>${version.assembly}</version>
+ <!-- <version>${version.assembly}</version> -->
<configuration>
<finalName>jboss-portal.deployer</finalName>
<descriptors>
@@ -98,12 +136,46 @@
</executions>
</plugin>
-
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <excludes>
+ <exclude>**/base-aop.xml</exclude>
+ <exclude>**/deployment-aop.xml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>${version.jboss.aop}</version>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <configuration>
+ <includeProjectDependency>true</includeProjectDependency>
+ <aoppaths>
+ <aoppath>src/main/resources/base-aop.xml</aoppath>
+ <aoppath>src/main/resources/deployment-aop.xml</aoppath>
+ </aoppaths>
+ <includes>
+ <include>org/jboss/portal/deployer/portlet/InstanceDeployerImpl.class</include>
+ </includes>
+ </configuration>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
- <properties/>
+<!-- <properties/> -->
</project>
Modified: modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml
===================================================================
--- modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/src/assemble/jboss-portal-deployer-components.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -1,13 +1,18 @@
<component>
<fileSets>
-
<fileSet>
<directory>src/main/deployer</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
-
</fileSets>
+ <files>
+ <file>
+ <source>src/main/resources/deployment-aop.xml</source>
+ <outputDirectory>/</outputDirectory>
+ </file>
+ </files>
+
</component>
Modified: modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -95,6 +95,11 @@
<property name="entityResolver"><inject bean="PortalEntityResolver"/></property>
</bean>
+ <bean name="MergedPortletParsingDeployer" class="org.jboss.portal.deployer.parsing.MergedPortletParsingDeployer">
+ <property name="standardPortletFileLocation">conf/standardjboss-portlet.xml</property>
+ <property name="entityResolver"><inject bean="PortalEntityResolver"/></property>
+ </bean>
+
<!-- component deployables -->
<!--
where the actual deployment occurs, these classes will send the data to the various runtime containers
@@ -102,11 +107,14 @@
<!-- deployer that makes sure that dependencies are running before continuing -->
<bean name="PortletDependencyDeployer" class="org.jboss.portal.deployer.portlet.PortletDependencyDeployer">
- <!-- <property name="dependencies">
+ <property name="dependencies">
<list elementClass="java.lang.String">
- <value>foo</value>
+ <value>portal:service=InfoBuilderFactory,type=Core</value>
+ <value>portal:service=PortletInvoker,type=Container</value>
+ <value>portal:service=PortletSecurityService</value>
+ <value>portal:container=Instance</value>
</list>
- </property> -->
+ </property>
</bean>
<bean name="CommandServletDeployer" class="org.jboss.portal.deployer.portlet.CommandServletDeployer"/>
@@ -118,7 +126,21 @@
</bean>
<bean name="PortletDeployer" class="org.jboss.portal.deployer.portlet.PortletDeployer">
- <property name="warDeployerOrder"><inject bean="WarDeployer" property="relativeOrder"/></property>
+ <property name="warDeployer"><inject bean="WarDeployer"/></property>
+ <property name="MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
</bean>
+
+ <bean name="InstanceDeployer" class="org.jboss.portal.deployer.portlet.InstanceDeployer">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ <property name="instanceContainerReferenceName">portal:container=Instance</property>
+ </bean>
+ <bean name="PortalObjectDeployer" class="org.jboss.portal.deployer.portlet.ObjectDeployer">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ <property name="portalObjectContainerReferenceName">portal:container=PortalObject</property>
+ <property name="contentProviderRegistryReferenceName">portal:service=ContentProviderRegistry</property>
+ <property name="coordinationConfiguratorReferenceName">portal:service=CoordinationService</property>
+ </bean>
+
</deployment>
Added: modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml (rev 0)
+++ modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,39 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+ <portlet>
+ <portlet-name>DefaultPortlet</portlet-name>
+ <remotable>false</remotable>
+ <ajax>
+ <partial-refresh>true</partial-refresh>
+ </ajax>
+ <transaction>
+ <trans-attribute>NotSupported</trans-attribute>
+ </transaction>
+ </portlet>
+</portlet-app>
Property changes on: modules/deployer/trunk/deployer/src/main/deployer/conf/standardjboss-portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd (rev 0)
+++ modules/deployer/trunk/deployer/src/main/deployer/dtd/portlet-instances_2_6.dtd 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+-->
+
+<!--
+The deployements element is a container for deployment elements.
+-->
+<!ELEMENT deployments (deployment*)>
+
+<!--
+The deployment is a container for an instance element.
+-->
+<!ELEMENT deployment (if-exists?,instance)>
+
+<!--
+The if-exists element is used to define action to take if instance with such name is
+already present. Possible values are overwrite or keep . Overwrite will destroy the
+existing object in the database and create a new one, based on the content of the
+deployment. Keep will maintain the existing object deployment or create a new one if
+it does not yet exist.
+-->
+<!ELEMENT if-exists (#PCDATA)>
+
+<!--
+The instance element is used to create an instance of a portlet from the portlet
+application of the same war file containing the portlet-instances.xml file. The portlet
+will be created and configured only if the portlet is present and an instance with
+such a name does not already exist.
+
+Example :
+
+<instance>
+ <instance-id>MyPortletInstance</instance-id>
+ <portlet-ref>MyPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>abc</name>
+ <value>def</value>
+ </preference>
+ </preferences>
+ <security-constraint>
+ <policy-permission>
+ <role-name>User</role-name>
+ <action-name>view</action-name>
+ </policy-permission>
+ </security-constraint>
+</instance>
+
+-->
+<!ELEMENT instance (instance-id,portlet-ref,display-name*,preferences?,
+ security-constraint?, (display-name* | (resource-bundle, supported-locale+)))>
+
+
+<!ELEMENT resource-bundle (#PCDATA)>
+
+<!ELEMENT supported-locale (#PCDATA)>
+
+
+<!--
+The identifier of the instance.
+-->
+<!ELEMENT instance-id (#PCDATA)>
+
+<!--
+The reference to the portlet which is its portlet name.
+-->
+<!ELEMENT portlet-ref (#PCDATA)>
+
+<!--
+Display name is the string used to represent this instance
+-->
+<!ELEMENT display-name (#PCDATA)>
+<!ATTLIST display-name
+ xml:lang NMTOKEN #IMPLIED
+>
+
+<!--
+The preferences element configures the instance with a specific set of preferences.
+-->
+<!ELEMENT preferences (preference+)>
+
+<!--
+The preference configure one preference of a set of preferences.
+-->
+<!ELEMENT preference (name,value)>
+
+<!--
+A name.
+-->
+<!ELEMENT name (#PCDATA)>
+
+<!--
+A string value.
+-->
+<!ELEMENT value (#PCDATA)>
+
+<!--
+The security-constraint element is a container for policy-permission elements
+
+Examples:
+
+<security-constraint>
+ <policy-permission>
+ <role-name>User</role-name>
+ <action-name>view</action-name>
+ </policy-permission>
+</security-constraint>
+
+<security-constraint>
+ <policy-permission>
+ <unchecked/>
+ <action-name>view</action-name>
+ </policy-permission>
+</security-constraint>
+-->
+<!ELEMENT security-constraint (policy-permission*)>
+
+<!--
+The policy-permission element is used to secure a specific portlet instance based on a
+user's role.
+-->
+<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>
+
+<!--
+The action-name element is used to define the access rights given to the role defined.
+Possible values are:
+
+ * view - Users can view the page.
+ * viewrecursive - Users can view the page and child pages.
+ * personalize - Users are able to view AND personalize the page.
+ * personalizerecursive - Users are able to view AND personalize the page AND its child
+ pages.
+-->
+<!ELEMENT action-name (#PCDATA)>
+
+<!--
+The unchecked element is used to define (if present) that anyone can view this instance
+-->
+<!ELEMENT unchecked EMPTY>
+
+<!--
+The role-name element is used to define a role that this security constraint will apply to
+
+ * <role-name>SOMEROLE</role-name> Access to this instance is limited to the defined role.
+-->
+<!ELEMENT role-name (#PCDATA)>
Modified: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/JBossPortletParsingDeployer.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -23,12 +23,15 @@
package org.jboss.portal.deployer.parsing;
import java.io.InputStream;
+import java.net.URI;
+import java.util.List;
import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.portal.core.deployment.JBossApplicationMetaDataFactory;
+import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
import org.jboss.portal.deployer.PortalEntityResolver;
-import org.jboss.portal.portlet.deployment.jboss.JBossApplicationMetaDataFactory;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -61,7 +64,13 @@
protected JBossApplicationMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossApplicationMetaData root)
throws Exception
- {
+ {
+
+ //VirtualFile vFile = VFS.getVirtualFile(new URI("file:///tmp/testVFS"),"/helloworldportlet.war/WEB-INF/test123");
+// VirtualFile vFile = VFS.getRoot(new URI("file:///home/mwringe/Projects/tld-test/testtld.tld"));
+// System.out.println("VFILE : " + vFile);
+// unit.appendMetaDataFile(vFile);
+
InputStream stream = file.openStream();
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
Added: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java (rev 0)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/parsing/MergedPortletParsingDeployer.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,147 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.deployer.parsing;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.vfs.VirtualFileSerializator;
+import org.jboss.metadata.serviceref.VirtualFileAdaptor;
+import org.jboss.portal.core.deployment.JBossApplicationMetaDataFactory;
+import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.portal.deployer.PortalEntityResolver;
+import org.jboss.portal.metadata.jboss.app.PortalAppMetaData;
+import org.jboss.portal.portlet.deployment.jboss.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
+import org.jboss.virtual.plugins.vfs.VirtualFileUrlStreamHandler;
+import org.jboss.virtual.spi.VirtualFileHandler;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class MergedPortletParsingDeployer extends AbstractDeployer
+{
+ public static final String PORTLET_MERGED_ATTACHMENT_NAME = "merged." + JBossApplicationMetaData.class.getName();
+
+ protected String standardPortletFileLocation;
+ protected PortalEntityResolver entityResolver;
+
+ public MergedPortletParsingDeployer()
+ {
+ setAllInputs(false);
+ setInput(JBossApplicationMetaData.class);
+ addInput(PortletApplication10MetaData.class);
+ setOutput(JBossApplicationMetaData.class);
+ addOutput(PORTLET_MERGED_ATTACHMENT_NAME);
+ this.setStage(DeploymentStages.POST_PARSE);
+ }
+
+ public String getStandardPortletFileLocation()
+ {
+ return standardPortletFileLocation;
+ }
+
+ public void setStandardPortletFileLocation(String standardPortletFileLocation)
+ {
+ this.standardPortletFileLocation = standardPortletFileLocation;
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ JBossApplicationMetaData jbossAppMetaData = unit.getAttachment(JBossApplicationMetaData.class);
+
+ // use the app-name from the jboss-portal-app.xml file if it exists
+ PortalAppMetaData appMetaData = unit.getAttachment(PortalAppMetaData.class);
+ if (jbossAppMetaData.getId() == null && appMetaData != null && appMetaData.getAppName() != null)
+ {
+ jbossAppMetaData.setId(appMetaData.getAppName());
+ }
+
+ try{
+
+ InputStream stream = this.getClass().getClassLoader().getResourceAsStream(standardPortletFileLocation);
+
+ System.out.println("RESOURCE : " + this.getClass().getClassLoader().getResource(standardPortletFileLocation));
+
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setEntityResolver(this.entityResolver);
+
+ JBossApplicationMetaData defaultAppMetaData = (JBossApplicationMetaData) unmarshaller.unmarshal(stream,
+ new JBossApplicationMetaDataFactory(), new JBossApplicationMetaData());
+
+ System.out.println("DEFAULT PORTLETS : " + defaultAppMetaData.getPortlets().get("DefaultPortlet"));
+
+ JBossPortletMetaData defaultPortletMetaData = defaultAppMetaData.getPortlets().get("DefaultPortlet");
+ if (defaultPortletMetaData != null)
+ {
+ PortletApplication10MetaData portletAppMD = unit.getAttachment(PortletApplication10MetaData.class);
+
+ for (PortletMetaData portletMD : portletAppMD.getPortlets().values())
+ {
+ String name = portletMD.getPortletName();
+ JBossPortletMetaData jbossPortletMetaData = jbossAppMetaData.getPortlets().get(name);
+ if (jbossPortletMetaData != null)
+ {
+ jbossPortletMetaData.merge(defaultPortletMetaData);
+ }
+ else
+ {
+ jbossAppMetaData.getPortlets().put(name, (JBossPortletMetaData)defaultPortletMetaData.clone());
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ unit.addAttachment(PORTLET_MERGED_ATTACHMENT_NAME, jbossAppMetaData, JBossApplicationMetaData.class);
+
+ }
+
+ public PortalEntityResolver getEntityResolver()
+ {
+ return entityResolver;
+ }
+
+ public void setEntityResolver(PortalEntityResolver entityResolver)
+ {
+ this.entityResolver = entityResolver;
+ }
+
+}
+
Modified: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/WebDeploymentListener.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/WebDeploymentListener.java 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portal/WebDeploymentListener.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -25,7 +25,7 @@
import org.jboss.web.WebApplication;
/*
- * This is only to get portal 2.7 working with JBoss AS 5 intially, should be replaced with a
+ * This is only to get portal 2.7 working with JBoss AS 5 initially, should be replaced with a
* full deployment implementation.
*
* TODO: remove this file once full deployment has been done.
Added: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java (rev 0)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployer.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008-2009, Red Hat Middleware, LLC, 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.portal.deployer.portlet;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.Kernel;
+import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.deployer.parsing.MergedPortletParsingDeployer;
+import org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData;
+
+/**
+ * Deploys to portlet instances to the portlet instance container
+ * as specified in portlet-instances.xml
+ *
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class InstanceDeployer extends AbstractComponentDeployer
+{
+
+ protected Kernel kernel;
+
+ //default container reference name
+ protected String instanceContainerReferenceName = "portal:container=Instance";
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ public void setInstanceContainerReferenceName (String instanceContainerReferenceName)
+ {
+ this.instanceContainerReferenceName = instanceContainerReferenceName;
+ }
+
+ public InstanceDeployer()
+ {
+ this.setAllInputs(false);
+ this.setInput(PortletDeploymentInstancesMetaData.class);
+
+ // need to call this after merging the portlet.xml metadata to get the proper id.
+ this.addInput(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME);
+
+ // need to call this after the portlet is deployed since the instance container needs to already
+ // have reference to the portlet before an instance of it can be deployed.
+ this.addInput(PortletDeployer.PORLET_DEPLOYED);
+
+ this.setStage(DeploymentStages.INSTALLED);
+ }
+
+
+ @Override
+ public void internalDeploy(DeploymentUnit unit) throws DeploymentException
+ {
+ PortletDeploymentInstancesMetaData portletInstancesMetaData = unit
+ .getAttachment(PortletDeploymentInstancesMetaData.class);
+ JBossApplicationMetaData appMetaData = unit.getAttachment(JBossApplicationMetaData.class);
+
+ InstanceContainer instanceContainer;
+ ControllerContext controllerContext = kernel.getController().getInstalledContext(instanceContainerReferenceName);
+ if (controllerContext == null)
+ {
+ throw new DeploymentException(
+ "Cannot Deploy to Instance Container, cannot get ControllerContext for \"" + instanceContainerReferenceName + "\"");
+ }
+
+ try
+ {
+ instanceContainer = (InstanceContainer) controllerContext.getTarget();
+ InstanceDeployerImpl deployerImpl = new InstanceDeployerImpl(appMetaData.getId(), instanceContainer);
+ deployerImpl.deployInstances(portletInstancesMetaData);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Error deploying instance with portlet id :" + appMetaData.getId(), e);
+ }
+
+ }
+
+
+}
+
Added: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java (rev 0)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/InstanceDeployerImpl.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,183 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.deployer.portlet;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.model.instance.DuplicateInstanceException;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.metadata.portlet.InstanceMetaData;
+import org.jboss.portal.metadata.portlet.PolicyPermissionMetaData;
+import org.jboss.portal.metadata.portlet.PortletDeploymentInstanceMetaData;
+import org.jboss.portal.metadata.portlet.PortletDeploymentInstancesMetaData;
+import org.jboss.portal.metadata.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.metadata.portlet.PortletPreferencesMetaData;
+import org.jboss.portal.metadata.portlet.SecurityConstrainMetaData;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.spi.provider.AuthorizationDomain;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+
+/**
+ * Performs the actual deployment to the Instance Container running in
+ * the portal sar.
+ *
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class InstanceDeployerImpl
+{
+ /*
+ * Note: this class must be separate from the actual deployer class as it
+ * has an AOP dependency for the Transaction Manager. The Transaction Manager
+ * is created after the deployer class is created, but before this class is called.
+ */
+
+ protected final Logger log = Logger.getLogger(getClass());
+
+ protected InstanceContainer instanceContainer;
+
+ protected String appId;
+
+ public InstanceDeployerImpl(String appId, InstanceContainer instanceContainer)
+ {
+ this.appId = appId;
+ this.instanceContainer = instanceContainer;
+ }
+
+ /**
+ * Deploys the instance to the instance container running in the portlet sar.
+ *
+ * @param instancesMetaData The metadata for the instance.
+ * @throws Exception If an exception occurs while deploying the instance
+ */
+ //Requires a transaction to execute properly, setup through aop configuration for the deployer.
+ public void deployInstances(PortletDeploymentInstancesMetaData instancesMetaData) throws Exception
+ {
+ List<PortletDeploymentInstanceMetaData> instancesMD = instancesMetaData.getDeploymentInstances();
+
+ for (int i = 0; i < instancesMD.size(); i++)
+ {
+ PortletDeploymentInstanceMetaData instanceMD = instancesMD.get(i);
+
+ Instance instance = instanceContainer.getDefinition(instanceMD.getInstance().getInstanceId());
+
+ if (instance == null)
+ {
+ createInstance(instanceMD.getInstance());
+ }
+ else if (instanceMD.getOverwrite() == true)
+ {
+ log.debug("Instance " + instanceMD.getInstance().getInstanceId() + " is about to be overwritten");
+ configureInstance(instanceMD.getInstance(), instance);
+ }
+ else
+ {
+ log.debug("Instance " + instanceMD.getInstance().getInstanceId() + " already exists");
+ }
+ }
+ }
+
+ protected void createInstance(InstanceMetaData instanceMD) throws IllegalArgumentException,
+ DuplicateInstanceException, PortletInvokerException
+ {
+ log.debug("Creating portlet instance " + instanceMD.getInstanceId());
+
+ instanceMD.setPortletRef("local." + appId + "." + instanceMD.getPortletRef());
+
+ Instance instance = instanceContainer.createDefinition(instanceMD.getInstanceId(), instanceMD.getPortletRef());
+
+ configureInstance(instanceMD, instance);
+ }
+
+ protected void configureInstance(InstanceMetaData instanceMD, Instance instance)
+ throws PortletInvokerException
+ {
+ log.debug("Configuring portlet instance " + instanceMD.getInstanceId());
+ List<PropertyChange> changes = new ArrayList<PropertyChange>();
+
+ // Reset all preferences that are not overridden
+ PortletPreferencesMetaData preferencesMetaData = instanceMD.getPortletPreferences();
+ PropertyMap propertyMap = instance.getProperties();
+
+ if (propertyMap != null && propertyMap.size() > 0)
+ {
+ for (String key : propertyMap.keySet())
+ {
+ if (preferencesMetaData == null || preferencesMetaData.getPreferences() == null
+ || preferencesMetaData.getPreferences().contains(key) == false)
+ {
+ changes.add(PropertyChange.newReset(key));
+ }
+ }
+ }
+
+ // Configure preferences only if needed
+ if (preferencesMetaData != null && preferencesMetaData.getPreferences() != null && preferencesMetaData.getPreferences().size() > 0)
+ {
+ for (int i = 0; i < preferencesMetaData.getPreferences().size(); i++)
+ {
+ PortletPreferenceMetaData portletPreferenceMetaData = preferencesMetaData.getPreferences().get(i);
+ PropertyChange change = PropertyChange.newUpdate(portletPreferenceMetaData.getName(), portletPreferenceMetaData.getValue());
+ changes.add(change);
+ }
+ }
+
+
+ if (changes.size() > 0)
+ {
+ instance.setProperties(changes.toArray(new PropertyChange[changes.size()]));
+ }
+
+ // Configure security
+ SecurityConstrainMetaData securityConstraints = instanceMD.getSecurityContraint();
+
+ if (securityConstraints == null)
+ {
+ securityConstraints = new SecurityConstrainMetaData();
+ PolicyPermissionMetaData policyPermission = new PolicyPermissionMetaData();
+ policyPermission.setActionName("view");
+ policyPermission.setRoleName("__unchecked__".intern());
+ securityConstraints.getPolicyPermission().add(policyPermission);
+ }
+
+ HashSet<RoleSecurityBinding> bindings = new HashSet<RoleSecurityBinding>();
+ for (int i = 0; i < securityConstraints.getPolicyPermission().size(); i++)
+ {
+ PolicyPermissionMetaData policyMD = securityConstraints.getPolicyPermission().get(i);
+ RoleSecurityBinding binding = new RoleSecurityBinding(policyMD.getActionName(), policyMD.getRoleName());
+ bindings.add(binding);
+ }
+
+ AuthorizationDomain authDomain = instance.getContainer().getAuthorizationDomain();
+ DomainConfigurator domainConfigurator = authDomain.getConfigurator();
+ domainConfigurator.setSecurityBindings(instance.getId(), bindings);
+ }
+
+}
Added: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java (rev 0)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployer.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.deployer.portlet;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.Kernel;
+import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
+import org.jboss.portal.core.model.content.spi.ContentProviderRegistry;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.metadata.portal.object.PortalObjectMetaData;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class ObjectDeployer extends AbstractComponentDeployer
+{
+
+ protected Kernel kernel;
+ protected String portalObjectContainerReferenceName = "portal:container=PortalObject";
+ protected String contentProviderRegistryReferenceName = "portal:service=ContentProviderRegistry";
+ protected String coordinationConfiguratorReferenceName = "portal:service=CoordinationService";
+
+ public void setKernel (Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ public void setPortalObjectContainerReferenceName (String portalObjectContainerReferenceName)
+ {
+ this.portalObjectContainerReferenceName = portalObjectContainerReferenceName;
+ }
+
+ public void setContentProviderRegistryReferenceName (String contentProviderRegistryReferenceName)
+ {
+ this.contentProviderRegistryReferenceName = contentProviderRegistryReferenceName;
+ }
+
+ public void setCoordinationConfiguratorReferenceName (String coordinationConfigurationReferenceName)
+ {
+ this.coordinationConfiguratorReferenceName = coordinationConfigurationReferenceName;
+ }
+
+ public ObjectDeployer()
+ {
+ this.setAllInputs(false);
+ this.setInput(PortalObjectMetaData.class);
+ this.addInput(PortletDeployer.PORLET_DEPLOYED);
+
+ this.setStage(DeploymentStages.INSTALLED);
+ }
+
+ @Override
+ public void internalDeploy(DeploymentUnit unit) throws DeploymentException
+ {
+ PortalObjectMetaData objectMetaData = (PortalObjectMetaData) unit.getAttachment(PortalObjectMetaData.class);
+
+ ControllerContext objectContainerControllerContext = kernel.getController().getInstalledContext(portalObjectContainerReferenceName);
+ if (objectContainerControllerContext == null)
+ {
+ throw new DeploymentException("Cannot deploy to Portal Object Container, cannot get ControllerContext for \"" + portalObjectContainerReferenceName + "\"");
+ }
+ PortalObjectContainer objectContainer = (PortalObjectContainer)objectContainerControllerContext.getTarget();
+
+ ControllerContext contentProviderRegistryControllerContext = kernel.getController().getInstalledContext(contentProviderRegistryReferenceName);
+ if (contentProviderRegistryControllerContext == null)
+ {
+ throw new DeploymentException("Cannot deploy to Portal Object Container, cannot get ControllerContext for \"" + contentProviderRegistryReferenceName + "\"");
+ }
+ ContentProviderRegistry contentProviderRegistry = (ContentProviderRegistry)contentProviderRegistryControllerContext.getTarget();
+
+ ControllerContext coordinationConfiguratorControllerContext = kernel.getController().getInstalledContext(coordinationConfiguratorReferenceName);
+ if (coordinationConfiguratorControllerContext == null)
+ {
+ throw new DeploymentException("Cannot deploy to Portal Object Container, cannot get ControllerContext for \"" + coordinationConfiguratorReferenceName + "\"");
+ }
+ CoordinationConfigurator coordinationConfiguration = (CoordinationConfigurator)coordinationConfiguratorControllerContext.getTarget();
+
+ ObjectDeployerImpl objectDeployer = new ObjectDeployerImpl(objectContainer, contentProviderRegistry, coordinationConfiguration);
+ objectDeployer.deployObjects(objectMetaData);
+
+ }
+}
+
Added: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java (rev 0)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ObjectDeployerImpl.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.deployer.portlet;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
+import org.jboss.portal.core.model.content.spi.ContentProviderRegistry;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.metadata.portal.object.PortalObjectMetaData;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class ObjectDeployerImpl
+{
+
+ protected final Logger log = Logger.getLogger(getClass());
+
+ protected PortalObjectContainer portalObjectContainer;
+ protected ContentProviderRegistry contentProviderRegistry;
+ protected CoordinationConfigurator coordinationConfigurator;
+
+ public ObjectDeployerImpl(PortalObjectContainer portalObjectContainer, ContentProviderRegistry contentProviderRegistry, CoordinationConfigurator coordinationConfigurator)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ this.contentProviderRegistry = contentProviderRegistry;
+ this.coordinationConfigurator = coordinationConfigurator;
+ }
+
+ public void deployObjects (PortalObjectMetaData objectMetaData)
+ {
+ //TODO: need to write a class to convert the PortalObjectMetaData class to PortalObject class
+ }
+
+}
+
Modified: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDependencyDeployer.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -73,7 +73,10 @@
public void deploy(DeploymentUnit unit) throws DeploymentException
{
ControllerContext context = unit.getAttachment(ControllerContext.class);
-
+
+ if (context != null)
+ {
+
if (dependencies != null)
{
for (int i = 0; i < dependencies.size(); i++)
@@ -88,6 +91,7 @@
unit.addIDependOn(dependItem);
}
}
+ }
}
}
Modified: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployer.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -22,115 +22,217 @@
******************************************************************************/
package org.jboss.portal.deployer.portlet;
+import java.lang.reflect.Method;
+import java.net.URL;
import java.util.ArrayList;
-import java.util.Iterator;
+import javax.management.MBeanServer;
import javax.management.ObjectName;
+import javax.servlet.ServletContext;
-import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.portal.metadata.jboss.app.PortalAppMetaData;
-import org.jboss.portal.portlet.deployment.jboss.metadata.JBossApplicationMetaData;
+import org.jboss.kernel.Kernel;
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.portal.deployer.parsing.MergedPortletParsingDeployer;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.deployment.jboss.InfoBuilderFactory;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.system.metadata.ServiceConstructorMetaData;
-import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.portal.server.deployment.PortalWebApp;
import org.jboss.web.WebApplication;
import org.jboss.web.deployers.AbstractWarDeployer;
public class PortletDeployer extends AbstractComponentDeployer
{
+ protected final Logger log = Logger.getLogger(getClass());
- //the relative order of the war deployer in the main deployer.
- private int warDeployerOrder;
+ public static final String PORLET_DEPLOYED = "portlet.deployed";
+
+ protected AbstractWarDeployer warDeployer;
+
+ protected MBeanServer mbeanServer;
- private AbstractWarDeployer warDeployer;
+ protected Kernel kernel;
+
+ protected String coreInfoBuilderReferenceName = "portal:service=InfoBuilderFactory,type=Core";
+
+ protected String portletContainerInvoker = "portal:service=PortletInvoker,type=Container";
+
+ protected ArrayList listeners = new ArrayList();
- private ArrayList listeners = new ArrayList();
-
public PortletDeployer()
{
setAllInputs(false);
- setInput(PortalAppMetaData.class);
- addInput(PortalAppMetaData.class);
- addInput(PortletApplication10MetaData.class);
- addInput(JBossApplicationMetaData.class);
- setOutput(ServiceMetaData.class);
+ setInput(PortletApplication10MetaData.class);
+ addInput(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME);
+ addOutput(PORLET_DEPLOYED);
+ setStage(DeploymentStages.INSTALLED);
}
- public void setWarDeployerOrder(int order)
+ public void setWarDeployer(AbstractWarDeployer warDeployer)
{
- this.warDeployerOrder = order;
+ this.warDeployer = warDeployer;
}
+ public void setMBeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel=kernel;
+ }
+
public int getRelativeOrder()
{
- return warDeployerOrder + 1;
+ return warDeployer.getRelativeOrder() + 10;
}
+ public void setCoreInfoBuilderReferenceName (String coreInfoBuilderReferenceName)
+ {
+ this.coreInfoBuilderReferenceName = coreInfoBuilderReferenceName;
+ }
+
+ public void setPortletContainerInvoker (String portletContainerInvoker)
+ {
+ this.portletContainerInvoker = portletContainerInvoker;
+ }
+
@Override
public void internalDeploy(DeploymentUnit unit) throws DeploymentException
+ {
+ PortletApplication10MetaData portletMetaData = unit.getAttachment(PortletApplication10MetaData.class);
+
+ JBossApplicationMetaData jbossPortletMetaData = unit.getAttachment(MergedPortletParsingDeployer.PORTLET_MERGED_ATTACHMENT_NAME, JBossApplicationMetaData.class);
+
+ PortalWebApp portalWebApp = createPortalWebApp(unit.getName());
+
+ ControllerContext coreInfoContext = kernel.getController().getInstalledContext(coreInfoBuilderReferenceName);
+ if (coreInfoContext == null)
+ {
+ throw new DeploymentException(
+ "Cannot Deploy to Instance Container, cannot get ControllerContext for \"" + coreInfoBuilderReferenceName + "\"");
+ }
+ InfoBuilderFactory infoBuilderFactory = (InfoBuilderFactory)coreInfoContext.getTarget();
+
+
+ ControllerContext portletContainerContext = kernel.getController().getInstalledContext(portletContainerInvoker);
+ if (portletContainerContext == null)
+ {
+ throw new DeploymentException(
+ "Cannot Deploy to Instance Container, cannot get ControllerContext for \"" + portletContainerInvoker + "\"");
+ }
+ PortletInvoker portletInvoker = (PortletInvoker)portletContainerContext.getTarget();
+
+ PortletDeployerImpl portletDeployerImpl = new PortletDeployerImpl(infoBuilderFactory, portletInvoker);
+ portletDeployerImpl.deployPortlets(portalWebApp, jbossPortletMetaData, portletMetaData);
+
+
+ unit.addAttachment(PORLET_DEPLOYED, "deployed");
+ }
+
+ @Override
+ public void internalUndeploy(DeploymentUnit unit)
{
- //super.internalDeploy(unit);
- MainDeployer md = unit.getMainDeployer();
-
- PortalAppMetaData metaData = unit.getAttachment(PortalAppMetaData.class);
- if (metaData != null)
+ System.out.println("INTERNALUNDEPLOY");
+ }
+
+ /**
+ * This is a hack, but we currently need this information for the portlet
+ * container and there doesn't appear to be any other way to really get this info.
+ *
+ * TODO: fix this code to make it more sane and less prone to issues which may
+ * occur if internals in the JBoss Web/Tomcat change.
+ *
+ */
+ protected PortalWebApp createPortalWebApp(String warURL) throws DeploymentException
+ {
+ WebApplication webApp = warDeployer.getDeployedApp(warURL);
+ ObjectName objectName;
+ Object standardContextObject;
+
+ try
{
- System.out.println("INTERNALDEPLOYAPPNAME : " + metaData.getAppName());
+ objectName = (ObjectName) webApp.getAppData();
}
- else
+ catch (ClassCastException cce)
{
- System.out.println("NO PORTAL-APP.XML FILE");
+ throw new DeploymentException(
+ "Can not deploy portlet, the WebApplication.getAppData " +
+ "doesn't contain a proper ObjectName", cce);
}
-
- PortletApplication10MetaData portletMetaData = unit.getAttachment(PortletApplication10MetaData.class);
- if (portletMetaData != null)
+
+ try
{
- System.out.println("INTERNALDEPLOYPORTLETS : " + portletMetaData.getPortlets());
+ standardContextObject = mbeanServer.getAttribute(objectName, "managedResource");
}
- else
+ catch (Exception e)
{
- System.out.println("NO PORTLET.XML FILE");
+ throw new DeploymentException(
+ "Could not deploy the portlet, could not get the attribute 'managedResource'" +
+ "from mbean with object name '" + objectName +"'", e);
}
-
- JBossApplicationMetaData jbossPortletMetaData = unit.getAttachment(JBossApplicationMetaData.class);
- if (portletMetaData != null)
+
+ String contextPath = getContextPath(standardContextObject);
+ ServletContext servletContext = getServletContext(standardContextObject);
+ URL url = webApp.getURL();
+ ClassLoader classloader = webApp.getClassLoader();
+
+ PortalWebApplication portalWebApp = new PortalWebApplication(servletContext, url, classloader, contextPath);
+ return portalWebApp;
+ }
+
+ //TODO: determine a better way to get the contextpath string
+ protected String getContextPath (Object standardContextObject) throws DeploymentException
+ {
+ try
{
- System.out.println("INTERNALDEPLOYJBOSSPORTLETS : " + jbossPortletMetaData.getPortlets());
+ Class standardContextClass = standardContextObject.getClass();
+ Method getPathMethod = standardContextClass.getMethod("getPath", new Class[0]);
+
+ return (String)getPathMethod.invoke(standardContextObject, new Object[0]);
}
- else
+ catch (Exception e)
{
- System.out.println("NO JBOSS-PORTLET.XML FILE");
+ throw new DeploymentException("Error trying to get the ContextPath from the web server.", e);
}
-
- if (portletMetaData != null)
+ }
+
+ //TODO: determine a better way to get the servlet context
+ protected ServletContext getServletContext(Object standardContextObject) throws DeploymentException
+ {
+ try
{
- try
- {
- ServiceMetaData portletModule = new ServiceMetaData();
-
- JBossWebMetaData jbosswebMD = unit.getAttachment(JBossWebMetaData.class);
-
- //todo: fix situation for empty context root (ie for the ROOT war)
- String name = "jboss.portal.deployment:war=" + jbosswebMD.getContextRoot();
- ObjectName objectName = new ObjectName(name);
-
- portletModule.setObjectName(objectName);
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ Class standardContextClass = standardContextObject.getClass();
+ Method getServletContextMethod = standardContextClass.getMethod("getServletContext", new Class[0]);
+
+ return (ServletContext)getServletContextMethod.invoke(standardContextObject, new Object[0]);
}
+ catch (Exception e)
+ {
+ throw new DeploymentException("Error trying to get Reference to the ServletContext from the web server.", e);
+ }
}
+
+ //TODO: remove this class and change PortalWebAPP so that only a simple interface is needed
+ class PortalWebApplication extends PortalWebApp
+ {
- @Override
- public void internalUndeploy(DeploymentUnit unit)
- {
- System.out.println("INTERNALUNDEPLOY");
+ public PortalWebApplication(ServletContext servletContext, URL url, ClassLoader classloader, String contextPath)
+ {
+ init(servletContext, url, classloader, contextPath);
+ }
+
+ @Override
+ public void instrument() throws Exception
+ {
+ //do nothing
+ }
+
}
}
Added: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java (rev 0)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/PortletDeployerImpl.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,176 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.deployer.portlet;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.container.PortletContainerContext;
+import org.jboss.portal.portlet.container.PortletFilterContext;
+import org.jboss.portal.portlet.container.managed.LifeCycleStatus;
+import org.jboss.portal.portlet.container.managed.ManagedObject;
+import org.jboss.portal.portlet.container.managed.ManagedObjectEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObjectLifeCycleEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.jboss.portal.portlet.container.object.PortletApplicationObject;
+import org.jboss.portal.portlet.container.object.PortletContainerObject;
+import org.jboss.portal.portlet.container.object.PortletFilterObject;
+import org.jboss.portal.portlet.deployment.jboss.InfoBuilder;
+import org.jboss.portal.portlet.deployment.jboss.InfoBuilderFactory;
+import org.jboss.portal.portlet.deployment.jboss.PortletApplicationContextImpl;
+import org.jboss.portal.portlet.deployment.jboss.PortletContainerContextImpl;
+import org.jboss.portal.portlet.deployment.jboss.PortletFilterContextImpl;
+import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
+import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
+import org.jboss.portal.portlet.impl.container.PortletFilterLifeCycle;
+import org.jboss.portal.portlet.impl.info.ContainerFilterInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletFilterImpl;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.server.deployment.PortalWebApp;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class PortletDeployerImpl
+{
+ protected final Logger log = Logger.getLogger(this.getClass());
+
+ protected InfoBuilderFactory coreInfoBuilderFactory;
+ protected PortletInvoker portletContainerInvoker;
+
+
+ public PortletDeployerImpl (InfoBuilderFactory coreInfoBuilderFactory, PortletInvoker portletContainerInvoker)
+ {
+ this.coreInfoBuilderFactory = coreInfoBuilderFactory;
+ this.portletContainerInvoker = portletContainerInvoker;
+ }
+
+ public void deployPortlets(PortalWebApp pwa, JBossApplicationMetaData jbossAppMD, PortletApplication10MetaData portletAppMD)
+ {
+ InfoBuilder infoBuilder = coreInfoBuilderFactory.createInfoBuilder(pwa, jbossAppMD, portletAppMD);
+ infoBuilder.build();
+
+ PortletApplicationObject portletApplicationObject = new PortletApplicationImpl(infoBuilder.getApplication());
+ PortletApplicationContext portletApplicationContext = new PortletApplicationContextImpl(pwa);
+
+ //
+ PortletApplicationLifeCycle portletApplicationLifeCycle = new PortletApplicationLifeCycle(bridgeToInvoker, portletApplicationContext,
+ portletApplicationObject);
+
+ //
+ for (ContainerFilterInfo filterInfo : infoBuilder.getApplication().getFilters().values())
+ {
+ PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
+ PortletFilterContext portletFilterContext = new PortletFilterContextImpl();
+
+ //
+ portletApplicationLifeCycle.addPortletFilter(portletFilterContext, portletFilterObject);
+ System.out.println("ADDING FILTERINFO : " + portletFilterContext + " : " + portletFilterObject);
+ }
+
+ //
+ for (PortletInfo portletInfo : infoBuilder.getPortlets())
+ {
+ System.out.println("PORTLETINFO : " + portletInfo);
+ ContainerPortletInfo cpi = (ContainerPortletInfo) portletInfo;
+ PortletContainerObject portletContainerObject = new PortletContainerImpl(cpi);
+ PortletContainerContext portletContainerContext = new PortletContainerContextImpl();
+
+ //
+ PortletContainerLifeCycle portletContainerLifeCycle = portletApplicationLifeCycle.addPortletContainer(
+ portletContainerContext, portletContainerObject);
+
+ // Now create deps
+ for (String filterRef : cpi.getFilterRefs())
+ {
+ PortletFilterLifeCycle portletFilterLifeCycle = portletApplicationLifeCycle
+ .getManagedPortletFilter(filterRef);
+
+ //
+ if (portletFilterLifeCycle != null)
+ {
+ portletApplicationLifeCycle.addDependency(portletFilterLifeCycle, portletContainerLifeCycle);
+ }
+ else
+ {
+ // todo
+ }
+ }
+ }
+
+ //
+ portletApplicationLifeCycle.create();
+
+ //
+ portletApplicationLifeCycle.managedStart();
+ }
+
+ /** Bridge managed object event to add/remove portlet container in portlet container invoker. */
+ protected final ManagedObjectRegistryEventListener bridgeToInvoker = new ManagedObjectRegistryEventListener()
+ {
+ public void onEvent(ManagedObjectRegistryEvent event)
+ {
+ if (event instanceof ManagedObjectEvent)
+ {
+ ManagedObjectEvent managedObjectEvent = (ManagedObjectEvent)event;
+ ManagedObject managedObject = managedObjectEvent.getManagedObject();
+
+ //
+ if (managedObject instanceof PortletContainerLifeCycle)
+ {
+ PortletContainerLifeCycle portletContainerLifeCycle = (PortletContainerLifeCycle)managedObject;
+ PortletContainer portletContainer = portletContainerLifeCycle.getPortletContainer();
+
+ //
+ if (managedObjectEvent instanceof ManagedObjectLifeCycleEvent)
+ {
+ ManagedObjectLifeCycleEvent lifeCycleEvent = (ManagedObjectLifeCycleEvent)managedObjectEvent;
+
+ //
+ LifeCycleStatus status = lifeCycleEvent.getStatus();
+ //
+ if (status == LifeCycleStatus.STARTED)
+ {
+ ((ContainerPortletInvoker)portletContainerInvoker).addPortletContainer(portletContainer);
+ }
+ else
+ {
+ ((ContainerPortletInvoker)portletContainerInvoker).removePortletContainer(portletContainer);
+ }
+ }
+ }
+ }
+ }
+ };
+
+}
+
Added: modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java
===================================================================
--- modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java (rev 0)
+++ modules/deployer/trunk/deployer/src/main/java/org/jboss/portal/deployer/portlet/ServiceInjectorDeployer.java 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.deployer.portlet;
+
+import java.util.Iterator;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.portal.core.metadata.ServiceMetaData;
+import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+
+/**
+ * This class injects portlet specific services into the war
+ *
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class ServiceInjectorDeployer extends AbstractSimpleVFSRealDeployer<JBossApplicationMetaData>
+{
+
+ public ServiceInjectorDeployer()
+ {
+ super(JBossApplicationMetaData.class);
+ setStage(DeploymentStages.POST_PARSE);
+ }
+
+ @Override
+ public void deploy(VFSDeploymentUnit unit, JBossApplicationMetaData deployment) throws DeploymentException
+ {
+ Iterator<ServiceMetaData> iterator = deployment.getServices().values().iterator();
+ while (iterator.hasNext())
+ {
+ ServiceMetaData serviceMD = iterator.next();
+ //TODO: finish this deployer. This deployer needs to inject the services into the portlet servlets
+ // need to figure out if this can be done with an xml file or if this is going to need to have
+ // access to the server like the tld deployer.
+ }
+ }
+
+
+}
+
Added: modules/deployer/trunk/deployer/src/main/resources/base-aop.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/resources/base-aop.xml (rev 0)
+++ modules/deployer/trunk/deployer/src/main/resources/base-aop.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE aop PUBLIC
+ "-//JBoss//DTD JBOSS AOP 1.0//EN"
+ "http://www.jboss.org/aop/dtd/jboss-aop_1_0.dtd">
+
+<aop xmlns="urn:jboss:aop-beans:1.0">
+ <!-- custom configuration for AOP Security -->
+ <metadata-loader tag="security" class="org.jboss.aspects.security.SecurityClassMetaDataLoader"/>
+
+ <stack name="J2EESecurityStack">
+ <interceptor factory="org.jboss.aspects.security.AuthenticationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor factory="org.jboss.aspects.security.RoleBasedAuthorizationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor factory="org.jboss.aspects.security.RunAsSecurityInterceptorFactory" scope="PER_CLASS"/>
+ </stack>
+
+ <bind pointcut="all(@security)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.security.Permissions)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.security.Unchecked)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.security.Exclude)">
+ <stack-ref name="J2EESecurityStack"/>
+ </bind>
+
+ <introduction expr="class((a)org.jboss.aspects.jmx.MBean)">
+ <mixin>
+ <interfaces>javax.management.DynamicMBean</interfaces>
+ <class>org.jboss.aspects.jmx.JmxIntrospectingMixin</class>
+ <construction>new org.jboss.aspects.jmx.JmxIntrospectingMixin(this)</construction>
+ </mixin>
+ </introduction>
+
+ <!-- asynchronous aspect -->
+ <aspect class="org.jboss.aspects.asynch.AsynchAspect" scope="PER_INSTANCE">
+ <advisor-attribute name="Advisor"/>
+ </aspect>
+
+ <bind pointcut="execution(!static * *->@org.jboss.aspects.asynch.Asynchronous(..))">
+ <advice name="execute" aspect="org.jboss.aspects.asynch.AsynchAspect"/>
+ </bind>
+
+ <introduction expr="has(!static * *->@org.jboss.aspects.asynch.Asynchronous(..))">
+ <mixin>
+ <interfaces>org.jboss.aspects.asynch.AsynchProvider,org.jboss.aspects.asynch.FutureHolder</interfaces>
+ <class>org.jboss.aspects.asynch.AsynchMixin</class>
+ </mixin>
+ </introduction>
+
+ <!-- old asynch aspect from Claude -->
+
+ <aspect class="org.jboss.aspects.asynchronous.aspects.jboss.AsynchronousAspect" scope="PER_VM"/>
+
+ <bind pointcut="execution(* *->@org.jboss.aspects.asynchronous.aspects.jboss.Asynchronous(..))">
+ <advice name="execute" aspect="org.jboss.aspects.asynchronous.aspects.jboss.AsynchronousAspect"/>
+ </bind>
+
+ <introduction
+ expr="has(* *->@org.jboss.aspects.asynchronous.aspects.jboss.Asynchronous(..)) OR class((a)org.jboss.aspects.asynchronous.aspects.jboss.Asynchronous)">
+
+ <mixin>
+ <interfaces>
+ org.jboss.aspects.asynchronous.aspects.AsynchronousFacade
+ </interfaces>
+ <class>org.jboss.aspects.asynchronous.aspects.AsynchronousFacadeImpl</class>
+ <construction>new org.jboss.aspects.asynchronous.aspects.AsynchronousFacadeImpl()</construction>
+ </mixin>
+ </introduction>
+
+ <!-- TRANSACTIONS -->
+ <interceptor class="org.jboss.aspects.tx.TxPropagationInterceptor" scope="PER_VM"/>
+ <interceptor factory="org.jboss.aspects.tx.TxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
+
+ <bind pointcut="all(@transaction)">
+ <interceptor-ref name="org.jboss.aspects.tx.TxInterceptorFactory"/>
+ </bind>
+
+ <interceptor name="class-txsynchronized" factory="org.jboss.aspects.txlock.TxLockInterceptorFactory"
+ scope="PER_CLASS"/>
+ <interceptor name="instance-txsynchronized" factory="org.jboss.aspects.txlock.TxLockInterceptorFactory"
+ scope="PER_INSTANCE"/>
+
+ <bind pointcut="execution(static * *->@TxSynchronized(..)) OR execution(*->@TxSynchronized(..))">
+ <interceptor-ref name="class-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="execution(!static * *->@TxSynchronized(..))">
+ <interceptor-ref name="instance-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.tx.Tx)">
+ <interceptor-ref name="org.jboss.aspects.tx.TxInterceptorFactory"/>
+ </bind>
+
+ <bind
+ pointcut="execution(static * *->@org.jboss.aspects.txlock.TxSynchronized(..)) OR execution(*->@org.jboss.aspects.txlock.TxSynchronized(..))">
+ <interceptor-ref name="class-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="execution(!static * *->@org.jboss.aspects.txlock.TxSynchronized(..))">
+ <interceptor-ref name="instance-txsynchronized"/>
+ </bind>
+
+ <!-- injection -->
+ <aspect class="org.jboss.aspects.tx.TransactionInjector"/>
+ <aspect class="org.jboss.aspects.tx.TransactionManagerInjector"/>
+
+ <bind pointcut="field(javax.transaction.Transaction *->@org.jboss.aspects.Current)">
+ <advice name="access" aspect="org.jboss.aspects.tx.TransactionInjector"/>
+ </bind>
+
+ <bind pointcut="field(javax.transaction.TransactionManager *->@org.jboss.aspects.Injected)">
+ <advice name="access" aspect="org.jboss.aspects.tx.TransactionManagerInjector"/>
+ </bind>
+
+ <bind
+ pointcut="execution(*->new(..)) AND hasfield(javax.transaction.TransactionManager *->@org.jboss.aspects.Injected)">
+ <advice name="allocation" aspect="org.jboss.aspects.tx.TransactionManagerInjector"/>
+ </bind>
+
+ <!-- special types -->
+ <aspect class="org.jboss.aspects.ThreadbasedAspect" scope="PER_JOINPOINT"/>
+ <bind pointcut="field(* *->@org.jboss.aspects.Threadbased)">
+ <advice name="access" aspect="org.jboss.aspects.ThreadbasedAspect"/>
+ </bind>
+
+ <aspect class="org.jboss.aspects.tx.TransactionLocalAspect" scope="PER_JOINPOINT"/>
+ <bind pointcut="field(* *->@org.jboss.aspects.tx.TxLocal)">
+ <advice name="access" aspect="org.jboss.aspects.tx.TransactionLocalAspect"/>
+ </bind>
+
+</aop>
Property changes on: modules/deployer/trunk/deployer/src/main/resources/base-aop.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml (rev 0)
+++ modules/deployer/trunk/deployer/src/main/resources/deployment-aop.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -0,0 +1,7 @@
+<aop xmlns="urn:jboss:aop-beans:1.0">
+ <metadata tag="transaction" class="org.jboss.portal.deployer.portlet.InstanceDeployerImpl">
+ <method name="deployInstances">
+ <trans-attribute>RequiresNew</trans-attribute>
+ </method>
+ </metadata>
+</aop>
Modified: modules/deployer/trunk/pom.xml
===================================================================
--- modules/deployer/trunk/pom.xml 2009-02-09 03:32:05 UTC (rev 12795)
+++ modules/deployer/trunk/pom.xml 2009-02-09 03:49:06 UTC (rev 12796)
@@ -1,41 +1,159 @@
<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">
+<!-- <parent>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>jboss-portal-parent</artifactId>
+ <version>1-SNAPSHOT</version>
+ </parent> -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.deployer</groupId>
- <artifactId>module-aggregator</artifactId>
+ <artifactId>module-parent</artifactId>
<packaging>pom</packaging>
<name>JBoss Portal Deployer</name>
<version>trunk-SNAPSHOT</version>
+ <url>http://labs.jboss.com/jbossportal</url>
- <distributionManagement>
+ <properties>
+ <version.assembly>2.2-beta-2</version.assembly>
+ <version.jboss.aop>1.0.0.GA</version.jboss.aop>
+ <version.jboss.aspects>1.0.0.GA</version.jboss.aspects>
+ <version.jboss-deployers>2.2.0-SNAPSHOT</version.jboss-deployers>
+ <version.jboss-metadata>1.0.0.CR1</version.jboss-metadata>
+ <version.jboss.portal>2.8-SNAPSHOT</version.jboss.portal>
+ <version.jboss.portal.metadata>trunk-SNAPSHOT</version.jboss.portal.metadata>
+ <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
+ <version.jboss.portal.portlet>2.1.0-SNAPSHOT</version.jboss.portal.portlet>
+ <version.jboss.portal.server>2.7.0.GA</version.jboss.portal.server>
+ <version.jboss.portlet.server>2.7.0</version.jboss.portlet.server>
+ <version.jboss-as>5.0.0.CR2</version.jboss-as>
+ <version.saxon>6.5.3</version.saxon>
+ </properties>
+
+ <repositories>
<repository>
- <!--Copy the distribution jar file to a local checkout of the maven repository
- - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
<id>repository.jboss.org</id>
- <url>file://${jboss.repository.root}</url>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
</repository>
- <snapshotRepository>
+ <repository>
<id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <url>dav:https://snapshots.jboss.org/maven2</url>
- <uniqueVersion>true</uniqueVersion>
- </snapshotRepository>
- </distributionManagement>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+<!-- <pluginRepositories>
+ <pluginRepository>
+ <id>maven.jboss.org</id>
+ <name>JBoss Maven Repository</name>
+ <url>http://repository.jboss.com/maven2</url>
+ </pluginRepository>
+ </pluginRepositories> -->
- <modules>
- <module>build</module>
- <module>deployer</module>
- </modules>
- <reporting>
+ <build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- </configuration>
+ <artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
- </reporting>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ <version>${version.jboss-deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.jboss-deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ <version>${version.jboss-metadata}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${version.jboss-as}</version>
+ </dependency>
+ <dependency>
+ <groupId>saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>${version.saxon}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.metadata</groupId>
+ <artifactId>metadata-metadata</artifactId>
+ <version>${version.jboss.portal.metadata}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
+ <version>${version.jboss.portal.web}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${version.jboss.portal.portlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-mc</artifactId>
+ <version>${version.jboss.portal.portlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>server</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.server</groupId>
+ <artifactId>portlet-server</artifactId>
+ <version>${version.jboss.portlet.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>core</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>security</artifactId>
+ <version>${version.jboss.portal.server}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>${version.jboss.aop}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-transaction-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <version>${version.jboss.aspects}</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
</project>
17 years, 2 months
JBoss Portal SVN: r12795 - in modules/authorization/trunk/policy-server/src: test/resources and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-02-08 22:32:05 -0500 (Sun, 08 Feb 2009)
New Revision: 12795
Removed:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/RuleCombiningAlgImplies.java
modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml
Log:
some codebase cleanup
Deleted: modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/RuleCombiningAlgImplies.java
===================================================================
--- modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/RuleCombiningAlgImplies.java 2009-02-09 03:21:21 UTC (rev 12794)
+++ modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/plugin/RuleCombiningAlgImplies.java 2009-02-09 03:32:05 UTC (rev 12795)
@@ -1,69 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, 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.authz.policy.server.plugin;
-
-import java.util.List;
-import java.util.Iterator;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.jboss.security.xacml.sunxacml.combine.RuleCombiningAlgorithm;
-import org.jboss.security.xacml.sunxacml.EvaluationCtx;
-import org.jboss.security.xacml.sunxacml.ctx.Result;
-import org.jboss.security.xacml.sunxacml.Rule;
-import org.jboss.security.xacml.sunxacml.combine.RuleCombinerElement;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class RuleCombiningAlgImplies extends RuleCombiningAlgorithm
-{
- /**
- *
- * @throws URISyntaxException
- */
- public RuleCombiningAlgImplies() throws URISyntaxException
- {
- super(new URI("rule-combining-alg:cms-implies"));
- }
-
- /**
- *
- * @param context
- * @param rules
- * @return
- */
- public Result combine(EvaluationCtx context, List parameters, List ruleElements)
- {
- Iterator rules = ruleElements.iterator();
- while(rules.hasNext())
- {
- RuleCombinerElement ruleCombinerElement = (RuleCombinerElement)rules.next();
- Rule rule = ruleCombinerElement.getRule();
- }
-
- // if nothing returned Permit, then the alg returns Deny
- return new Result(Result.DECISION_DENY);
- }
-}
Deleted: modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml
===================================================================
--- modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml 2009-02-09 03:21:21 UTC (rev 12794)
+++ modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml 2009-02-09 03:32:05 UTC (rev 12795)
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<config xmlns="http://sunxacml.sourceforge.net/schema/config-0.3"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- defaultPDP="pdp" defaultAttributeFactory="attr"
- defaultCombiningAlgFactory="comb" defaultFunctionFactory="func">
- <pdp name="pdp">
- <attributeFinderModule class="org.jboss.security.xacml.sunxacml.finder.impl.CurrentEnvModule"/>
- <attributeFinderModule class="org.jboss.security.xacml.sunxacml.finder.impl.SelectorModule"/>
- <policyFinderModule class="org.jboss.security.xacml.sunxacml.finder.impl.FilePolicyModule">
- <list>
- <string>simple-policy.xml</string>
- </list>
- </policyFinderModule>
- </pdp>
-
- <attributeFactory name="attr" useStandardDatatypes="true"/>
-
- <combiningAlgFactory name="comb" useStandardAlgorithms="true">
- <algorithm class="org.jboss.security.authz.policy.server.plugin.NoPermitMeansDeniedAlg"/>
- </combiningAlgFactory>
-
- <functionFactory name="func" useStandardFunctions="true">
- <condition>
- <function class="org.jboss.security.authz.policy.server.plugin.DroolsFunction"/>
- </condition>
- </functionFactory>
-</config>
17 years, 2 months