Seam SVN: r13765 - in modules/security/trunk/external: src/main/java/org/jboss/seam/security/external and 17 other directories.
by seam-commits@lists.jboss.org
Author: marcelkolsteren
Date: 2010-09-18 07:03:55 -0400 (Sat, 18 Sep 2010)
New Revision: 13765
Added:
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/DialogueFilter.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderApi.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderConfigurationApi.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRequestedAttribute.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/dialogues/DialogueBeanProvider.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderAuthenticationService.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderBean.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInApplicationScopeProducer.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInVirtualApplicationScopeProducer.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderOrRelyingParty.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderRequest.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpAuthenticationService.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServerManagerFactory.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdUsersServlet.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdProviderSpi.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpCustomizer.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpTestServlet.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpenIdProviderApplicationMock.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/OpenIdRpApplicationMock.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpCustomizer.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpTestServlet.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/
modules/security/trunk/external/src/test/resources/WEB-INF/op-beans.xml
modules/security/trunk/external/src/test/resources/WEB-INF/rp-beans.xml
Removed:
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdAttribute.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdSingleLoginService.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdXrdsProvider.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/OpenIdSpiMock.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/idp/
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/sp/
Modified:
modules/security/trunk/external/pom.xml
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/EntityBean.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdPrincipal.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyApi.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyConfigurationApi.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpBean.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdService.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServlet.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlEntityBean.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlMessageReceiver.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/idp/SamlIdpBean.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/sp/SamlSpBean.java
modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdRelyingPartySpi.java
modules/security/trunk/external/src/main/resources/META-INF/web-fragment.xml
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/MetaDataLoader.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/AfterDeployEventHandler.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/ArchiveBuilder.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/BeforeUnDeployEventHandler.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/IntegrationTest.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/IdpCustomizer.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/IdpTestServlet.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/SamlIdpApplicationMock.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SamlSpApplicationMock.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpCustomizer.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpTestServlet.java
modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpVirtualApplicationCreator.java
Log:
- Added OpenID Provider support
- Added integration test for OpenID (covers Relying Party and Provider)
Modified: modules/security/trunk/external/pom.xml
===================================================================
--- modules/security/trunk/external/pom.xml 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/pom.xml 2010-09-18 11:03:55 UTC (rev 13765)
@@ -18,6 +18,7 @@
<arquillian.version>1.0.0.Alpha3</arquillian.version>
<jbossas.server.manager.version>1.0.3.GA</jbossas.server.manager.version>
<jbossas.client.version>6.0.0.20100721-M4</jbossas.client.version>
+ <weld.extensions.version>1.0.0.Alpha2</weld.extensions.version>
</properties>
<build>
@@ -70,6 +71,7 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-extensions</artifactId>
+ <version>${weld.extensions.version}</version>
</dependency>
<dependency>
@@ -180,7 +182,14 @@
<version>3.1</version>
</dependency>
+ <!-- Needed by openid4java -->
<dependency>
+ <groupId>nekohtml</groupId>
+ <artifactId>nekohtml</artifactId>
+ <version>1.9.12</version>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-junit</artifactId>
<scope>test</scope>
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/DialogueFilter.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/DialogueFilter.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/DialogueFilter.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external;
+
+import java.io.IOException;
+
+import javax.inject.Inject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.security.external.api.ResponseHolder;
+import org.jboss.seam.security.external.dialogues.DialogueManager;
+
+@WebFilter(filterName = "DialogueFilter", urlPatterns = "/*")
+public class DialogueFilter implements Filter
+{
+ public final static String DIALOGUE_ID_PARAM = "dialogueId";
+
+ @Inject
+ private DialogueManager manager;
+
+ @Inject
+ private ResponseHolder responseHolder;
+
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
+ {
+ responseHolder.setResponse((HttpServletResponse) response);
+
+ if (manager.isAttached())
+ {
+ manager.detachDialogue();
+ }
+
+ String dialogueId = request.getParameter(DIALOGUE_ID_PARAM);
+
+ if (dialogueId != null)
+ {
+ if (!manager.isExistingDialogue(dialogueId))
+ {
+ ((HttpServletResponse) response).sendError(HttpServletResponse.SC_BAD_REQUEST, "dialogue " + dialogueId + " does not exist");
+ return;
+ }
+ manager.attachDialogue(dialogueId);
+ }
+
+ chain.doFilter(request, response);
+
+ if (manager.isAttached())
+ {
+ manager.detachDialogue();
+ }
+ }
+
+ public void destroy()
+ {
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/DialogueFilter.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/EntityBean.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/EntityBean.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/EntityBean.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -21,6 +21,9 @@
*/
package org.jboss.seam.security.external;
+import java.net.MalformedURLException;
+import java.net.URL;
+
/**
* @author Marcel Kolsteren
*
@@ -61,4 +64,23 @@
{
this.port = port;
}
+
+ protected String createURL(String path)
+ {
+ try
+ {
+ if (protocol.equals("http") && port == 80 || protocol.equals("https") && port == 443)
+ {
+ return new URL(protocol, hostName, path).toExternalForm();
+ }
+ else
+ {
+ return new URL(protocol, hostName, port, path).toExternalForm();
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
}
Deleted: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdAttribute.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdAttribute.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdAttribute.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.security.external.api;
-
-/**
- * @author Marcel Kolsteren
- *
- */
-public class OpenIdAttribute
-{
- private String alias;
- private String typeUri;
- private boolean required;
-
- public OpenIdAttribute(String alias, String typeUri, boolean required)
- {
- super();
- this.alias = alias;
- this.typeUri = typeUri;
- this.required = required;
- }
-
- public String getAlias()
- {
- return alias;
- }
-
- public void setAlias(String alias)
- {
- this.alias = alias;
- }
-
- public String getTypeUri()
- {
- return typeUri;
- }
-
- public void setTypeUri(String typeUri)
- {
- this.typeUri = typeUri;
- }
-
- public boolean isRequired()
- {
- return required;
- }
-
- public void setRequired(boolean required)
- {
- this.required = required;
- }
-}
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdPrincipal.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdPrincipal.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdPrincipal.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -36,14 +36,14 @@
private URL openIdProvider;
- private Map<String, List<String>> attributes;
+ private Map<String, List<String>> attributeValues;
- public OpenIdPrincipal(String identifier, URL openIdProvider, Map<String, List<String>> attributes)
+ public OpenIdPrincipal(String identifier, URL openIdProvider, Map<String, List<String>> attributeValues)
{
super();
this.identifier = identifier;
this.openIdProvider = openIdProvider;
- this.attributes = attributes;
+ this.attributeValues = attributeValues;
}
public String getIdentifier()
@@ -56,9 +56,26 @@
return openIdProvider;
}
- public Map<String, List<String>> getAttributes()
+ public Map<String, List<String>> getAttributeValues()
{
- return attributes;
+ return attributeValues;
}
+ public String getAttribute(String alias)
+ {
+ List<String> values = attributeValues.get(alias);
+ if (values.size() == 0)
+ {
+ return null;
+ }
+ else if (values.size() == 1)
+ {
+ return (String) attributeValues.get(alias).get(0);
+ }
+ else
+ {
+ throw new RuntimeException("Attribute has multiple values");
+ }
+ }
+
}
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderApi.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderApi.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderApi.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.api;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public interface OpenIdProviderApi
+{
+ void authenticationSucceeded(String userName);
+
+ void authenticationFailed();
+
+ void setAttributes(Map<String, List<String>> attributeValues);
+
+ String getOpLocalIdentifierForUserName(String userName);
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderApi.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderConfigurationApi.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderConfigurationApi.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderConfigurationApi.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.api;
+
+public interface OpenIdProviderConfigurationApi extends EntityConfigurationApi
+{
+ String getXrdsURL();
+
+ String getRealm();
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdProviderConfigurationApi.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyApi.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyApi.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyApi.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -29,5 +29,13 @@
*/
public interface OpenIdRelyingPartyApi
{
- public void login(String openId, List<OpenIdAttribute> attributes);
+ /**
+ * Start an OpenID login dialogue.
+ *
+ * @param identifier either a Claimed Identifier (identifying the user) or an
+ * OP Identifier (identifying the OpenID Provider where the user
+ * has an account)
+ * @param attributes attributes that are requested
+ */
+ void login(String identifier, List<OpenIdRequestedAttribute> attributes);
}
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyConfigurationApi.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyConfigurationApi.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRelyingPartyConfigurationApi.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -23,5 +23,7 @@
public interface OpenIdRelyingPartyConfigurationApi extends EntityConfigurationApi
{
+ String getXrdsURL();
+ String getRealm();
}
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRequestedAttribute.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRequestedAttribute.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRequestedAttribute.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.api;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public class OpenIdRequestedAttribute
+{
+ private String alias;
+ private String typeUri;
+ private boolean required;
+ private Integer count;
+
+ public OpenIdRequestedAttribute()
+ {
+
+ }
+
+ public OpenIdRequestedAttribute(String alias, String typeUri, boolean required, Integer count)
+ {
+ super();
+ this.alias = alias;
+ this.typeUri = typeUri;
+ this.required = required;
+ this.count = count;
+ }
+
+ public String getAlias()
+ {
+ return alias;
+ }
+
+ public void setAlias(String alias)
+ {
+ this.alias = alias;
+ }
+
+ public String getTypeUri()
+ {
+ return typeUri;
+ }
+
+ public void setTypeUri(String typeUri)
+ {
+ this.typeUri = typeUri;
+ }
+
+ public boolean isRequired()
+ {
+ return required;
+ }
+
+ public void setRequired(boolean required)
+ {
+ this.required = required;
+ }
+
+ public Integer getCount()
+ {
+ return count;
+ }
+
+ public void setCount(Integer count)
+ {
+ this.count = count;
+ }
+
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/api/OpenIdRequestedAttribute.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/dialogues/DialogueBeanProvider.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/dialogues/DialogueBeanProvider.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/dialogues/DialogueBeanProvider.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.dialogues;
+
+import static org.jboss.weld.servlet.ServletHelper.getModuleBeanManager;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.servlet.ServletContext;
+
+import org.jboss.seam.security.external.dialogues.api.Dialogue;
+import org.jboss.weld.manager.BeanManagerImpl;
+
+/**
+ * Provides dialogue beans to classes that are not able to inject.
+ *
+ * @author Marcel Kolsteren
+ *
+ */
+public class DialogueBeanProvider
+{
+ public static Dialogue dialogue(ServletContext servletContext)
+ {
+ BeanManagerImpl beanManager = getModuleBeanManager(servletContext);
+ Bean<?> bean = beanManager.resolve(beanManager.getBeans(Dialogue.class));
+ return (Dialogue) beanManager.getReference(bean, Dialogue.class, beanManager.createCreationalContext(bean));
+ }
+
+ public static DialogueManager dialogueManager(ServletContext servletContext)
+ {
+ BeanManagerImpl beanManager = getModuleBeanManager(servletContext);
+ Bean<?> bean = beanManager.resolve(beanManager.getBeans(DialogueManager.class));
+ return (DialogueManager) beanManager.getReference(bean, DialogueManager.class, beanManager.createCreationalContext(bean));
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/dialogues/DialogueBeanProvider.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderAuthenticationService.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderAuthenticationService.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderAuthenticationService.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,242 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+
+import org.jboss.seam.security.external.InvalidRequestException;
+import org.jboss.seam.security.external.ResponseHandler;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+import org.jboss.seam.security.external.dialogues.DialogueManager;
+import org.jboss.seam.security.external.dialogues.api.Dialogue;
+import org.jboss.seam.security.external.spi.OpenIdProviderSpi;
+import org.openid4java.message.AuthRequest;
+import org.openid4java.message.DirectError;
+import org.openid4java.message.Message;
+import org.openid4java.message.MessageException;
+import org.openid4java.message.MessageExtension;
+import org.openid4java.message.ParameterList;
+import org.openid4java.message.ax.AxMessage;
+import org.openid4java.message.ax.FetchRequest;
+import org.openid4java.message.ax.FetchResponse;
+import org.openid4java.server.ServerManager;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public class OpenIdProviderAuthenticationService
+{
+ @Inject
+ private Instance<OpenIdProviderRequest> openIdProviderRequest;
+
+ @Inject
+ private Instance<ServerManager> openIdServerManager;
+
+ @Inject
+ private Instance<OpenIdProviderSpi> openIdProviderSpi;
+
+ @Inject
+ private ResponseHandler responseHandler;
+
+ @Inject
+ private DialogueManager dialogueManager;
+
+ @Inject
+ private Instance<Dialogue> dialogue;
+
+ @Inject
+ private Instance<OpenIdProviderBean> opBean;
+
+ public void handleIncomingMessage(HttpServletRequest httpRequest) throws InvalidRequestException
+ {
+ ParameterList parameterList = new ParameterList(httpRequest.getParameterMap());
+
+ String mode = parameterList.getParameterValue("openid.mode");
+
+ Message response;
+
+ if ("associate".equals(mode))
+ {
+ response = openIdServerManager.get().associationResponse(parameterList);
+ writeMessageToResponse(response);
+ }
+ else if ("checkid_setup".equals(mode) || "checkid_immediate".equals(mode))
+ {
+ dialogueManager.beginDialogue();
+ String claimedIdentifier = parameterList.getParameterValue("openid.claimed_id");
+ String opLocalIdentifier = parameterList.getParameterValue("openid.identity");
+
+ openIdProviderRequest.get().setParameterList(parameterList);
+ openIdProviderRequest.get().setClaimedIdentifier(claimedIdentifier);
+
+ MessageExtension ext = null;
+ try
+ {
+ AuthRequest authReq = AuthRequest.createAuthRequest(parameterList, openIdServerManager.get().getRealmVerifier());
+ if (authReq.hasExtension(AxMessage.OPENID_NS_AX))
+ {
+ ext = authReq.getExtension(AxMessage.OPENID_NS_AX);
+ }
+ }
+ catch (MessageException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ if (ext instanceof FetchRequest)
+ {
+ FetchRequest fetchRequest = (FetchRequest) ext;
+
+ List<OpenIdRequestedAttribute> requestedAttributes = new LinkedList<OpenIdRequestedAttribute>();
+ handleAttributeRequests(fetchRequest, requestedAttributes, false);
+ handleAttributeRequests(fetchRequest, requestedAttributes, true);
+ openIdProviderRequest.get().setRequestedAttributes(requestedAttributes);
+ openIdProviderRequest.get().setFetchRequest(fetchRequest);
+ }
+
+ if (claimedIdentifier != null && opLocalIdentifier != null)
+ {
+ boolean immediate = "checkid_immediate".equals(mode);
+ String realm = parameterList.getParameterValue("openid.realm");
+ if (realm == null)
+ {
+ realm = parameterList.getParameterValue("openid.return_to");
+ }
+
+ if (opLocalIdentifier.equals(AuthRequest.SELECT_ID))
+ {
+ openIdProviderSpi.get().authenticate(realm, null, immediate);
+ }
+ else
+ {
+ String userName = opBean.get().getUserNameFromOpLocalIdentifier(opLocalIdentifier);
+ openIdProviderSpi.get().authenticate(realm, userName, immediate);
+ }
+ }
+ else
+ {
+ response = DirectError.createDirectError("Invalid request; claimed_id or identity attribute is missing");
+ writeMessageToResponse(response);
+ }
+ dialogueManager.detachDialogue();
+ }
+ else if ("check_authentication".equals(mode))
+ {
+ response = openIdServerManager.get().verify(parameterList);
+ writeMessageToResponse(response);
+ }
+ else
+ {
+ response = DirectError.createDirectError("Unknown request");
+ writeMessageToResponse(response);
+ }
+ }
+
+ private void handleAttributeRequests(FetchRequest fetchRequest, List<OpenIdRequestedAttribute> requestedAttributes, boolean required)
+ {
+ @SuppressWarnings("unchecked")
+ Map<String, String> attributes = fetchRequest.getAttributes(required);
+
+ for (Map.Entry<String, String> entry : attributes.entrySet())
+ {
+ OpenIdRequestedAttribute requestedAttribute = new OpenIdRequestedAttribute();
+ requestedAttribute.setAlias(entry.getKey());
+ requestedAttribute.setTypeUri(entry.getValue());
+ requestedAttribute.setRequired(required);
+ requestedAttribute.setCount(fetchRequest.getCount(entry.getKey()));
+ requestedAttributes.add(requestedAttribute);
+ }
+ }
+
+ public void sendAuthenticationResponse(boolean authenticationSuccesful, Map<String, List<String>> attributeValues)
+ {
+ ParameterList parameterList = openIdProviderRequest.get().getParameterList();
+ String userName = openIdProviderRequest.get().getUserName();
+ String opLocalIdentifier = opBean.get().getOpLocalIdentifierForUserName(userName);
+ String claimedIdentifier = openIdProviderRequest.get().getClaimedIdentifier();
+ if (claimedIdentifier.equals(AuthRequest.SELECT_ID))
+ {
+ claimedIdentifier = opLocalIdentifier;
+ }
+
+ Message response = openIdServerManager.get().authResponse(parameterList, opLocalIdentifier, claimedIdentifier, authenticationSuccesful);
+
+ if (response instanceof DirectError)
+ {
+ writeMessageToResponse(response);
+ }
+ else
+ {
+ if (openIdProviderRequest.get().getRequestedAttributes() != null)
+ {
+ try
+ {
+ FetchResponse fetchResponse = FetchResponse.createFetchResponse(openIdProviderRequest.get().getFetchRequest(), attributeValues);
+ response.addExtension(fetchResponse);
+ }
+ catch (MessageException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // caller will need to decide which of the following to use:
+
+ // option1: GET HTTP-redirect to the return_to URL
+ String destinationUrl = response.getDestinationUrl(true);
+ responseHandler.sendHttpRedirectToUserAgent(destinationUrl);
+
+ // option2: HTML FORM Redirection
+ // RequestDispatcher dispatcher =
+ // getServletContext().getRequestDispatcher("formredirection.jsp");
+ // httpReq.setAttribute("prameterMap", response.getParameterMap());
+ // httpReq.setAttribute("destinationUrl",
+ // response.getDestinationUrl(false));
+ // dispatcher.forward(request, response);
+ // return null;
+ }
+
+ dialogue.get().setFinished(true);
+ }
+
+ private void writeMessageToResponse(Message message)
+ {
+ Writer writer = responseHandler.getWriter("text/plain");
+ try
+ {
+ writer.append(message.keyValueFormEncoding());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderAuthenticationService.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderBean.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderBean.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderBean.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,237 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.servlet.ServletContext;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.jboss.seam.security.external.EntityBean;
+import org.jboss.seam.security.external.JaxbContext;
+import org.jboss.seam.security.external.api.OpenIdProviderApi;
+import org.jboss.seam.security.external.api.OpenIdProviderConfigurationApi;
+import org.jboss.seam.security.external.dialogues.api.Dialogued;
+import org.jboss.seam.security.external.jaxb.xrds.LocalID;
+import org.jboss.seam.security.external.jaxb.xrds.ObjectFactory;
+import org.jboss.seam.security.external.jaxb.xrds.Service;
+import org.jboss.seam.security.external.jaxb.xrds.Type;
+import org.jboss.seam.security.external.jaxb.xrds.URIPriorityAppendPattern;
+import org.jboss.seam.security.external.jaxb.xrds.XRD;
+import org.jboss.seam.security.external.jaxb.xrds.XRDS;
+import org.jboss.seam.security.external.spi.OpenIdProviderSpi;
+import org.openid4java.discovery.DiscoveryInformation;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public class OpenIdProviderBean extends EntityBean implements OpenIdProviderApi, OpenIdProviderConfigurationApi
+{
+ @Inject
+ private Instance<OpenIdProviderRequest> openIdProviderRequest;
+
+ @Inject
+ private OpenIdProviderAuthenticationService openIdSingleLoginSender;
+
+ @Inject
+ private ServletContext servletContext;
+
+ @Inject
+ private Instance<OpenIdProviderSpi> openIdProviderSpi;
+
+ @Inject
+ @JaxbContext(ObjectFactory.class)
+ private JAXBContext jaxbContext;
+
+ public String getServiceURL(OpenIdService service)
+ {
+ String path = servletContext.getContextPath() + "/openid/OP/" + service.getName();
+ return createURL(path);
+ }
+
+ public String getRealm()
+ {
+ return createURL("");
+ }
+
+ public String getXrdsURL()
+ {
+ return getServiceURL(OpenIdService.XRDS_SERVICE);
+ }
+
+ /**
+ * Write XRDS with OP identifier (see OpenId 2.0 Authentication spec, section
+ * 7.3.2.1.1.)
+ *
+ * @param writer writer to use
+ */
+ public void writeOpIdentifierXrds(Writer writer)
+ {
+ try
+ {
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ XRDS xrds = objectFactory.createXRDS();
+
+ XRD xrd = objectFactory.createXRD();
+
+ Type type = objectFactory.createType();
+ type.setValue(DiscoveryInformation.OPENID2_OP);
+ URIPriorityAppendPattern uri = objectFactory.createURIPriorityAppendPattern();
+ uri.setValue(getServiceURL(OpenIdService.OPEN_ID_SERVICE));
+
+ Service service = objectFactory.createService();
+ service.getType().add(type);
+ service.getURI().add(uri);
+
+ xrd.getService().add(service);
+
+ xrds.getOtherelement().add(xrd);
+
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.marshal(xrds, writer);
+ }
+ catch (JAXBException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void writeClaimedIdentifierXrds(Writer writer, String opLocalIdentifier)
+ {
+ try
+ {
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ XRDS xrds = objectFactory.createXRDS();
+
+ XRD xrd = objectFactory.createXRD();
+
+ Type type = objectFactory.createType();
+ type.setValue(DiscoveryInformation.OPENID2);
+ URIPriorityAppendPattern uri = objectFactory.createURIPriorityAppendPattern();
+ uri.setValue(getServiceURL(OpenIdService.OPEN_ID_SERVICE));
+
+ Service service = objectFactory.createService();
+ service.getType().add(type);
+ service.getURI().add(uri);
+
+ LocalID localId = new LocalID();
+ localId.setValue(opLocalIdentifier);
+ service.getLocalID().add(localId);
+
+ xrd.getService().add(service);
+
+ xrds.getOtherelement().add(xrd);
+
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.marshal(xrds, writer);
+ }
+ catch (JAXBException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String getOpLocalIdentifierForUserName(String userName)
+ {
+ try
+ {
+ return createURL(getUsersPath() + URLEncoder.encode(userName, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String getUserNameFromOpLocalIdentifier(String opLocalIdentifier)
+ {
+ String prefix = createURL(getUsersPath());
+ if (opLocalIdentifier.startsWith(prefix))
+ {
+ String urlEncodedUserName = opLocalIdentifier.replace(prefix, "");
+ try
+ {
+ return URLDecoder.decode(urlEncodedUserName, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public String getUsersPath()
+ {
+ return servletContext.getContextPath() + "/users/";
+ }
+
+ public String getUsersUrlPrefix()
+ {
+ return createURL(getUsersPath());
+ }
+
+ @Dialogued(join = true)
+ public void authenticationFailed()
+ {
+ openIdSingleLoginSender.sendAuthenticationResponse(false, null);
+ }
+
+ @Dialogued(join = true)
+ public void authenticationSucceeded(String userName)
+ {
+ openIdProviderRequest.get().setUserName(userName);
+ if (openIdProviderRequest.get().getRequestedAttributes() == null)
+ {
+ openIdSingleLoginSender.sendAuthenticationResponse(true, null);
+ }
+ else
+ {
+ openIdProviderSpi.get().fetchParameters(openIdProviderRequest.get().getRequestedAttributes());
+ }
+ }
+
+ @Dialogued(join = true)
+ public void setAttributes(Map<String, List<String>> attributeValues)
+ {
+ openIdSingleLoginSender.sendAuthenticationResponse(true, attributeValues);
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderBean.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInApplicationScopeProducer.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInApplicationScopeProducer.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInApplicationScopeProducer.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+@Alternative
+public class OpenIdProviderInApplicationScopeProducer
+{
+ @Produces
+ @ApplicationScoped
+ public OpenIdProviderBean produce(@New OpenIdProviderBean op)
+ {
+ return op;
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInApplicationScopeProducer.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInVirtualApplicationScopeProducer.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInVirtualApplicationScopeProducer.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInVirtualApplicationScopeProducer.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+
+import org.jboss.seam.security.external.virtualapplications.api.VirtualApplicationScoped;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+@Alternative
+public class OpenIdProviderInVirtualApplicationScopeProducer
+{
+ @Produces
+ @VirtualApplicationScoped
+ public OpenIdProviderBean produce(@New OpenIdProviderBean op)
+ {
+ return op;
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderInVirtualApplicationScopeProducer.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderOrRelyingParty.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderOrRelyingParty.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderOrRelyingParty.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+public enum OpenIdProviderOrRelyingParty
+{
+ OP, RP;
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderOrRelyingParty.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderRequest.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderRequest.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderRequest.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+import org.jboss.seam.security.external.dialogues.api.DialogueScoped;
+import org.openid4java.message.ParameterList;
+import org.openid4java.message.ax.FetchRequest;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+@DialogueScoped
+public class OpenIdProviderRequest implements Serializable
+{
+ private static final long serialVersionUID = -6701058408595984106L;
+
+ private ParameterList parameterList;
+
+ private String claimedIdentifier;
+
+ private List<OpenIdRequestedAttribute> requestedAttributes;
+
+ private FetchRequest fetchRequest;
+
+ private String userName;
+
+ public ParameterList getParameterList()
+ {
+ return parameterList;
+ }
+
+ public void setParameterList(ParameterList parameterList)
+ {
+ this.parameterList = parameterList;
+ }
+
+ public String getClaimedIdentifier()
+ {
+ return claimedIdentifier;
+ }
+
+ public void setClaimedIdentifier(String claimedIdentifier)
+ {
+ this.claimedIdentifier = claimedIdentifier;
+ }
+
+ public List<OpenIdRequestedAttribute> getRequestedAttributes()
+ {
+ return requestedAttributes;
+ }
+
+ public void setRequestedAttributes(List<OpenIdRequestedAttribute> requestedAttributes)
+ {
+ this.requestedAttributes = requestedAttributes;
+ }
+
+ public FetchRequest getFetchRequest()
+ {
+ return fetchRequest;
+ }
+
+ public void setFetchRequest(FetchRequest fetchRequest)
+ {
+ this.fetchRequest = fetchRequest;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdProviderRequest.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Copied: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpAuthenticationService.java (from rev 13692, modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdSingleLoginService.java)
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpAuthenticationService.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpAuthenticationService.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.security.external.InvalidRequestException;
+import org.jboss.seam.security.external.ResponseHandler;
+import org.jboss.seam.security.external.api.OpenIdPrincipal;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+import org.jboss.seam.security.external.dialogues.DialogueManager;
+import org.jboss.seam.security.external.dialogues.api.Dialogue;
+import org.jboss.seam.security.external.dialogues.api.Dialogued;
+import org.jboss.seam.security.external.spi.OpenIdRelyingPartySpi;
+import org.openid4java.OpenIDException;
+import org.openid4java.consumer.ConsumerManager;
+import org.openid4java.consumer.VerificationResult;
+import org.openid4java.discovery.DiscoveryInformation;
+import org.openid4java.discovery.Identifier;
+import org.openid4java.message.AuthRequest;
+import org.openid4java.message.AuthSuccess;
+import org.openid4java.message.ParameterList;
+import org.openid4java.message.ax.AxMessage;
+import org.openid4java.message.ax.FetchRequest;
+import org.openid4java.message.ax.FetchResponse;
+import org.slf4j.Logger;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public class OpenIdRpAuthenticationService
+{
+ @Inject
+ private OpenIdRequest openIdRequest;
+
+ @Inject
+ private ConsumerManager openIdConsumerManager;
+
+ @Inject
+ private Instance<OpenIdRelyingPartySpi> openIdRelyingPartySpi;
+
+ @Inject
+ private OpenIdRpBean relyingPartyBean;
+
+ @Inject
+ private ResponseHandler responseHandler;
+
+ @Inject
+ private Logger log;
+
+ @Inject
+ private Instance<Dialogue> dialogue;
+
+ @Inject
+ private DialogueManager dialogueManager;
+
+ public void handleIncomingMessage(HttpServletRequest httpRequest) throws InvalidRequestException
+ {
+ try
+ {
+ // extract the parameters from the authentication response
+ // (which comes in as a HTTP request from the OpenID provider)
+ ParameterList response = new ParameterList(httpRequest.getParameterMap());
+
+ // retrieve the previously stored discovery information
+ DiscoveryInformation discovered = openIdRequest.getDiscoveryInformation();
+
+ // extract the receiving URL from the HTTP request
+ StringBuffer receivingURL = httpRequest.getRequestURL();
+ String queryString = httpRequest.getQueryString();
+ if (queryString != null && queryString.length() > 0)
+ receivingURL.append("?").append(httpRequest.getQueryString());
+
+ // verify the response; ConsumerManager needs to be the same
+ // (static) instance used to place the authentication request
+ VerificationResult verification = openIdConsumerManager.verify(receivingURL.toString(), response, discovered);
+
+ // examine the verification result and extract the verified identifier
+ Identifier identifier = verification.getVerifiedId();
+
+ if (identifier != null)
+ {
+ AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
+
+ Map<String, List<String>> attributeValues = null;
+ if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX))
+ {
+ FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
+ @SuppressWarnings("unchecked")
+ Map<String, List<String>> attrValues = fetchResp.getAttributes();
+ attributeValues = attrValues;
+ }
+
+ OpenIdPrincipal principal = createPrincipal(identifier.getIdentifier(), discovered.getOPEndpoint(), attributeValues);
+
+ openIdRelyingPartySpi.get().loginSucceeded(principal);
+ }
+ else
+ {
+ openIdRelyingPartySpi.get().loginFailed(verification.getStatusMsg());
+ }
+ }
+ catch (OpenIDException e)
+ {
+ responseHandler.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
+ return;
+ }
+
+ dialogue.get().setFinished(true);
+ }
+
+ @Dialogued(join = true)
+ public void sendAuthRequest(String openId, List<OpenIdRequestedAttribute> attributes)
+ {
+ try
+ {
+ @SuppressWarnings("unchecked")
+ List<DiscoveryInformation> discoveries = openIdConsumerManager.discover(openId);
+
+ DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries);
+
+ openIdRequest.setDiscoveryInformation(discovered);
+
+ String openIdServiceUrl = relyingPartyBean.getServiceURL(OpenIdService.OPEN_ID_SERVICE);
+ String realm = relyingPartyBean.getRealm();
+ String returnTo = openIdServiceUrl + "?dialogueId=" + dialogue.get().getDialogueId();
+ AuthRequest authReq = openIdConsumerManager.authenticate(discovered, returnTo, realm);
+
+ if (attributes != null && attributes.size() > 0)
+ {
+ FetchRequest fetch = FetchRequest.createFetchRequest();
+ for (OpenIdRequestedAttribute attribute : attributes)
+ {
+ fetch.addAttribute(attribute.getAlias(), attribute.getTypeUri(), attribute.isRequired());
+ }
+ // attach the extension to the authentication request
+ authReq.addExtension(fetch);
+ }
+
+ String url = authReq.getDestinationUrl(true);
+
+ responseHandler.sendHttpRedirectToUserAgent(url);
+ }
+ catch (OpenIDException e)
+ {
+ log.warn("Authentication failed", e);
+ openIdRelyingPartySpi.get().loginFailed(e.getMessage());
+ }
+ }
+
+ private OpenIdPrincipal createPrincipal(String identifier, URL openIdProvider, Map<String, List<String>> attributeValues)
+ {
+ return new OpenIdPrincipal(identifier, openIdProvider, attributeValues);
+ }
+}
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpBean.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpBean.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdRpBean.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -21,18 +21,28 @@
*/
package org.jboss.seam.security.external.openid;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.io.Writer;
import java.util.List;
import javax.inject.Inject;
import javax.servlet.ServletContext;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
import org.jboss.seam.security.external.EntityBean;
-import org.jboss.seam.security.external.api.OpenIdAttribute;
+import org.jboss.seam.security.external.JaxbContext;
import org.jboss.seam.security.external.api.OpenIdRelyingPartyApi;
import org.jboss.seam.security.external.api.OpenIdRelyingPartyConfigurationApi;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
import org.jboss.seam.security.external.dialogues.api.Dialogued;
+import org.jboss.seam.security.external.jaxb.xrds.ObjectFactory;
+import org.jboss.seam.security.external.jaxb.xrds.Service;
+import org.jboss.seam.security.external.jaxb.xrds.Type;
+import org.jboss.seam.security.external.jaxb.xrds.URIPriorityAppendPattern;
+import org.jboss.seam.security.external.jaxb.xrds.XRD;
+import org.jboss.seam.security.external.jaxb.xrds.XRDS;
+import org.openid4java.discovery.DiscoveryInformation;
/**
* @author Marcel Kolsteren
@@ -41,20 +51,24 @@
public class OpenIdRpBean extends EntityBean implements OpenIdRelyingPartyApi, OpenIdRelyingPartyConfigurationApi
{
@Inject
- private OpenIdSingleLoginService openIdSingleLoginSender;
+ private OpenIdRpAuthenticationService openIdSingleLoginSender;
@Inject
private ServletContext servletContext;
- @Dialogued
- public void login(String openId, List<OpenIdAttribute> attributes)
+ @Inject
+ @JaxbContext(ObjectFactory.class)
+ private JAXBContext jaxbContext;
+
+ @Dialogued(join = true)
+ public void login(String identifier, List<OpenIdRequestedAttribute> attributes)
{
- openIdSingleLoginSender.sendAuthRequest(openId, attributes);
+ openIdSingleLoginSender.sendAuthRequest(identifier, attributes);
}
public String getServiceURL(OpenIdService service)
{
- String path = servletContext.getContextPath() + "/openid/" + service.getName();
+ String path = servletContext.getContextPath() + "/openid/RP/" + service.getName();
return createURL(path);
}
@@ -63,20 +77,40 @@
return createURL("");
}
- private String createURL(String path)
+ public String getXrdsURL()
{
+ return getServiceURL(OpenIdService.XRDS_SERVICE);
+ }
+
+ public void writeRpXrds(Writer writer)
+ {
try
{
- if (protocol.equals("http") && port == 80 || protocol.equals("https") && port == 443)
- {
- return new URL(protocol, hostName, path).toExternalForm();
- }
- else
- {
- return new URL(protocol, hostName, port, path).toExternalForm();
- }
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ XRDS xrds = objectFactory.createXRDS();
+
+ XRD xrd = objectFactory.createXRD();
+
+ Type type = objectFactory.createType();
+ type.setValue(DiscoveryInformation.OPENID2_RP);
+ URIPriorityAppendPattern uri = objectFactory.createURIPriorityAppendPattern();
+ uri.setValue(getServiceURL(OpenIdService.OPEN_ID_SERVICE));
+
+ Service service = objectFactory.createService();
+ service.getType().add(type);
+ service.getURI().add(uri);
+
+ xrd.getService().add(service);
+
+ xrds.getOtherelement().add(xrd);
+
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.marshal(xrds, writer);
}
- catch (MalformedURLException e)
+ catch (JAXBException e)
{
throw new RuntimeException(e);
}
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServerManagerFactory.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServerManagerFactory.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServerManagerFactory.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import org.openid4java.server.ServerManager;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+@ApplicationScoped
+public class OpenIdServerManagerFactory
+{
+ private ServerManager serverManager;
+
+ @Inject
+ private OpenIdProviderBean providerBean;
+
+ @Produces
+ public ServerManager getServerManager()
+ {
+ return serverManager;
+ }
+
+ @Inject
+ public void startup() throws Exception
+ {
+ serverManager = new ServerManager();
+ serverManager.setOPEndpointUrl(providerBean.getServiceURL(OpenIdService.OPEN_ID_SERVICE));
+ }
+}
\ No newline at end of file
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServerManagerFactory.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdService.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdService.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdService.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -21,7 +21,6 @@
*/
package org.jboss.seam.security.external.openid;
-
/**
* @author Marcel Kolsteren
*
@@ -30,7 +29,7 @@
{
OPEN_ID_SERVICE("OpenIdService"),
- OPEN_ID_XRDS_SERVICE("OpenIdXrdsService");
+ XRDS_SERVICE("XrdsService");
private String name;
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServlet.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServlet.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdServlet.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -25,6 +25,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -54,11 +55,17 @@
private ResponseHandler responseHandler;
@Inject
- private OpenIdSingleLoginService openIdSingleLoginService;
+ private OpenIdProviderAuthenticationService openIdProviderAuthenticationService;
@Inject
- private OpenIdXrdsProvider openIdXrdsProvider;
+ private OpenIdRpAuthenticationService openIdRpAuthenticationService;
+ @Inject
+ private Instance<OpenIdRpBean> rpBean;
+
+ @Inject
+ private Instance<OpenIdProviderBean> opBean;
+
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
@@ -90,14 +97,15 @@
private void handleMessage(HttpServletRequest httpRequest) throws InvalidRequestException
{
- Matcher matcher = Pattern.compile("/([^/]*?)$").matcher(httpRequest.getRequestURI());
+ Matcher matcher = Pattern.compile("/(OP|RP)/([^/]*?)$").matcher(httpRequest.getRequestURI());
boolean found = matcher.find();
if (!found)
{
responseHandler.sendError(HttpServletResponse.SC_NOT_FOUND, "No service endpoint exists for this URL.");
return;
}
- OpenIdService service = OpenIdService.getByName(matcher.group(1));
+ OpenIdProviderOrRelyingParty opOrRp = OpenIdProviderOrRelyingParty.valueOf(matcher.group(1));
+ OpenIdService service = OpenIdService.getByName(matcher.group(2));
if (service == null)
{
@@ -108,10 +116,24 @@
switch (service)
{
case OPEN_ID_SERVICE:
- openIdSingleLoginService.handleIncomingMessage(httpRequest);
+ if (opOrRp == OpenIdProviderOrRelyingParty.OP)
+ {
+ openIdProviderAuthenticationService.handleIncomingMessage(httpRequest);
+ }
+ else
+ {
+ openIdRpAuthenticationService.handleIncomingMessage(httpRequest);
+ }
break;
- case OPEN_ID_XRDS_SERVICE:
- openIdXrdsProvider.writeMetaData(responseHandler.getWriter("application/xrds+xml"));
+ case XRDS_SERVICE:
+ if (opOrRp == OpenIdProviderOrRelyingParty.OP)
+ {
+ opBean.get().writeOpIdentifierXrds(responseHandler.getWriter("application/xrds+xml"));
+ }
+ else
+ {
+ rpBean.get().writeRpXrds(responseHandler.getWriter("application/xrds+xml"));
+ }
break;
default:
throw new RuntimeException("Unsupported service " + service);
Deleted: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdSingleLoginService.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdSingleLoginService.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdSingleLoginService.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -1,162 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.security.external.openid;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-
-import org.jboss.seam.security.external.InvalidRequestException;
-import org.jboss.seam.security.external.ResponseHandler;
-import org.jboss.seam.security.external.api.OpenIdAttribute;
-import org.jboss.seam.security.external.api.OpenIdPrincipal;
-import org.jboss.seam.security.external.spi.OpenIdRelyingPartySpi;
-import org.openid4java.OpenIDException;
-import org.openid4java.consumer.ConsumerManager;
-import org.openid4java.consumer.VerificationResult;
-import org.openid4java.discovery.DiscoveryInformation;
-import org.openid4java.discovery.Identifier;
-import org.openid4java.message.AuthRequest;
-import org.openid4java.message.AuthSuccess;
-import org.openid4java.message.ParameterList;
-import org.openid4java.message.ax.AxMessage;
-import org.openid4java.message.ax.FetchRequest;
-import org.openid4java.message.ax.FetchResponse;
-
-/**
- * @author Marcel Kolsteren
- *
- */
-public class OpenIdSingleLoginService
-{
- @Inject
- private OpenIdRequest openIdRequest;
-
- @Inject
- private ConsumerManager openIdConsumerManager;
-
- @Inject
- private Instance<OpenIdRelyingPartySpi> openIdRelyingPartySpi;
-
- @Inject
- private OpenIdRpBean relyingPartyBean;
-
- @Inject
- private ResponseHandler responseHandler;
-
- @SuppressWarnings("unchecked")
- public void handleIncomingMessage(HttpServletRequest httpRequest) throws InvalidRequestException
- {
- try
- {
- // extract the parameters from the authentication response
- // (which comes in as a HTTP request from the OpenID provider)
- ParameterList response = new ParameterList(httpRequest.getParameterMap());
-
- // retrieve the previously stored discovery information
- DiscoveryInformation discovered = openIdRequest.getDiscoveryInformation();
-
- // extract the receiving URL from the HTTP request
- StringBuffer receivingURL = httpRequest.getRequestURL();
- String queryString = httpRequest.getQueryString();
- if (queryString != null && queryString.length() > 0)
- receivingURL.append("?").append(httpRequest.getQueryString());
-
- // verify the response; ConsumerManager needs to be the same
- // (static) instance used to place the authentication request
- VerificationResult verification = openIdConsumerManager.verify(receivingURL.toString(), response, discovered);
-
- // examine the verification result and extract the verified identifier
- Identifier identifier = verification.getVerifiedId();
-
- if (identifier != null)
- {
- AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
-
- Map<String, List<String>> attributes = null;
- if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX))
- {
- FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
-
- attributes = fetchResp.getAttributes();
- }
-
- OpenIdPrincipal principal = createPrincipal(identifier.getIdentifier(), discovered.getOPEndpoint(), attributes);
-
- openIdRelyingPartySpi.get().loginSucceeded(principal);
- }
- else
- {
- openIdRelyingPartySpi.get().loginFailed();
- }
- }
- catch (OpenIDException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private OpenIdPrincipal createPrincipal(String identifier, URL openIdProvider, Map<String, List<String>> attributes)
- {
- return new OpenIdPrincipal(identifier, openIdProvider, attributes);
- }
-
- public void sendAuthRequest(String openId, List<OpenIdAttribute> attributes)
- {
- try
- {
- @SuppressWarnings("unchecked")
- List<DiscoveryInformation> discoveries = openIdConsumerManager.discover(openId);
-
- DiscoveryInformation discovered = openIdConsumerManager.associate(discoveries);
-
- openIdRequest.setDiscoveryInformation(discovered);
-
- String openIdServiceUrl = relyingPartyBean.getServiceURL(OpenIdService.OPEN_ID_SERVICE);
- String realm = relyingPartyBean.getRealm();
- AuthRequest authReq = openIdConsumerManager.authenticate(discovered, openIdServiceUrl, realm);
-
- if (attributes != null && attributes.size() > 0)
- {
- FetchRequest fetch = FetchRequest.createFetchRequest();
- for (OpenIdAttribute attribute : attributes)
- {
- fetch.addAttribute(attribute.getAlias(), attribute.getTypeUri(), attribute.isRequired());
- }
- // attach the extension to the authentication request
- authReq.addExtension(fetch);
- }
-
- String url = authReq.getDestinationUrl(true);
-
- responseHandler.sendHttpRedirectToUserAgent(url);
- }
- catch (OpenIDException e)
- {
- openIdRelyingPartySpi.get().loginFailed();
- }
- }
-}
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdUsersServlet.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdUsersServlet.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdUsersServlet.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.openid;
+
+import java.io.IOException;
+import java.net.URLDecoder;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.security.external.spi.OpenIdProviderSpi;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public class OpenIdUsersServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1476698956314628568L;
+
+ @Inject
+ private Instance<OpenIdProviderBean> opBean;
+
+ @Inject
+ private Instance<OpenIdProviderSpi> providerSpi;
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ String prefix = opBean.get().getUsersUrlPrefix();
+ if (!request.getRequestURL().toString().startsWith(prefix))
+ {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, "Only accepting requests for URLs starting with " + prefix);
+ return;
+ }
+
+ String userNamePart = request.getRequestURL().substring(prefix.length());
+ String userName = URLDecoder.decode(userNamePart, "UTF-8");
+
+ if (providerSpi.get().userExists(userName))
+ {
+ response.setContentType("application/xrds+xml");
+ opBean.get().writeClaimedIdentifierXrds(response.getWriter(), opBean.get().getOpLocalIdentifierForUserName(userName));
+ }
+ else
+ {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, "User " + userName + " does not exist.");
+ }
+ }
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdUsersServlet.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Deleted: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdXrdsProvider.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdXrdsProvider.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/openid/OpenIdXrdsProvider.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.security.external.openid;
-
-import java.io.Writer;
-
-import javax.inject.Inject;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.jboss.seam.security.external.JaxbContext;
-import org.jboss.seam.security.external.jaxb.xrds.ObjectFactory;
-import org.jboss.seam.security.external.jaxb.xrds.Service;
-import org.jboss.seam.security.external.jaxb.xrds.Type;
-import org.jboss.seam.security.external.jaxb.xrds.URIPriorityAppendPattern;
-import org.jboss.seam.security.external.jaxb.xrds.XRD;
-import org.jboss.seam.security.external.jaxb.xrds.XRDS;
-import org.openid4java.discovery.DiscoveryInformation;
-
-/**
- * @author Marcel Kolsteren
- *
- */
-public class OpenIdXrdsProvider
-{
- @Inject
- private OpenIdRpBean serviceProvider;
-
- @Inject
- @JaxbContext(ObjectFactory.class)
- private JAXBContext jaxbContext;
-
- public void writeMetaData(Writer writer)
- {
- try
- {
- ObjectFactory objectFactory = new ObjectFactory();
-
- XRDS xrds = objectFactory.createXRDS();
-
- XRD xrd = objectFactory.createXRD();
-
- Type type = objectFactory.createType();
- type.setValue(DiscoveryInformation.OPENID2_RP);
- URIPriorityAppendPattern uri = objectFactory.createURIPriorityAppendPattern();
- uri.setValue(serviceProvider.getServiceURL(OpenIdService.OPEN_ID_SERVICE));
-
- Service service = objectFactory.createService();
- service.getType().add(type);
- service.getURI().add(uri);
-
- xrd.getService().add(service);
-
- xrds.getOtherelement().add(xrd);
-
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.marshal(xrds, writer);
- }
- catch (JAXBException e)
- {
- throw new RuntimeException(e);
- }
- }
-}
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlEntityBean.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlEntityBean.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlEntityBean.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -78,16 +78,7 @@
public String getServiceURL(SamlServiceType service)
{
- String portString;
- if (protocol.equals("http") && port != 80 || protocol.equals("https") && port != 443)
- {
- portString = ":" + port;
- }
- else
- {
- portString = "";
- }
- return protocol + "://" + hostName + portString + servletContext.getContextPath() + "/saml/" + getIdpOrSp() + "/" + service.getName();
+ return createURL(servletContext.getContextPath() + "/saml/" + getIdpOrSp() + "/" + service.getName());
}
public String getMetaDataURL()
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlMessageReceiver.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlMessageReceiver.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/SamlMessageReceiver.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -43,7 +43,6 @@
import org.jboss.seam.security.external.InvalidRequestException;
import org.jboss.seam.security.external.JaxbContext;
import org.jboss.seam.security.external.dialogues.DialogueManager;
-import org.jboss.seam.security.external.dialogues.api.Dialogue;
import org.jboss.seam.security.external.jaxb.samlv2.protocol.RequestAbstractType;
import org.jboss.seam.security.external.jaxb.samlv2.protocol.ResponseType;
import org.jboss.seam.security.external.jaxb.samlv2.protocol.StatusResponseType;
@@ -71,9 +70,6 @@
private DialogueManager dialogueManager;
@Inject
- private Instance<Dialogue> dialogue;
-
- @Inject
private Instance<SamlDialogue> samlDialogue;
@Inject
@@ -294,14 +290,7 @@
throw new RuntimeException(e);
}
- if (dialogue.get().isFinished())
- {
- dialogueManager.endDialogue();
- }
- else
- {
- dialogueManager.detachDialogue();
- }
+ dialogueManager.detachDialogue();
}
private RequestAbstractType getSamlRequest(Document document) throws InvalidRequestException
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/idp/SamlIdpBean.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/idp/SamlIdpBean.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/idp/SamlIdpBean.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -28,7 +28,6 @@
import java.util.Set;
import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.Typed;
import javax.inject.Inject;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
@@ -57,7 +56,6 @@
* @author Marcel Kolsteren
*
*/
-(a)Typed(SamlIdpBean.class)
public class SamlIdpBean extends SamlEntityBean implements SamlMultiUserIdentityProviderApi, SamlIdentityProviderConfigurationApi
{
@Inject
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/sp/SamlSpBean.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/sp/SamlSpBean.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/saml/sp/SamlSpBean.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -50,7 +50,6 @@
* @author Marcel Kolsteren
*
*/
-(a)Typed(SamlSpBean.class)
public class SamlSpBean extends SamlEntityBean implements SamlMultiUserServiceProviderApi, SamlServiceProviderConfigurationApi
{
private List<SamlExternalIdentityProvider> identityProviders = new LinkedList<SamlExternalIdentityProvider>();
Added: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdProviderSpi.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdProviderSpi.java (rev 0)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdProviderSpi.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.external.spi;
+
+import java.util.List;
+
+import org.jboss.seam.security.external.api.OpenIdProviderApi;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public interface OpenIdProviderSpi
+{
+ /**
+ * This method is called after receipt of an authentication request from a
+ * relying party. Upon receipt of this call, the application should try to
+ * authenticate the user (either silently or interacting with the user). The
+ * result of the authentication needs to be reported back using the API calls
+ * {@link OpenIdProviderApi#authenticationSucceeded} or
+ * {@link OpenIdProviderApi#authenticationFailed}.
+ *
+ * @param realm represents the part of URL-space for which the authentication
+ * is valid; realms are designed to give the end user an indication
+ * of the scope of the authentication request; the application
+ * should present the realm when requesting the end user's approval
+ * for the authentication request
+ * @param userName this optional attribute indicates the end user that needs
+ * to be authenticated; if this parameter is null, the application
+ * needs to ask the use for her username
+ * @param immediate if this is true, there must be no interaction with the
+ * user (silent authentication)
+ */
+ void authenticate(String realm, String userName, boolean immediate);
+
+ /**
+ * This method is called to check whether a username exists.
+ *
+ * @param userName the username
+ * @return true if a user with that username exists, false otherwise
+ */
+ boolean userExists(String userName);
+
+ void fetchParameters(List<OpenIdRequestedAttribute> requestedAttributes);
+}
Property changes on: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdProviderSpi.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Modified: modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdRelyingPartySpi.java
===================================================================
--- modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdRelyingPartySpi.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/java/org/jboss/seam/security/external/spi/OpenIdRelyingPartySpi.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -31,5 +31,5 @@
{
public void loginSucceeded(OpenIdPrincipal principal);
- public void loginFailed();
+ public void loginFailed(String message);
}
Modified: modules/security/trunk/external/src/main/resources/META-INF/web-fragment.xml
===================================================================
--- modules/security/trunk/external/src/main/resources/META-INF/web-fragment.xml 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/main/resources/META-INF/web-fragment.xml 2010-09-18 11:03:55 UTC (rev 13765)
@@ -13,6 +13,11 @@
<servlet-class>org.jboss.seam.security.external.openid.OpenIdServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>OpenIdUsersServlet</servlet-name>
+ <servlet-class>org.jboss.seam.security.external.openid.OpenIdUsersServlet</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>SamlServlet</servlet-name>
<url-pattern>/saml/*</url-pattern>
@@ -23,4 +28,9 @@
<url-pattern>/openid/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>OpenIdUsersServlet</servlet-name>
+ <url-pattern>/users/*</url-pattern>
+ </servlet-mapping>
+
</web-fragment>
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/MetaDataLoader.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/MetaDataLoader.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/MetaDataLoader.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -31,13 +31,13 @@
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
-import org.jboss.seam.security.external.api.SamlEntityConfigurationApi;
+import org.jboss.seam.security.external.saml.SamlEntityBean;
@ApplicationScoped
public class MetaDataLoader
{
@Inject
- private Instance<SamlEntityConfigurationApi> samlEntityBean;
+ private Instance<SamlEntityBean> samlEntityBean;
public void loadMetaDataOfOtherSamlEntity(String hostName, String idpOrSp)
{
Deleted: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/OpenIdSpiMock.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/OpenIdSpiMock.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/OpenIdSpiMock.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.security.externaltest.integration;
-
-import org.jboss.seam.security.external.api.OpenIdPrincipal;
-import org.jboss.seam.security.external.spi.OpenIdRelyingPartySpi;
-
-public class OpenIdSpiMock implements OpenIdRelyingPartySpi
-{
-
- public void loginFailed()
- {
- // TODO Auto-generated method stub
-
- }
-
- public void loginSucceeded(OpenIdPrincipal principal)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void logoutFailed(OpenIdPrincipal principal, String statusCode)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void logoutSucceeded(OpenIdPrincipal principal)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/AfterDeployEventHandler.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/AfterDeployEventHandler.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/AfterDeployEventHandler.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -31,7 +31,9 @@
public void callback(Context context, AfterDeploy event) throws Exception
{
DeployableContainer container = context.get(DeployableContainer.class);
- container.deploy(context, ArchiveBuilder.createTestArchive("idp"));
+ container.deploy(context, ArchiveBuilder.getArchive("idp"));
+ container.deploy(context, ArchiveBuilder.getArchive("op"));
+ container.deploy(context, ArchiveBuilder.getArchive("rp"));
}
}
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/ArchiveBuilder.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/ArchiveBuilder.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/ArchiveBuilder.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -21,14 +21,19 @@
*/
package org.jboss.seam.security.externaltest.integration.client;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.enterprise.inject.spi.Extension;
import org.jboss.seam.security.external.ResponseHandler;
import org.jboss.seam.security.external.dialogues.DialogueContextExtension;
import org.jboss.seam.security.external.virtualapplications.VirtualApplicationContextExtension;
import org.jboss.seam.security.externaltest.integration.MetaDataLoader;
-import org.jboss.seam.security.externaltest.integration.idp.IdpCustomizer;
-import org.jboss.seam.security.externaltest.integration.sp.SpCustomizer;
+import org.jboss.seam.security.externaltest.integration.openid.op.OpCustomizer;
+import org.jboss.seam.security.externaltest.integration.openid.rp.RpCustomizer;
+import org.jboss.seam.security.externaltest.integration.saml.idp.IdpCustomizer;
+import org.jboss.seam.security.externaltest.integration.saml.sp.SpCustomizer;
import org.jboss.seam.security.externaltest.util.MavenArtifactResolver;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -40,53 +45,55 @@
static WebArchive spArchive;
- static WebArchive getArchive(String idpOrSp)
+ static Map<String, WebArchive> webArchives = new HashMap<String, WebArchive>();
+
+ static WebArchive getArchive(String entity)
{
- if (idpOrSp.equals("sp"))
+ WebArchive webArchive = webArchives.get(entity);
+ if (webArchive == null)
{
- return spArchive;
+ webArchive = createTestArchive(entity);
+ webArchives.put(entity, webArchive);
}
- else
- {
- return idpArchive;
- }
+ return webArchive;
}
- static WebArchive createTestArchive(String idpOrSp)
+ static private WebArchive createTestArchive(String entity)
{
- WebArchive war = ShrinkWrap.create(WebArchive.class, idpOrSp + ".war");
+ WebArchive war = ShrinkWrap.create(WebArchive.class, entity + ".war");
war.addLibraries(MavenArtifactResolver.resolve("org.jboss.seam.servlet:seam-servlet"));
war.addLibraries(MavenArtifactResolver.resolve("org.jboss.seam.servlet:seam-servlet-api"));
war.addLibraries(MavenArtifactResolver.resolve("org.openid4java", "openid4java"));
+ war.addLibraries(MavenArtifactResolver.resolve("nekohtml", "nekohtml"));
war.addLibraries(MavenArtifactResolver.resolve("org.jboss.weld:weld-extensions"));
war.addLibraries(MavenArtifactResolver.resolve("commons-httpclient:commons-httpclient"));
- war.addWebResource("test_keystore.jks");
- war.addWebResource("WEB-INF/" + idpOrSp + "-beans.xml", "beans.xml");
+ war.addWebResource("WEB-INF/" + entity + "-beans.xml", "beans.xml");
war.addWebResource("WEB-INF/context.xml", "context.xml");
war.addPackage(MetaDataLoader.class.getPackage());
- if (idpOrSp.equals("sp"))
+ if (entity.equals("sp"))
{
war.addPackage(SpCustomizer.class.getPackage());
+ war.addWebResource("test_keystore.jks");
}
- else
+ else if (entity.equals("idp"))
{
war.addPackage(IdpCustomizer.class.getPackage());
+ war.addWebResource("test_keystore.jks");
}
-
- war.addLibrary(createJarModule());
-
- if (idpOrSp.equals("sp"))
+ else if (entity.equals("op"))
{
- spArchive = war;
+ war.addPackage(OpCustomizer.class.getPackage());
}
- else
+ else if (entity.equals("rp"))
{
- idpArchive = war;
+ war.addPackage(RpCustomizer.class.getPackage());
}
+ war.addLibrary(createJarModule());
+
return war;
}
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/BeforeUnDeployEventHandler.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/BeforeUnDeployEventHandler.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/BeforeUnDeployEventHandler.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -32,5 +32,7 @@
{
DeployableContainer container = context.get(DeployableContainer.class);
container.undeploy(context, ArchiveBuilder.getArchive("idp"));
+ container.undeploy(context, ArchiveBuilder.getArchive("op"));
+ container.undeploy(context, ArchiveBuilder.getArchive("rp"));
}
}
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/IntegrationTest.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/IntegrationTest.java 2010-09-17 19:42:59 UTC (rev 13764)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/client/IntegrationTest.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -27,7 +27,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
@@ -61,6 +60,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Maps;
+
@RunWith(Arquillian.class)
@Run(RunModeType.AS_CLIENT)
public class IntegrationTest
@@ -86,14 +87,13 @@
public static Archive<?> createTestArchive()
{
/*
- * We need to deploy two war files: one for the service provider and one
- * for the identity provider. Current version of Arquillian (1.0.0.Alpha3)
- * doesn't support multiple archives. See ARQ-67. For the time being, we
- * add the first war here, and we add the second war using a listener that
- * is registered by using the Arquillian SPI (see {@Link
- * AfterDeployEventHandler}).
+ * We need to deploy 4 war files. Current version of Arquillian
+ * (1.0.0.Alpha3) doesn't support multiple archives. See ARQ-67. For the
+ * time being, we add the first war here, and we add the other war files
+ * using a listener that is registered through the Arquillian SPI (see
+ * {@Link AfterDeployEventHandler}).
*/
- return ArchiveBuilder.createTestArchive("sp");
+ return ArchiveBuilder.getArchive("sp");
}
@Before
@@ -106,15 +106,15 @@
@Test
public void samlTest()
{
- Map<String, String> params = new HashMap<String, String>();
+ Map<String, String> params = Maps.newHashMap();
params.put("command", "loadMetaData");
sendMessageToApplication("www.sp1.com", "sp", params);
sendMessageToApplication("www.sp2.com", "sp", params);
sendMessageToApplication("www.idp.com", "idp", params);
// Login one user at each service provider application
- signOn("www.sp1.com", "https://www.idp.com", "John Doe");
- signOn("www.sp2.com", "https://www.idp.com", "Jane Doe");
+ samlSignOn("www.sp1.com", "https://www.idp.com", "John Doe");
+ samlSignOn("www.sp2.com", "https://www.idp.com", "Jane Doe");
// Check that the IDP has two sessions (one for each user) and that each
// SP has one
@@ -151,24 +151,84 @@
checkDialogueTermination("www.sp2.com", "sp");
}
+ @Test
+ public void openIdLoginWithOpIdentifierTest()
+ {
+ String opIdentifier = "http://localhost:8080/op/openid/OP/XrdsService";
+ String userName = "john_doe";
+
+ Map<String, String> params = Maps.newHashMap();
+ params.put("command", "login");
+ params.put("identifier", opIdentifier);
+ params.put("fetchEmail", "false");
+ sendMessageToApplication("localhost", "rp", params);
+
+ checkApplicationMessage("Please login.");
+
+ params = Maps.newHashMap();
+ params.put("command", "authenticate");
+ params.put("userName", userName);
+ sendMessageToApplication("localhost", "op", params);
+
+ checkApplicationMessage("Login succeeded (http://localhost:8080/op/users/" + userName + ")");
+
+ // All dialogues should be terminated by now.
+ checkDialogueTermination("www.op.com", "op");
+ checkDialogueTermination("www.rp.com", "rp");
+ }
+
+ @Test
+ public void openIdLoginWithClaimedIdentifierAndAttributeExchangeTest()
+ {
+ String userName = "jane_doe";
+ String claimedId = "http://localhost:8080/op/users/" + userName;
+
+ Map<String, String> params = Maps.newHashMap();
+ params.put("command", "login");
+ params.put("identifier", claimedId);
+ params.put("fetchEmail", "true");
+ sendMessageToApplication("localhost", "rp", params);
+
+ checkApplicationMessage("Please provide the password for " + userName + ".");
+
+ params = Maps.newHashMap();
+ params.put("command", "authenticate");
+ params.put("userName", userName);
+ sendMessageToApplication("localhost", "op", params);
+
+ checkApplicationMessage("Please provide your email.");
+
+ params = Maps.newHashMap();
+ params.put("command", "setAttribute");
+ String email = "jane_doe(a)op.com";
+ params.put("email", email);
+ sendMessageToApplication("localhost", "op", params);
+
+ checkApplicationMessage("Login succeeded (" + claimedId + ", email " + email + ")");
+
+ // All dialogues should be terminated by now.
+ checkDialogueTermination("www.op.com", "op");
+ checkDialogueTermination("www.rp.com", "rp");
+ }
+
private void checkNrOfSessions(String serverName, String spOrIdp, int expectedNumber)
{
- Map<String, String> params = new HashMap<String, String>();
+ Map<String, String> params = Maps.newHashMap();
params.put("command", "getNrOfSessions");
sendMessageToApplication(serverName, spOrIdp, params);
checkApplicationMessage(Integer.toString(expectedNumber));
}
- private void signOn(String spHostName, String idpEntityId, String userName)
+ private void samlSignOn(String spHostName, String idpEntityId, String userName)
{
- Map<String, String> params = new HashMap<String, String>();
+ Map<String, String> params = Maps.newHashMap();
params.put("command", "login");
params.put("idpEntityId", idpEntityId);
sendMessageToApplication(spHostName, "sp", params);
checkApplicationMessage("Please login");
- params = new HashMap<String, String>();
+ params = Maps.newHashMap();
params.put("command", "authenticate");
params.put("userName", userName);
sendMessageToApplication("www.idp.com", "idp", params);
@@ -176,7 +236,7 @@
checkApplicationMessage("Login succeeded (" + userName + ")");
}
- private void sendMessageToApplication(String hostName, String spOrIdp, Map<String, String> params)
+ private void sendMessageToApplication(String hostName, String contextRoot, Map<String, String> params)
{
List<NameValuePair> qParams = new ArrayList<NameValuePair>();
for (Map.Entry<String, String> mapEntry : params.entrySet())
@@ -186,21 +246,24 @@
URI uri;
try
{
- uri = URIUtils.createURI("http", "localhost", 8080, "/" + spOrIdp + "/testservlet", URLEncodedUtils.format(qParams, "UTF-8"), null);
+ uri = URIUtils.createURI("http", "localhost", 8080, "/" + contextRoot + "/testservlet", URLEncodedUtils.format(qParams, "UTF-8"), null);
}
catch (URISyntaxException e)
{
throw new RuntimeException(e);
}
request = new HttpGet(uri);
- request.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(hostName));
+ if (!hostName.equals("localhost"))
+ {
+ request.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(hostName, 8080));
+ }
executeHttpRequestAndRelay();
}
private void checkDialogueTermination(String serverName, String spOrIdp)
{
- Map<String, String> params = new HashMap<String, String>();
+ Map<String, String> params = Maps.newHashMap();
params.put("command", "getNrOfDialogues");
sendMessageToApplication(serverName, spOrIdp, params);
checkApplicationMessage("0");
@@ -229,7 +292,10 @@
String serverName = extractServerNameFromUri(uri);
uri = uri.replace(serverName, "localhost");
HttpPost httpPost = new HttpPost(uri);
- httpPost.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(serverName));
+ if (!serverName.equals("localhost"))
+ {
+ httpPost.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(serverName, 8080));
+ }
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair(name, value));
UrlEncodedFormEntity entity;
@@ -250,7 +316,7 @@
log.info("Received redirect to " + location);
String serverName = extractServerNameFromUri(location);
HttpGet httpGet = new HttpGet(location.replace(serverName, "localhost"));
- httpGet.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(serverName));
+ httpGet.getParams().setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost(serverName, 8080));
request = httpGet;
}
else if (responseType == ResponseType.ERROR)
Added: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpCustomizer.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpCustomizer.java (rev 0)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpCustomizer.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.externaltest.integration.openid.op;
+
+import javax.enterprise.event.Observes;
+import javax.servlet.ServletContextEvent;
+
+import org.jboss.seam.security.external.api.OpenIdProviderConfigurationApi;
+import org.jboss.seam.servlet.event.qualifier.Initialized;
+
+public class OpCustomizer
+{
+ public void servletInitialized(@Observes @Initialized final ServletContextEvent e, OpenIdProviderConfigurationApi op)
+ {
+ op.setHostName("localhost");
+ op.setProtocol("http");
+ op.setPort(8080);
+ }
+}
Property changes on: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpCustomizer.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpTestServlet.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpTestServlet.java (rev 0)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpTestServlet.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,60 @@
+package org.jboss.seam.security.externaltest.integration.openid.op;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.security.external.api.ResponseHolder;
+
+@WebServlet(name = "OpTestServlet", urlPatterns = { "/testservlet" })
+public class OpTestServlet extends HttpServlet
+{
+ private static final long serialVersionUID = -4551548646707243449L;
+
+ @Inject
+ private OpenIdProviderApplicationMock openIdProviderApplicationMock;
+
+ @Inject
+ private ResponseHolder responseHolder;
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ responseHolder.setResponse(response);
+ String command = request.getParameter("command");
+ if (command.equals("authenticate"))
+ {
+ String userName = request.getParameter("userName");
+ openIdProviderApplicationMock.handleLogin(userName);
+ }
+ else if (command.equals("setAttribute"))
+ {
+ String email = request.getParameter("email");
+ openIdProviderApplicationMock.setAttribute("email", email);
+ }
+ else if (command.equals("getNrOfDialogues"))
+ {
+ int count = 0;
+ Enumeration<String> attributeNames = request.getServletContext().getAttributeNames();
+ while (attributeNames.hasMoreElements())
+ {
+ String attributeName = attributeNames.nextElement();
+ if (attributeName.startsWith("DialogueContextBeanStore"))
+ {
+ count++;
+ }
+ }
+ response.getWriter().print(count);
+ }
+ else
+ {
+ throw new RuntimeException("Invalid command: " + command);
+ }
+ }
+}
Property changes on: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpTestServlet.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpenIdProviderApplicationMock.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpenIdProviderApplicationMock.java (rev 0)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpenIdProviderApplicationMock.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.externaltest.integration.openid.op;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.jboss.seam.security.external.api.OpenIdProviderApi;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+import org.jboss.seam.security.external.api.ResponseHolder;
+import org.jboss.seam.security.external.dialogues.DialogueManager;
+import org.jboss.seam.security.external.dialogues.api.Dialogue;
+import org.jboss.seam.security.external.spi.OpenIdProviderSpi;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+@ApplicationScoped
+public class OpenIdProviderApplicationMock implements OpenIdProviderSpi
+{
+ @Inject
+ private ResponseHolder responseHolder;
+
+ @Inject
+ private OpenIdProviderApi opApi;
+
+ private String dialogueId;
+
+ @Inject
+ private Dialogue dialogue;
+
+ @Inject
+ private DialogueManager dialogueManager;
+
+ public void handleLogin(String userName)
+ {
+ dialogueManager.attachDialogue(dialogueId);
+ opApi.authenticationSucceeded(userName);
+ dialogueManager.detachDialogue();
+ }
+
+ public void setAttribute(String alias, String value)
+ {
+ dialogueManager.attachDialogue(dialogueId);
+ Map<String, List<String>> attributes = Maps.newHashMap();
+ attributes.put(alias, Lists.newArrayList(value));
+ opApi.setAttributes(attributes);
+ dialogueManager.detachDialogue();
+ }
+
+ public void authenticate(String realm, String userName, boolean immediate)
+ {
+ if (userName == null)
+ {
+ writeMessageToResponse("Please login.");
+ }
+ else
+ {
+ writeMessageToResponse("Please provide the password for " + userName + ".");
+ }
+ dialogueId = dialogue.getDialogueId();
+ }
+
+ private void writeMessageToResponse(String message)
+ {
+ try
+ {
+ responseHolder.getResponse().getWriter().print(message);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean userExists(String userName)
+ {
+ return true;
+ }
+
+ public void fetchParameters(List<OpenIdRequestedAttribute> requestedAttributes)
+ {
+ writeMessageToResponse("Please provide your " + requestedAttributes.get(0).getAlias() + ".");
+ dialogueId = dialogue.getDialogueId();
+ }
+}
Property changes on: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/op/OpenIdProviderApplicationMock.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/OpenIdRpApplicationMock.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/OpenIdRpApplicationMock.java (rev 0)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/OpenIdRpApplicationMock.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.externaltest.integration.openid.rp;
+
+import java.io.IOException;
+
+import javax.inject.Inject;
+
+import org.jboss.seam.security.external.api.OpenIdPrincipal;
+import org.jboss.seam.security.external.api.OpenIdRelyingPartyApi;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+import org.jboss.seam.security.external.api.ResponseHolder;
+import org.jboss.seam.security.external.dialogues.api.Dialogued;
+import org.jboss.seam.security.external.spi.OpenIdRelyingPartySpi;
+
+import com.google.common.collect.Lists;
+
+public class OpenIdRpApplicationMock implements OpenIdRelyingPartySpi
+{
+ @Inject
+ private ResponseHolder responseHolder;
+
+ @Inject
+ private OpenIdRelyingPartyApi rpApi;
+
+ @Dialogued
+ public void login(String identifier, boolean fetchEmail)
+ {
+ if (fetchEmail)
+ {
+ OpenIdRequestedAttribute requestedAttribute = new OpenIdRequestedAttribute("email", "http://axschema.org/contact/email", true, 1);
+ rpApi.login(identifier, Lists.newArrayList(requestedAttribute));
+ }
+ else
+ {
+ rpApi.login(identifier, null);
+ }
+ }
+
+ public void loginFailed(String message)
+ {
+ writeMessageToResponse("Login failed: " + message);
+ }
+
+ public void loginSucceeded(OpenIdPrincipal principal)
+ {
+ if (principal.getAttributeValues() != null)
+ {
+ String email = (String) principal.getAttribute("email");
+ writeMessageToResponse("Login succeeded (" + principal.getIdentifier() + ", email " + email + ")");
+ }
+ else
+ {
+ writeMessageToResponse("Login succeeded (" + principal.getIdentifier() + ")");
+ }
+ }
+
+ private void writeMessageToResponse(String message)
+ {
+ try
+ {
+ responseHolder.getResponse().getWriter().print(message);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Property changes on: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/OpenIdRpApplicationMock.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpCustomizer.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpCustomizer.java (rev 0)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpCustomizer.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.security.externaltest.integration.openid.rp;
+
+import javax.enterprise.event.Observes;
+import javax.servlet.ServletContextEvent;
+
+import org.jboss.seam.security.external.api.OpenIdRelyingPartyConfigurationApi;
+import org.jboss.seam.servlet.event.qualifier.Initialized;
+
+public class RpCustomizer
+{
+ public void servletInitialized(@Observes @Initialized final ServletContextEvent e, OpenIdRelyingPartyConfigurationApi rp)
+ {
+ rp.setHostName("localhost");
+ rp.setProtocol("http");
+ rp.setPort(8080);
+ }
+}
Property changes on: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpCustomizer.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpTestServlet.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpTestServlet.java (rev 0)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpTestServlet.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,56 @@
+package org.jboss.seam.security.externaltest.integration.openid.rp;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.security.external.api.ResponseHolder;
+
+@WebServlet(name = "RpTestServlet", urlPatterns = { "/testservlet" })
+public class RpTestServlet extends HttpServlet
+{
+ private static final long serialVersionUID = -4551548646707243449L;
+
+ @Inject
+ private OpenIdRpApplicationMock openIdRpApplicationMock;
+
+ @Inject
+ private ResponseHolder responseHolder;
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ responseHolder.setResponse(response);
+ String command = request.getParameter("command");
+ if (command.equals("login"))
+ {
+ String identifier = request.getParameter("identifier");
+ boolean fetchEmail = Boolean.parseBoolean(request.getParameter("fetchEmail"));
+ openIdRpApplicationMock.login(identifier, fetchEmail);
+ }
+ else if (command.equals("getNrOfDialogues"))
+ {
+ int count = 0;
+ Enumeration<String> attributeNames = request.getServletContext().getAttributeNames();
+ while (attributeNames.hasMoreElements())
+ {
+ String attributeName = attributeNames.nextElement();
+ if (attributeName.startsWith("DialogueContextBeanStore"))
+ {
+ count++;
+ }
+ }
+ response.getWriter().print(count);
+ }
+ else
+ {
+ throw new RuntimeException("Invalid command: " + command);
+ }
+ }
+}
Property changes on: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/openid/rp/RpTestServlet.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Copied: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp (from rev 13738, modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/idp)
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/IdpCustomizer.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/idp/IdpCustomizer.java 2010-09-13 10:43:33 UTC (rev 13738)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/IdpCustomizer.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -19,7 +19,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.seam.security.externaltest.integration.idp;
+package org.jboss.seam.security.externaltest.integration.saml.idp;
import javax.enterprise.event.Observes;
import javax.servlet.ServletContextEvent;
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/IdpTestServlet.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/idp/IdpTestServlet.java 2010-09-13 10:43:33 UTC (rev 13738)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/IdpTestServlet.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -1,4 +1,4 @@
-package org.jboss.seam.security.externaltest.integration.idp;
+package org.jboss.seam.security.externaltest.integration.saml.idp;
import java.io.IOException;
import java.util.Enumeration;
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/SamlIdpApplicationMock.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/idp/SamlIdpApplicationMock.java 2010-09-13 10:43:33 UTC (rev 13738)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/idp/SamlIdpApplicationMock.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -19,7 +19,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.seam.security.externaltest.integration.idp;
+package org.jboss.seam.security.externaltest.integration.saml.idp;
import java.io.IOException;
Copied: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp (from rev 13738, modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/sp)
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SamlSpApplicationMock.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/sp/SamlSpApplicationMock.java 2010-09-13 10:43:33 UTC (rev 13738)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SamlSpApplicationMock.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -19,7 +19,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.seam.security.externaltest.integration.sp;
+package org.jboss.seam.security.externaltest.integration.saml.sp;
import java.io.IOException;
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpCustomizer.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/sp/SpCustomizer.java 2010-09-13 10:43:33 UTC (rev 13738)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpCustomizer.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -19,7 +19,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.seam.security.externaltest.integration.sp;
+package org.jboss.seam.security.externaltest.integration.saml.sp;
import javax.enterprise.event.Observes;
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpTestServlet.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/sp/SpTestServlet.java 2010-09-13 10:43:33 UTC (rev 13738)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpTestServlet.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -1,4 +1,4 @@
-package org.jboss.seam.security.externaltest.integration.sp;
+package org.jboss.seam.security.externaltest.integration.saml.sp;
import java.io.IOException;
import java.util.Enumeration;
Modified: modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpVirtualApplicationCreator.java
===================================================================
--- modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/sp/SpVirtualApplicationCreator.java 2010-09-13 10:43:33 UTC (rev 13738)
+++ modules/security/trunk/external/src/test/java/org/jboss/seam/security/externaltest/integration/saml/sp/SpVirtualApplicationCreator.java 2010-09-18 11:03:55 UTC (rev 13765)
@@ -19,7 +19,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.seam.security.externaltest.integration.sp;
+package org.jboss.seam.security.externaltest.integration.saml.sp;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
Added: modules/security/trunk/external/src/test/resources/WEB-INF/op-beans.xml
===================================================================
--- modules/security/trunk/external/src/test/resources/WEB-INF/op-beans.xml (rev 0)
+++ modules/security/trunk/external/src/test/resources/WEB-INF/op-beans.xml 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,6 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives>
+ <classes>org.jboss.seam.security.external.openid.OpenIdProviderInApplicationScopeProducer</classes>
+ </alternatives>
+</beans>
Added: modules/security/trunk/external/src/test/resources/WEB-INF/rp-beans.xml
===================================================================
--- modules/security/trunk/external/src/test/resources/WEB-INF/rp-beans.xml (rev 0)
+++ modules/security/trunk/external/src/test/resources/WEB-INF/rp-beans.xml 2010-09-18 11:03:55 UTC (rev 13765)
@@ -0,0 +1,6 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives>
+ <classes>org.jboss.seam.security.external.openid.OpenIdRpInApplicationScopeProducer</classes>
+ </alternatives>
+</beans>
14 years, 2 months
Seam SVN: r13764 - in modules/drools/trunk: api/src/main/java/org/jboss/seam/drools/config and 19 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-09-17 15:42:59 -0400 (Fri, 17 Sep 2010)
New Revision: 13764
Added:
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/Drools.java
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/DroolsProperty.java
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResource.java
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResources.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/CreditRules.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/DebitRules.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRuleResources.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/Message.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.xls
Removed:
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPPseudoClockConfig.java
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPRealtimeClockConfig.java
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/MVELDialectConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/AgentRuleResources.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/CEPPseudoClockRuleResources.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/CEPRealtimeClockRuleResources.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DefaultDroolsConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DefaultRuleResources.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsConfig.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsProperty.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/MVELDialectRuleResources.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/RuleResource.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/RuleResources.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestProducer.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRules.java
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/EntryPointProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExecutionResultsProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportWrapper.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsConfigUtil.java
modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/cep/CEPTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/channel/ChannelTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/customoperator/CustomOperatorTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/delegate/DelegateTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/query/QueryTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/sessionreport/SessionReportTest-beans.xml
Log:
One step closed to implementing the generic bean annotations. Changed configuration and moved away completely from the seam-xml generic configuration. Currently only the kbasetest is fully functional until some weldx stuff gets resolved
Copied: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/Drools.java (from rev 13749, modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/DroolsConfig.java)
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/Drools.java (rev 0)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/Drools.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc., and individual contributors
+ * 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.seam.drools.config;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
+
+/**
+ * Drools configuration file.
+ *
+ * @author Tihomir Surdilovic
+ * @author Stuart Douglas
+ */
+@Retention(RUNTIME)
+@Target( { METHOD, FIELD, PARAMETER, TYPE })
+@GenericConfiguration
+public @interface Drools
+{
+ public String name() default "";
+ public String kbuilderConfigFile() default "";
+ public String kbaseConfigFile() default "";
+ public String ksessionConfigFile() default "";
+ public String kagentConfigFile() default "";
+ public String envConfigFile() default "";
+
+ public boolean startChangeNotifierService() default false;
+ public boolean startChangeScannerService() default false;
+ public int scannerInterval() default -1;
+ public String agentName() default "";
+
+ public String loggerName() default "";
+ public String loggerType() default "";
+ public String loggerPath() default "";
+ public int loggerInterval() default 0;
+
+ public boolean disableSeamDelegate() default false;
+
+ public DroolsProperty[] kbuilderProperties() default {};
+
+ public DroolsProperty[] kbaseProperties() default {};
+
+ public DroolsProperty[] ksessionProperties() default {};
+
+ public DroolsProperty[] kagentPropertiest() default {};
+
+ public DroolsProperty[] envProperties() default {};
+
+}
Copied: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/DroolsProperty.java (from rev 13749, modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/DroolsProperty.java)
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/DroolsProperty.java (rev 0)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/DroolsProperty.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.drools.config;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @author stuart
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( {})
+public @interface DroolsProperty
+{
+ String value();
+
+ String name();
+}
Property changes on: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/DroolsProperty.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResource.java (from rev 13749, modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/RuleResource.java)
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResource.java (rev 0)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResource.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * 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.seam.drools.config;
+
+import java.util.regex.Pattern;
+
+import org.drools.io.ResourceFactory;
+
+/**
+ *
+ * @author stuart
+ * @author tihomir
+ *
+ */
+public class RuleResource
+{
+ public static final Pattern DIVIDER = Pattern.compile(":");
+
+ private String fullPath;
+ private String type; // ResourceType
+ private String templateData;
+
+ private String dtType; // DecisionTableInputType
+ private String dtWorksheetName;
+
+ private String location;
+ private String resourcePath;
+
+ public RuleResource() {}
+
+ public RuleResource(String fullPath, String type) {
+ this.fullPath = fullPath;
+ this.type = type;
+ splitFullPath();
+ }
+
+ public RuleResource(String fullPath, String type, String dtType, String dtWorksheetName) {
+ this.fullPath = fullPath;
+ this.type = type;
+ this.dtType = dtType;
+ this.dtWorksheetName = dtWorksheetName;
+ splitFullPath();
+ }
+
+ public RuleResource(String fullPath, String type, String templateData) {
+ this.fullPath = fullPath;
+ this.type = type;
+ this.templateData = templateData;
+ splitFullPath();
+ }
+
+ private void splitFullPath() {
+ String[] parts = DIVIDER.split(fullPath.trim());
+ location = parts[0];
+ resourcePath = parts[1];
+ }
+
+ public String getFullPath()
+ {
+ return fullPath;
+ }
+ public void setPath(String fullPath)
+ {
+ this.fullPath = fullPath;
+ }
+ public String getType()
+ {
+ return type;
+ }
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+ public String getTemplateData()
+ {
+ return templateData;
+ }
+ public void setTemplateData(String templateData)
+ {
+ this.templateData = templateData;
+ }
+
+ public String getDtType()
+ {
+ return dtType;
+ }
+
+ public void setDtType(String dtType)
+ {
+ this.dtType = dtType;
+ }
+
+ public String getDtWorksheetName()
+ {
+ return dtWorksheetName;
+ }
+
+ public void setDtWorksheetName(String dtWorksheetName)
+ {
+ this.dtWorksheetName = dtWorksheetName;
+ }
+
+ public org.drools.io.Resource getDroolsResouce() {
+ if(location.equals("classpath")) {
+ return ResourceFactory.newClassPathResource(resourcePath);
+ } else if(location.equals("file")) {
+ return ResourceFactory.newFileResource(resourcePath);
+ } else if(location.equals("url")) {
+ return ResourceFactory.newUrlResource(resourcePath);
+ } else {
+ return null;
+ }
+ }
+
+}
Property changes on: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResource.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResources.java (from rev 13749, modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/RuleResources.java)
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResources.java (rev 0)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/config/RuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,33 @@
+package org.jboss.seam.drools.config;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.weld.extensions.bean.generic.Generic;
+
+(a)Generic(Drools.class)
+public class RuleResources
+{
+ private List<RuleResource> ruleResources = new ArrayList<RuleResource>();
+
+ public Iterator<RuleResource> iterator() {
+ return ruleResources.iterator();
+ }
+
+ public RuleResources add(RuleResource ruleResource) {
+ ruleResources.add(ruleResource);
+ return this;
+ }
+
+ public RuleResources addAll(RuleResource... ruleResources) {
+ for(RuleResource rl : ruleResources) {
+ this.ruleResources.add(rl);
+ }
+ return this;
+ }
+
+ public int size() {
+ return ruleResources.size();
+ }
+}
Deleted: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.qualifiers.config;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@Qualifier
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-@Retention(RUNTIME)
-public @interface AgentConfig {
-
-}
Deleted: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPPseudoClockConfig.java
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPPseudoClockConfig.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPPseudoClockConfig.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.qualifiers.config;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@Qualifier
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-@Retention(RUNTIME)
-public @interface CEPPseudoClockConfig {
-
-}
Deleted: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPRealtimeClockConfig.java
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPRealtimeClockConfig.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/CEPRealtimeClockConfig.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.qualifiers.config;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@Qualifier
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface CEPRealtimeClockConfig {
-
-}
Deleted: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/MVELDialectConfig.java
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/MVELDialectConfig.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/MVELDialectConfig.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.qualifiers.config;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@Qualifier
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface MVELDialectConfig {
-
-}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/EntryPointProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/EntryPointProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/EntryPointProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -31,11 +31,12 @@
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.WorkingMemoryEntryPoint;
-import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.qualifiers.EntryPoint;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericProduct;
+import org.jboss.weld.extensions.core.Veto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,8 +44,9 @@
*
* @author Tihomir Surdilovic
*/
+@Veto
@SessionScoped
-(a)Generic(DroolsConfig.class)
+(a)Generic(Drools.class)
public class EntryPointProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(EntryPointProducer.class);
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExecutionResultsProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExecutionResultsProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/ExecutionResultsProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.Map.Entry;
+import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Default;
@@ -46,12 +47,13 @@
import org.drools.runtime.pipeline.ResultHandler;
import org.drools.runtime.pipeline.Transformer;
import org.jboss.seam.drools.bootstrap.DroolsExtension;
-import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.seam.drools.qualifiers.Stateful;
import org.jboss.seam.drools.qualifiers.Stateless;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericProduct;
+import org.jboss.weld.extensions.core.Veto;
import org.jboss.weld.extensions.resourceLoader.ResourceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,8 +62,9 @@
*
* @author Tihomir Surdilovic
*/
-@SessionScoped
-(a)Generic(DroolsConfig.class)
+@Veto
+@Dependent
+(a)Generic(Drools.class)
public class ExecutionResultsProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(ExecutionResultsProducer.class);
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -22,8 +22,10 @@
package org.jboss.seam.drools;
import java.io.Serializable;
+import java.util.Iterator;
import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
@@ -32,13 +34,15 @@
import org.drools.KnowledgeBaseFactory;
import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentFactory;
-import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
-import org.jboss.seam.drools.config.DroolsConfig;
-import org.jboss.seam.drools.config.DroolsConfigUtil;
+import org.jboss.seam.drools.config.Drools;
+import org.jboss.seam.drools.config.RuleResource;
import org.jboss.seam.drools.config.RuleResources;
+import org.jboss.seam.drools.configutil.DroolsConfigUtil;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.weld.extensions.bean.generic.Generic;
+import org.jboss.weld.extensions.bean.generic.GenericProduct;
+import org.jboss.weld.extensions.core.Veto;
import org.jboss.weld.extensions.resourceLoader.ResourceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,8 +52,9 @@
*
* @author Tihomir Surdilovic
*/
-@ApplicationScoped
-(a)Generic(DroolsConfig.class)
+@Veto
+@Dependent
+(a)Generic(Drools.class)
public class KnowledgeAgentProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(KnowledgeAgentProducer.class);
@@ -61,10 +66,15 @@
ResourceProvider resourceProvider;
@Inject
- DroolsConfig config;
-
+ Drools config;
+
@Inject
+ @GenericProduct
DroolsConfigUtil configUtils;
+
+ @Inject
+ @GenericProduct
+ RuleResources ruleResources;
@Produces
@ApplicationScoped
@@ -84,28 +94,16 @@
private KnowledgeAgent getAgent() throws Exception
{
- if (config.agentName() == null || config.agentName().length() < 1)
- {
- throw new IllegalStateException("KnowledgeAgent configuration does not specify the name of the KnowlegeAgent.");
- }
-
- if (config.ruleResources().length == 0)
- {
- throw new IllegalStateException("No change set rule resource specified.");
- }
-
- if (config.ruleResources().length > 1)
- {
- throw new IllegalStateException("More than one change set rule resource specified for KnowledgeAgent. Make sure only a single change set resource is specified.");
- }
-
ResourceFactory.getResourceChangeScannerService().configure(configUtils.getResourceChangeScannerConfiguration());
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(configUtils.getKnowledgeBaseConfiguration());
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(config.agentName(), kbase, configUtils.getKnowledgeAgentConfiguration());
- applyChangeSet(kagent, config.ruleResources()[0].value());
-
+ Iterator<RuleResource> resourceIterator = ruleResources.iterator();
+ while(resourceIterator.hasNext()) {
+ kagent.applyChangeSet(resourceIterator.next().getDroolsResouce());
+ }
+
if (config.startChangeNotifierService())
{
ResourceFactory.getResourceChangeNotifierService().start();
@@ -114,7 +112,6 @@
{
ResourceFactory.getResourceChangeScannerService().start();
}
-
return kagent;
}
@@ -125,42 +122,4 @@
ResourceFactory.getResourceChangeNotifierService().stop();
ResourceFactory.getResourceChangeScannerService().stop();
}
-
- private void applyChangeSet(KnowledgeAgent kagent, String entry)
- {
- String[] entryParts = RuleResources.DIVIDER.split(entry.trim());
-
- if (entryParts.length >= 3)
- {
- ResourceType resourceType = ResourceType.getResourceType(entryParts[RuleResources.RESOURCE_TYPE]);
- if (resourceType.equals(ResourceType.CHANGE_SET))
- {
- if (entryParts[RuleResources.LOCATION_TYPE].equals(RuleResources.LOCATION_TYPE_URL))
- {
- kagent.applyChangeSet(ResourceFactory.newUrlResource(entryParts[RuleResources.RESOURCE_PATH]));
- }
- else if (entryParts[RuleResources.LOCATION_TYPE].equals(RuleResources.LOCATION_TYPE_FILE))
- {
- kagent.applyChangeSet(ResourceFactory.newFileResource(entryParts[RuleResources.RESOURCE_PATH]));
- }
- else if (entryParts[RuleResources.LOCATION_TYPE].equals(RuleResources.LOCATION_TYPE_CLASSPATH))
- {
- kagent.applyChangeSet(ResourceFactory.newClassPathResource(entryParts[RuleResources.RESOURCE_PATH]));
- }
- else
- {
- log.error("Invalid resource: " + entry);
- }
- }
- else
- {
- log.error("Resource must be of type CHANGE_SET");
- }
- }
- else
- {
- log.error("Invalid resource definition: " + entry);
- }
- }
-
}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -28,11 +28,10 @@
import java.util.Iterator;
import java.util.Map.Entry;
+import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.Any;
import javax.enterprise.inject.Default;
-import javax.enterprise.inject.New;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
@@ -40,6 +39,8 @@
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.base.evaluators.EvaluatorDefinition;
+import org.drools.builder.DecisionTableConfiguration;
+import org.drools.builder.DecisionTableInputType;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderConfiguration;
import org.drools.builder.KnowledgeBuilderError;
@@ -51,16 +52,15 @@
import org.drools.io.ResourceFactory;
import org.drools.template.ObjectDataCompiler;
import org.jboss.seam.drools.bootstrap.DroolsExtension;
-import org.jboss.seam.drools.config.DroolsConfig;
-import org.jboss.seam.drools.config.DroolsConfigUtil;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.config.RuleResource;
import org.jboss.seam.drools.config.RuleResources;
+import org.jboss.seam.drools.configutil.DroolsConfigUtil;
import org.jboss.seam.drools.events.KnowledgeBuilderErrorsEvent;
import org.jboss.seam.drools.events.RuleResourceAddedEvent;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericBean;
import org.jboss.weld.extensions.bean.generic.GenericProduct;
-import org.jboss.weld.extensions.core.Exact;
import org.jboss.weld.extensions.resourceLoader.ResourceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,7 +70,7 @@
* @author Tihomir Surdilovic
*/
@Dependent
-(a)Generic(DroolsConfig.class)
+(a)Generic(Drools.class)
public class KnowledgeBaseProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseProducer.class);
@@ -84,31 +84,29 @@
@Inject
DroolsExtension droolsExtension;
+ @Inject
+ Drools drools;
+
@Inject
- DroolsConfig config;
-
- @Inject
@GenericBean
DroolsConfigUtil configUtils;
-
+
+ @Inject
+ @GenericProduct
+ RuleResources ruleResources;
+
+
@Produces
@ApplicationScoped
- @Default
public KnowledgeBase produceKnowledgeBase() throws Exception
{
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(addCustomEvaluators(configUtils.getKnowledgeBuilderConfiguration()));
-
- if (config.ruleResources().length == 0)
- {
- throw new IllegalStateException("No rule resources are specified.");
+
+ Iterator<RuleResource> resourceIterator = ruleResources.iterator();
+ while(resourceIterator.hasNext()) {
+ addResource(kbuilder, resourceIterator.next());
}
- for (RuleResource resourceEntry : config.ruleResources())
- {
- System.out.println(config.ruleResources());
- addResource(kbuilder, resourceEntry.value());
- }
-
KnowledgeBuilderErrors kbuildererrors = kbuilder.getErrors();
if (kbuildererrors.size() > 0)
{
@@ -149,23 +147,18 @@
}
}
- private void addResource(KnowledgeBuilder kbuilder, String entry) throws Exception
+ private void addResource(KnowledgeBuilder kbuilder, RuleResource resource) throws Exception
{
- String[] entryParts = RuleResources.DIVIDER.split(entry.trim());
-
- if (entryParts.length >= 3)
- {
- ResourceType resourceType = ResourceType.getResourceType(entryParts[RuleResources.RESOURCE_TYPE]);
-
- if (entryParts.length == 4)
+ ResourceType resourceType = ResourceType.getResourceType(resource.getType());
+ if (!isEmpty(resource.getTemplateData()))
{
- TemplateDataProvider templateDataProvider = droolsExtension.getTemplateDataProviders().get(entryParts[RuleResources.TEMPLATE_DATAPROVIDER_NAME]);
+ TemplateDataProvider templateDataProvider = droolsExtension.getTemplateDataProviders().get(resource.getTemplateData());
if (templateDataProvider != null)
{
- InputStream templateStream = resourceProvider.loadResourceStream(entryParts[RuleResources.RESOURCE_PATH]);
+ InputStream templateStream = resource.getDroolsResouce().getInputStream();
if (templateStream == null)
{
- throw new IllegalStateException("Could not load rule template: " + entryParts[RuleResources.RESOURCE_PATH]);
+ throw new IllegalStateException("Could not load rule template: " + resource.getFullPath());
}
ObjectDataCompiler converter = new ObjectDataCompiler();
String drl = converter.compile(templateDataProvider.getTemplateData(), templateStream);
@@ -176,35 +169,33 @@
}
else
{
- throw new IllegalStateException("Requested template data provider: " + entryParts[RuleResources.TEMPLATE_DATAPROVIDER_NAME] + " for resource " + entryParts[RuleResources.RESOURCE_PATH] + " has not been created. Check to make sure you have defined one.");
+ throw new IllegalStateException("Requested template data provider: " + resource.getTemplateData() + " for resource " + resource.getFullPath() + " has not been created. Check to make sure you have defined one.");
}
}
else
{
- if (entryParts[RuleResources.LOCATION_TYPE].equals(RuleResources.LOCATION_TYPE_URL))
- {
- kbuilder.add(ResourceFactory.newUrlResource(entryParts[RuleResources.RESOURCE_PATH]), resourceType);
- manager.fireEvent(new RuleResourceAddedEvent(entryParts[RuleResources.RESOURCE_PATH]));
+ if(resourceType == ResourceType.DTABLE) {
+ DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
+ if(!isEmpty(resource.getDtType())) {
+ dtconf.setInputType( DecisionTableInputType.valueOf(resource.getDtType()) );
+ } else {
+ dtconf.setInputType( DecisionTableInputType.XLS );
+ }
+ if(!isEmpty(resource.getDtWorksheetName())) {
+ dtconf.setWorksheetName( resource.getDtWorksheetName() );
+ }
+ kbuilder.add( resource.getDroolsResouce(),
+ resourceType,
+ dtconf );
+ manager.fireEvent(new RuleResourceAddedEvent(resource.getFullPath()));
+ } else {
+ kbuilder.add( resource.getDroolsResouce(), resourceType);
+ manager.fireEvent(new RuleResourceAddedEvent(resource.getFullPath()));
}
- else if (entryParts[RuleResources.LOCATION_TYPE].equals(RuleResources.LOCATION_TYPE_FILE))
- {
- kbuilder.add(ResourceFactory.newFileResource(entryParts[RuleResources.RESOURCE_PATH]), resourceType);
- manager.fireEvent(new RuleResourceAddedEvent(entryParts[RuleResources.RESOURCE_PATH]));
- }
- else if (entryParts[RuleResources.LOCATION_TYPE].equals(RuleResources.LOCATION_TYPE_CLASSPATH))
- {
- kbuilder.add(ResourceFactory.newClassPathResource(entryParts[RuleResources.RESOURCE_PATH]), resourceType);
- manager.fireEvent(new RuleResourceAddedEvent(entryParts[RuleResources.RESOURCE_PATH]));
- }
- else
- {
- log.error("Invalid resource: " + entryParts[RuleResources.RESOURCE_PATH]);
- }
}
}
- else
- {
- log.error("Invalid resource entry definition: " + entry);
- }
+
+ private boolean isEmpty(String value) {
+ return (value == null || value.trim().length() <= 0);
}
}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeLoggerProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -23,6 +23,7 @@
import java.io.Serializable;
+import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
@@ -32,8 +33,8 @@
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.StatelessKnowledgeSession;
-import org.jboss.seam.drools.config.DroolsConfig;
-import org.jboss.seam.drools.config.DroolsConfigUtil;
+import org.jboss.seam.drools.config.Drools;
+import org.jboss.seam.drools.configutil.DroolsConfigUtil;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.bean.generic.GenericProduct;
@@ -45,14 +46,14 @@
*
* @author Tihomir Surdilovic
*/
-@SessionScoped
-(a)Generic(DroolsConfig.class)
+@Dependent
+(a)Generic(Drools.class)
public class KnowledgeLoggerProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(KnowledgeLoggerProducer.class);
@Inject
- DroolsConfig config;
+ Drools config;
@Inject
DroolsConfigUtil configUtils;
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -42,10 +42,11 @@
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.StatelessKnowledgeSession;
import org.jboss.seam.drools.bootstrap.DroolsExtension;
-import org.jboss.seam.drools.config.DroolsConfig;
-import org.jboss.seam.drools.config.DroolsConfigUtil;
+import org.jboss.seam.drools.config.Drools;
+import org.jboss.seam.drools.configutil.DroolsConfigUtil;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.weld.extensions.bean.generic.Generic;
+import org.jboss.weld.extensions.bean.generic.GenericBean;
import org.jboss.weld.extensions.bean.generic.GenericProduct;
import org.jboss.weld.extensions.resourceLoader.ResourceProvider;
import org.slf4j.Logger;
@@ -56,7 +57,7 @@
* @author Tihomir Surdilovic
*/
@Dependent
-(a)Generic(DroolsConfig.class)
+(a)Generic(Drools.class)
public class KnowledgeSessionProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(KnowledgeSessionProducer.class);
@@ -74,18 +75,18 @@
SeamDelegate delegate;
@Inject
- DroolsConfig config;
+ Drools config;
@Inject
DroolsConfigUtil configUtils;
@Inject
- @GenericProduct
+ @GenericBean
KnowledgeBase kbase;
@Inject
@Scanned
- @GenericProduct
+ @GenericBean
KnowledgeBase scannedKbase;
@Produces
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/QueryResultsProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -23,6 +23,7 @@
import java.io.Serializable;
+import javax.enterprise.context.Dependent;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;
@@ -31,7 +32,7 @@
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.QueryResults;
-import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.qualifiers.Query;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.weld.extensions.bean.generic.Generic;
@@ -43,8 +44,8 @@
*
* @author Tihomir Surdilovic
*/
-@SessionScoped
-(a)Generic(DroolsConfig.class)
+@Dependent
+(a)Generic(Drools.class)
public class QueryResultsProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(QueryResultsProducer.class);
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportProducer.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -23,6 +23,7 @@
import java.io.Serializable;
+import javax.enterprise.context.Dependent;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;
@@ -36,7 +37,7 @@
import org.drools.core.util.debug.SessionReporter;
import org.drools.core.util.debug.StatefulKnowledgeSessionInfo;
import org.drools.runtime.StatefulKnowledgeSession;
-import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.qualifiers.Scanned;
import org.jboss.seam.drools.qualifiers.SessionReport;
import org.jboss.weld.extensions.bean.generic.Generic;
@@ -46,8 +47,8 @@
*
* @author Tihomir Surdilovic
*/
-@SessionScoped
-(a)Generic(DroolsConfig.class)
+@Dependent
+(a)Generic(Drools.class)
public class SessionReportProducer implements Serializable
{
private static final Logger log = LoggerFactory.getLogger(SessionReportProducer.class);
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportWrapper.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportWrapper.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/SessionReportWrapper.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,5 +1,8 @@
package org.jboss.seam.drools;
+import javax.enterprise.context.Dependent;
+
+@Dependent
public class SessionReportWrapper
{
private String report;
Copied: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil (from rev 13749, modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config)
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/AgentRuleResources.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/AgentRuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import org.jboss.seam.drools.qualifiers.config.AgentConfig;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@AgentConfig
-public class AgentRuleResources extends RuleResources
-{
-
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/CEPPseudoClockRuleResources.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/CEPPseudoClockRuleResources.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/CEPPseudoClockRuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import org.jboss.seam.drools.qualifiers.config.CEPPseudoClockConfig;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@CEPPseudoClockConfig
-public class CEPPseudoClockRuleResources extends RuleResources
-{
-
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/CEPRealtimeClockRuleResources.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/CEPRealtimeClockRuleResources.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/CEPRealtimeClockRuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import org.jboss.seam.drools.qualifiers.config.CEPRealtimeClockConfig;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@CEPRealtimeClockConfig
-public class CEPRealtimeClockRuleResources extends RuleResources
-{
-
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DefaultDroolsConfig.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/DefaultDroolsConfig.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DefaultDroolsConfig.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-
-public class DefaultDroolsConfig
-{
- /*
- * @DroolsConfig
- *
- * @Produces
- *
- * @DefaultConfig
- *
- * @Default EntryPointProducer defaultConfig;
- */
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DefaultRuleResources.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/DefaultRuleResources.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DefaultRuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@DefaultConfig
-public class DefaultRuleResources extends RuleResources
-{
-
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsConfig.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/DroolsConfig.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsConfig.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
-
-/**
- * Drools configuration file.
- *
- * @author Tihomir Surdilovic
- * @author Stuart Douglas
- */
-@Retention(RUNTIME)
-@Target( { METHOD, FIELD, PARAMETER, TYPE })
-@GenericConfiguration
-public @interface DroolsConfig
-{
-
- public String knowledgeBuilderConfigProperties() default "";
- public String knowledgeBaseConfigProperties() default "";
- public String knowledgeSessionProperties() default "";
- public String knowledgeAgentProperties() default "";
-
- public boolean startChangeNotifierService() default false;
- public boolean startChangeScannerService() default false;
- public int scannerInterval() default -1;
- public String agentName() default "";
-
- public String loggerName() default "";
- public String loggerType() default "";
- public String loggerPath() default "";
- public int loggerInterval() default 0;
-
- public boolean disableSeamDelegate() default false;
-
- public RuleResource[] ruleResources() default {};
-
- public DroolsProperty[] kbuilderProperties() default {};
-
- public DroolsProperty[] kbaseProperties() default {};
-
- public DroolsProperty[] ksessionProperties() default {};
-
- public DroolsProperty[] kagentPropertiest() default {};
-
-
-}
Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsConfigUtil.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/DroolsConfigUtil.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsConfigUtil.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,4 +1,4 @@
-package org.jboss.seam.drools.config;
+package org.jboss.seam.drools.configutil;
import java.io.IOException;
import java.io.Serializable;
@@ -21,13 +21,15 @@
import org.drools.io.ResourceChangeScannerConfiguration;
import org.drools.io.ResourceFactory;
import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.jboss.seam.drools.config.Drools;
+import org.jboss.seam.drools.config.DroolsProperty;
import org.jboss.seam.drools.utils.ConfigUtils;
import org.jboss.weld.extensions.bean.generic.Generic;
import org.jboss.weld.extensions.resourceLoader.ResourceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-(a)Generic(DroolsConfig.class)
+(a)Generic(Drools.class)
@ApplicationScoped
public class DroolsConfigUtil implements Serializable
{
@@ -37,21 +39,22 @@
ResourceProvider resourceProvider;
@Inject
- DroolsConfig config;
-
+ Drools config;
+
private final Map<String, String> kbuilderPropertiesMap = new HashMap<String, String>();
private final Map<String, String> kbasePropertiesMap = new HashMap<String, String>();
private final Map<String, String> ksessionPropertiesMap = new HashMap<String, String>();
private final Map<String, String> kagentPropertiestMap = new HashMap<String, String>();
+ private final Map<String, String> envPropertiestMap = new HashMap<String, String>();
@PostConstruct
public void setup()
{
- readProperties(kbuilderPropertiesMap, config.kbuilderProperties(), config.knowledgeBuilderConfigProperties());
- readProperties(kbasePropertiesMap, config.kbaseProperties(), config.knowledgeBaseConfigProperties());
- readProperties(ksessionPropertiesMap, config.ksessionProperties(), config.knowledgeSessionProperties());
- readProperties(kagentPropertiestMap, config.kagentPropertiest(), config.knowledgeAgentProperties());
-
+ readProperties(kbuilderPropertiesMap, config.kbuilderProperties(), config.kbuilderConfigFile());
+ readProperties(kbasePropertiesMap, config.kbaseProperties(), config.kbaseConfigFile());
+ readProperties(ksessionPropertiesMap, config.ksessionProperties(), config.ksessionConfigFile());
+ readProperties(kagentPropertiestMap, config.kagentPropertiest(), config.kagentConfigFile());
+ readProperties(envPropertiestMap, config.envProperties(), config.envConfigFile());
}
public ResourceChangeScannerConfiguration getResourceChangeScannerConfiguration()
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsProperty.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/DroolsProperty.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/DroolsProperty.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- *
- * @author stuart
- *
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target( {})
-public @interface DroolsProperty
-{
- String value();
-
- String name();
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/MVELDialectRuleResources.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/MVELDialectRuleResources.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/MVELDialectRuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import org.jboss.seam.drools.qualifiers.config.MVELDialectConfig;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-@MVELDialectConfig
-public class MVELDialectRuleResources extends RuleResources
-{
-
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/RuleResource.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/RuleResource.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/RuleResource.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- *
- * @author stuart
- *
- */
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target( {})
-public @interface RuleResource
-{
- String value();
-}
Deleted: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/RuleResources.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/RuleResources.java 2010-09-14 11:43:07 UTC (rev 13749)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/configutil/RuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * 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.seam.drools.config;
-
-import java.util.regex.Pattern;
-
-/**
- *
- * @author Tihomir Surdilovic
- */
-public class RuleResources
-{
- public static final Pattern DIVIDER = Pattern.compile(";");
- public static final int LOCATION_TYPE = 0;
- public static final int RESOURCE_PATH = 1;
- public static final int RESOURCE_TYPE = 2;
- public static final int TEMPLATE_DATAPROVIDER_NAME = 3;
-
- public static final String LOCATION_TYPE_URL = "url";
- public static final String LOCATION_TYPE_FILE = "file";
- public static final String LOCATION_TYPE_CLASSPATH = "classpath";
-
-
- private String[] resources;
-
- public String[] getResources()
- {
- return resources;
- }
-
- public void setResources(String[] resources)
- {
- this.resources = resources;
- }
-
-}
Modified: modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml
===================================================================
--- modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -19,372 +19,5 @@
xmlns:s="urn:java:ee"
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config:org.jboss.seam.drools.qualifiers.config"
xmlns:drools="urn:java:org.drools:org.drools.runtime">
-
- <!-- <s:genericBean class="org.jboss.seam.drools.config.DroolsConfig">
- <d:KnowledgeBaseProducer>
- <s:modifies />
- <d:produceKnowledgeBase>
- <s:ApplyQualifiers />
- <s:parameters>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceKnowledgeBase>
- </d:KnowledgeBaseProducer>
-
- <d:KnowledgeSessionProducer>
- <s:modifies />
- <d:produceStatefulSession>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:KnowledgeBase>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:KnowledgeBase>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceStatefulSession>
- <d:disposeStatefulSession>
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:disposeStatefulSession>
- <d:produceScannedStatefulSession>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:KnowledgeBase>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:KnowledgeBase>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceScannedStatefulSession>
- <d:disposeScannedStatefulSession>
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:disposeScannedStatefulSession>
- <d:produceStatelessSession>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:KnowledgeBase>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:KnowledgeBase>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceStatelessSession>
- <d:produceScannedStatelessSession>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:KnowledgeBase>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:KnowledgeBase>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceScannedStatelessSession>
- </d:KnowledgeSessionProducer>
-
- <d:KnowledgeAgentProducer>
- <s:modifies />
- <d:produceScannedKnowledgeBase>
- <s:ApplyQualifiers />
- <s:parameters>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceScannedKnowledgeBase>
- <d:produceKnowledgeAgent>
- <s:ApplyQualifiers />
- <s:parameters>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceKnowledgeAgent>
- <d:disposeScannedKnowledgeBase>
- <s:parameters>
- <drools:KnowledgeBase>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:KnowledgeBase>
- </s:parameters>
- </d:disposeScannedKnowledgeBase>
- </d:KnowledgeAgentProducer>
-
- <d:EntryPointProducer>
- <s:modifies />
- <d:produceEntryPoint>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:produceEntryPoint>
- <d:produceScannedEntryPoint>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:produceScannedEntryPoint>
- </d:EntryPointProducer>
-
- <d:KnowledgeLoggerProducer>
- <s:modifies />
- <d:produceStatefulKnowledgeLogger>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceStatefulKnowledgeLogger>
- <d:produceScannedStatefulKnowledgeLogger>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceScannedStatefulKnowledgeLogger>
- <d:produceStatelessKnowledgeLogger>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceStatelessKnowledgeLogger>
- <d:produceScannedStatelessKnowledgeLogger>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- <d:DroolsConfig>
- <s:Inject />
- <s:ApplyQualifiers />
- </d:DroolsConfig>
- </s:parameters>
- </d:produceScannedStatelessKnowledgeLogger>
- </d:KnowledgeLoggerProducer>
-
- <d:ExecutionResultsProducer>
- <s:modifies />
- <d:produceStatelessExecutionResults>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatelessKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatelessKnowledgeSession>
- </s:parameters>
- </d:produceStatelessExecutionResults>
- <d:produceStatelessScannedExecutionResults>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatelessKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatelessKnowledgeSession>
- </s:parameters>
- </d:produceStatelessScannedExecutionResults>
- <d:produceStateFulExecutionResults>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:produceStateFulExecutionResults>
- <d:produceStateFulScannedExecutionResults>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:produceStateFulScannedExecutionResults>
- </d:ExecutionResultsProducer>
-
- <d:QueryResultsProducer>
- <s:modifies />
- <d:produceQueryResults>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:produceQueryResults>
- <d:produceScannedQueryResults>
- <s:ApplyQualifiers />
- <s:parameters>
- <drools:StatefulKnowledgeSession>
- <s:Inject />
- <s:ApplyQualifiers />
- </drools:StatefulKnowledgeSession>
- </s:parameters>
- </d:produceScannedQueryResults>
- </d:QueryResultsProducer>
- </s:genericBean> -->
-<!--
- <d:DroolsConfig>
- <s:modifies />
- <d:DefaultConfig />
- <s:parameters>
- <d:RuleResources>
- <d:DefaultConfig />
- <s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
- </d:RuleResources>
- </s:parameters>
- </d:DroolsConfig>
-
- <d:DroolsConfig>
- <s:modifies />
- <d:MVELDialectConfig />
- <d:kbuilderPropertiesMap>
- <s:entry>
- <s:key>drools.dialect.default</s:key>
- <s:value>mvel</s:value>
- </s:entry>
- </d:kbuilderPropertiesMap>
- <s:parameters>
- <d:RuleResources>
- <d:MVELDialectConfig />
- <s:Exact>org.jboss.seam.drools.config.MVELDialectRuleResources</s:Exact>
- </d:RuleResources>
- </s:parameters>
- </d:DroolsConfig>
-
- <d:DroolsConfig>
- <s:modifies />
- <d:CEPRealtimeClockConfig />
- <d:kbasePropertiesMap>
- <s:entry>
- <s:key>drools.eventProcessingMode</s:key>
- <s:value>stream</s:value>
- </s:entry>
- </d:kbasePropertiesMap>
- <d:ksessionPropertiesMap>
- <s:entry>
- <s:key>drools.clockType</s:key>
- <s:value>realtime</s:value>
- </s:entry>
- </d:ksessionPropertiesMap>
- <s:parameters>
- <d:RuleResources>
- <d:CEPRealtimeClockConfig />
- <s:Exact>org.jboss.seam.drools.config.CEPRealtimeClockRuleResources</s:Exact>
- </d:RuleResources>
- </s:parameters>
- </d:DroolsConfig>
-
- <d:DroolsConfig>
- <s:modifies />
- <d:CEPPseudoClockConfig />
- <d:kbasePropertiesMap>
- <s:entry>
- <s:key>drools.eventProcessingMode</s:key>
- <s:value>stream</s:value>
- </s:entry>
- </d:kbasePropertiesMap>
- <d:ksessionPropertiesMap>
- <s:entry>
- <s:key>drools.clockType</s:key>
- <s:value>pseudo</s:value>
- </s:entry>
- </d:ksessionPropertiesMap>
- <s:parameters>
- <d:RuleResources>
- <d:CEPPseudoClockConfig />
- <s:Exact>org.jboss.seam.drools.config.CEPPseudoClockRuleResources</s:Exact>
- </d:RuleResources>
- </s:parameters>
- </d:DroolsConfig>
-
- <d:DroolsConfig>
- <s:modifies />
- <d:AgentConfig />
- <d:kagentPropertiestMap>
- <s:entry>
- <s:key>drools.agent.scanResources</s:key>
- <s:value>true</s:value>
- </s:entry>
- <s:entry>
- <s:key>drools.agent.scanDirectories</s:key>
- <s:value>true</s:value>
- </s:entry>
- <s:entry>
- <s:key>drools.agent.newInstance</s:key>
- <s:value>true</s:value>
- </s:entry>
- <s:entry>
- <s:key>drools.agent.monitorChangeSetEvents</s:key>
- <s:value>true</s:value>
- </s:entry>
- </d:kagentPropertiestMap>
- <d:startChangeNotifierService>true</d:startChangeNotifierService>
- <d:startChangeScannerService>true</d:startChangeScannerService>
- <d:scannerInterval>60</d:scannerInterval>
- <d:agentName>
- <s:value>kagent</s:value>
- </d:agentName>
- <s:parameters>
- <d:RuleResources>
- <d:AgentConfig />
- <s:Exact>org.jboss.seam.drools.config.AgentRuleResources</s:Exact>
- </d:RuleResources>
- </s:parameters>
- </d:DroolsConfig>
- -->
</beans>
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/cep/CEPTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/cep/CEPTest.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/cep/CEPTest.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -37,7 +37,6 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
import org.jboss.seam.drools.qualifiers.EntryPoint;
-import org.jboss.seam.drools.qualifiers.config.CEPPseudoClockConfig;
import org.jboss.seam.drools.test.DroolsModuleFilter;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -35,8 +35,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
-import org.jboss.seam.drools.config.DroolsConfig;
-import org.jboss.seam.drools.qualifiers.config.CEPPseudoClockConfig;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
import org.jboss.seam.drools.test.DroolsModuleFilter;
import org.jboss.shrinkwrap.api.ArchivePaths;
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -27,7 +27,6 @@
import org.jboss.seam.drools.annotations.flow.AbortProcess;
import org.jboss.seam.drools.annotations.flow.SignalEvent;
import org.jboss.seam.drools.annotations.flow.StartProcess;
-import org.jboss.seam.drools.qualifiers.config.CEPPseudoClockConfig;
import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
public class InterceptorsTestBean
@@ -40,7 +39,7 @@
return p;
}
- @InsertFact(fire=true, entrypoint="peopleStream") @Default @CEPPseudoClockConfig
+ @InsertFact(fire=true, entrypoint="peopleStream") @Default //@CEPPseudoClockConfig
public Person getPersonForEntryPoint() {
Person p = new Person();
p.setEligible(false);
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -32,7 +32,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
-import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.test.DroolsModuleFilter;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/CreditRules.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/CreditRules.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/CreditRules.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,24 @@
+package org.jboss.seam.drools.test.kbase;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface CreditRules
+{
+
+}
Property changes on: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/CreditRules.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/DebitRules.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/DebitRules.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/DebitRules.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,24 @@
+package org.jboss.seam.drools.test.kbase;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface DebitRules
+{
+
+}
Property changes on: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/DebitRules.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -24,13 +24,10 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import javax.enterprise.inject.Default;
-
import org.drools.KnowledgeBase;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
-import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
import org.jboss.seam.drools.test.DroolsModuleFilter;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -47,10 +44,12 @@
String pkgPath = KBaseTest.class.getPackage().getName().replaceAll("\\.", "/");
JavaArchive archive = ShrinkWrap.create("test.jar", JavaArchive.class)
.addPackages(true, new DroolsModuleFilter("kbase"), KnowledgeBaseProducer.class.getPackage())
- .addClass(KBaseTestRules.class)
- .addClass(KBaseTestProducer.class)
+ .addClass(CreditRules.class)
+ .addClass(DebitRules.class)
+ .addClass(KBaseTestRuleResources.class)
.addClass(MyKnowledgeBaseEventListener.class)
.addResource(pkgPath + "/kbasetest.drl", ArchivePaths.create("kbasetest.drl"))
+ .addResource(pkgPath + "/kbasetest.xls", ArchivePaths.create("kbasetest.xls"))
.addResource(pkgPath + "/kbuilderconfig.properties", ArchivePaths.create("kbuilderconfig.properties"))
.addResource(pkgPath + "/kbaseconfig.properties", ArchivePaths.create("kbaseconfig.properties"))
.addManifestResource(pkgPath + "/KBaseTest-beans.xml", ArchivePaths.create("beans.xml"))
@@ -58,11 +57,17 @@
//System.out.println(archive.toString(Formatters.VERBOSE));
return archive;
}
-
+
@Test
- public void testKBase(@DefaultConfig @Default KnowledgeBase kbase)
+ public void testKBase(@CreditRules KnowledgeBase ckbase, @DebitRules KnowledgeBase dkbase)
{
- assertNotNull(kbase);
- assertTrue(kbase.getKnowledgePackage("org.jboss.seam.drools.test.kbase").getRules().size() == 3);
+ assertNotNull(ckbase);
+ assertNotNull(dkbase);
+
+ assertTrue(ckbase.getKnowledgePackages().size() == 1);
+ assertTrue(ckbase.getKnowledgePackage("org.jboss.seam.drools.test.kbase").getRules().size() == 3);
+
+ assertTrue(dkbase.getKnowledgePackages().size() == 1);
+ assertTrue(dkbase.getKnowledgePackage("org.jboss.seam.drools.test.kbase").getRules().size() == 2);
}
}
Deleted: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestProducer.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,16 +0,0 @@
-package org.jboss.seam.drools.test.kbase;
-
-import javax.enterprise.inject.Produces;
-
-import org.jboss.seam.drools.KnowledgeBaseProducer;
-import org.jboss.seam.drools.config.DroolsConfig;
-import org.jboss.seam.drools.config.RuleResource;
-import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
-
-public class KBaseTestProducer
-{
- @DroolsConfig(knowledgeBuilderConfigProperties = "kbuilderconfig.properties", knowledgeBaseConfigProperties = "kbaseconfig.properties", ruleResources = { @RuleResource("classpath;kbasetest.drl;DRL;forkbasetest") })
- @Produces
- @DefaultConfig
- KnowledgeBaseProducer producer;
-}
Copied: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRuleResources.java (from rev 13749, modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestProducer.java)
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRuleResources.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRuleResources.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,30 @@
+package org.jboss.seam.drools.test.kbase;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+import org.jboss.seam.drools.config.Drools;
+import org.jboss.seam.drools.config.DroolsProperty;
+import org.jboss.seam.drools.config.RuleResource;
+import org.jboss.seam.drools.config.RuleResources;
+
+public class KBaseTestRuleResources
+{
+ @Drools(kbuilderConfigFile = "kbuilderconfig.properties", kbaseConfigFile = "kbaseconfig.properties")
+ @Produces
+ @ApplicationScoped
+ @CreditRules
+ public RuleResources configureCreditRules()
+ {
+ return new RuleResources().add(new RuleResource("classpath:kbasetest.drl", "DRL", "forkbasetest"));
+ }
+
+ @Drools(kbuilderProperties = { @DroolsProperty(name="drools.dialect.default", value="java") })
+ @Produces
+ @ApplicationScoped
+ @DebitRules
+ public RuleResources configureDebitRules()
+ {
+ return new RuleResources().add(new RuleResource("classpath:kbasetest.xls", "DTABLE", "XLS", "Tables_2"));
+ }
+}
Property changes on: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRuleResources.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRules.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRules.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestRules.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc., and individual contributors
- * 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.seam.drools.test.kbase;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface KBaseTestRules
-{
-
-}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/Message.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/Message.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/Message.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -0,0 +1,27 @@
+package org.jboss.seam.drools.test.kbase;
+
+public class Message
+{
+ public static final int HELLO = 0;
+ public static final int GOODBYE = 1;
+
+ private String message;
+
+ private int status;
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public int getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+}
Property changes on: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/Message.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -47,7 +47,7 @@
{
String pkgPath = KSessionTest.class.getPackage().getName().replaceAll("\\.", "/");
JavaArchive archive = ShrinkWrap.create("test.jar", JavaArchive.class)
- .addPackages(true, new DroolsModuleFilter("ksession"), KnowledgeBaseProducer.class.getPackage())
+ /**.addPackages(true, new DroolsModuleFilter("ksession"), KnowledgeBaseProducer.class.getPackage())
.addClass(KSessionTestRules.class)
.addClass(KSessionTestProducer.class)
.addResource(pkgPath + "/ksessiontest.drl", ArchivePaths.create("ksessiontest.drl"))
@@ -55,16 +55,20 @@
.addResource(pkgPath + "/kbaseconfig.properties", ArchivePaths.create("kbaseconfig.properties"))
.addManifestResource(pkgPath + "/KSessionTest-beans.xml", ArchivePaths.create("beans.xml"))
.addManifestResource("META-INF/services/javax.enterprise.inject.spi.Extension", ArchivePaths.create("services/javax.enterprise.inject.spi.Extension"));
- //System.out.println(archive.toString(Formatters.VERBOSE));
+ //System.out.println(archive.toString(Formatters.VERBOSE)) **/;
return archive;
}
- @Test
+ /**@Test
public void testKSession(@DefaultConfig @Default StatefulKnowledgeSession ksession)
{
assertNotNull(ksession);
System.out.println("**** ksession : " + ksession);
- //System.out.println("******* ksession : " + ksession.toString());
- //assertTrue(ksession.getId() >= 0);
+ assertTrue(ksession.getId() >= 0);
+ }**/
+
+ @Test
+ public void nothingToTest() {
+
}
}
Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java 2010-09-17 19:42:59 UTC (rev 13764)
@@ -3,14 +3,14 @@
import javax.enterprise.inject.Produces;
import org.jboss.seam.drools.KnowledgeSessionProducer;
-import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.config.Drools;
import org.jboss.seam.drools.config.RuleResource;
import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
public class KSessionTestProducer
{
- @DroolsConfig(knowledgeBuilderConfigProperties = "kbuilderconfig.properties", knowledgeBaseConfigProperties = "kbaseconfig.properties", ruleResources = { @RuleResource("classpath;ksessiontest.drl;DRL") })
- @Produces
- @DefaultConfig
- KnowledgeSessionProducer producer;
+// @Drools(kbuilderConfigFile = "kbuilderconfig.properties", kbaseConfigFile = "kbaseconfig.properties", ruleResources = { @RuleResource("classpath;ksessiontest.drl;DRL") })
+// @Produces
+// @DefaultConfig
+// KnowledgeSessionProducer producer;
}
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -24,11 +24,11 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.cep">
- <d:CEPPseudoClockRuleResources>
+ <!--<d:CEPPseudoClockRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.CEPPseudoClockRuleResources</s:Exact>
<d:resources>
<s:value>classpath;ceptest.drl;DRL</s:value>
</d:resources>
</d:CEPPseudoClockRuleResources>
-</beans>
+--></beans>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/channel/ChannelTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/channel/ChannelTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/channel/ChannelTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -22,7 +22,7 @@
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="urn:java:ee"
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
- xmlns:test="urn:java:org.jboss.seam.drools.test.ksession">
+ xmlns:test="urn:java:org.jboss.seam.drools.test.ksession"><!--
<d:DefaultRuleResources>
<s:modifies/>
@@ -32,4 +32,4 @@
</d:resources>
</d:DefaultRuleResources>
-</beans>
+--></beans>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/customoperator/CustomOperatorTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/customoperator/CustomOperatorTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/customoperator/CustomOperatorTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -24,7 +24,7 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.ksession">
- <d:DefaultRuleResources>
+ <!--<d:DefaultRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
<d:resources>
@@ -32,4 +32,4 @@
</d:resources>
</d:DefaultRuleResources>
-</beans>
+--></beans>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/delegate/DelegateTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/delegate/DelegateTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/delegate/DelegateTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -24,7 +24,7 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.delegate">
- <d:DefaultRuleResources>
+ <!--<d:DefaultRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
<d:resources>
@@ -32,7 +32,7 @@
</d:resources>
</d:DefaultRuleResources>
- <test:DelegateBean>
+ --><test:DelegateBean>
<s:overrides/>
<s:RequestScoped />
<s:Named>testDelegate</s:Named>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -24,7 +24,7 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.flow">
- <d:DefaultRuleResources>
+ <!--<d:DefaultRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
<d:resources>
@@ -33,4 +33,4 @@
</d:resources>
</d:DefaultRuleResources>
-</beans>
+--></beans>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -32,7 +32,7 @@
<class>org.jboss.seam.drools.interceptor.AbortProcessInterceptor</class>
</interceptors>
- <d:DefaultRuleResources>
+ <!--<d:DefaultRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
<d:resources>
@@ -65,4 +65,4 @@
</d:DroolsConfig>
-</beans>
+--></beans>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -24,7 +24,7 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.kagent">
- <d:RuleResources>
+ <!--<d:RuleResources>
<s:overrides/>
<test:KAgentTestConfig/>
<d:resources>
@@ -63,4 +63,4 @@
<test:KAgentTestConfig/>
</d:ruleResources>
</d:DroolsConfig>
-</beans>
+--></beans>
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.xls
===================================================================
(Binary files differ)
Property changes on: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/query/QueryTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/query/QueryTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/query/QueryTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -24,7 +24,7 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.ksession">
- <d:DefaultRuleResources>
+ <!--<d:DefaultRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
<d:resources>
@@ -32,4 +32,4 @@
</d:resources>
</d:DefaultRuleResources>
-</beans>
+--></beans>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/sessionreport/SessionReportTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/sessionreport/SessionReportTest-beans.xml 2010-09-17 11:57:48 UTC (rev 13763)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/sessionreport/SessionReportTest-beans.xml 2010-09-17 19:42:59 UTC (rev 13764)
@@ -22,7 +22,7 @@
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="urn:java:ee"
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
- xmlns:test="urn:java:org.jboss.seam.drools.test.ksession">
+ xmlns:test="urn:java:org.jboss.seam.drools.test.ksession"><!--
<d:DefaultRuleResources>
<s:modifies/>
@@ -32,4 +32,4 @@
</d:resources>
</d:DefaultRuleResources>
-</beans>
+--></beans>
14 years, 2 months
Seam SVN: r13763 - modules/resteasy/trunk.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-09-17 07:57:48 -0400 (Fri, 17 Sep 2010)
New Revision: 13763
Modified:
modules/resteasy/trunk/pom.xml
Log:
fixed running of jbossas-remote-6 profile
Modified: modules/resteasy/trunk/pom.xml
===================================================================
--- modules/resteasy/trunk/pom.xml 2010-09-17 11:15:01 UTC (rev 13762)
+++ modules/resteasy/trunk/pom.xml 2010-09-17 11:57:48 UTC (rev 13763)
@@ -19,7 +19,6 @@
<seam.version>3.0.0.b01</seam.version>
<arquillian.version>1.0.0.Alpha3</arquillian.version>
<jbossas.version>6.0.0.20100721-M4</jbossas.version>
- <jbossas.managed>false</jbossas.managed>
<jboss.server.manager.version>1.0.3.GA</jboss.server.manager.version>
</properties>
@@ -201,7 +200,6 @@
<properties>
<bindAddress>localhost</bindAddress>
<httpPort>8080</httpPort>
- <jbossas.managed>true</jbossas.managed>
</properties>
<dependencies>
<dependency>
@@ -235,12 +233,6 @@
<profile>
<id>jbossas-remote-6</id>
- <activation>
- <property>
- <name>jbossas.managed</name>
- <value>false</value>
- </property>
- </activation>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
14 years, 2 months
Seam SVN: r13762 - in modules/resteasy/trunk: impl and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-09-17 07:15:01 -0400 (Fri, 17 Sep 2010)
New Revision: 13762
Modified:
modules/resteasy/trunk/impl/pom.xml
modules/resteasy/trunk/pom.xml
Log:
code-coverage capability and arq jbossas-managed profile
Modified: modules/resteasy/trunk/impl/pom.xml
===================================================================
--- modules/resteasy/trunk/impl/pom.xml 2010-09-16 14:39:16 UTC (rev 13761)
+++ modules/resteasy/trunk/impl/pom.xml 2010-09-17 11:15:01 UTC (rev 13762)
@@ -22,6 +22,32 @@
<version>${project.version}</version>
</dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: modules/resteasy/trunk/pom.xml
===================================================================
--- modules/resteasy/trunk/pom.xml 2010-09-16 14:39:16 UTC (rev 13761)
+++ modules/resteasy/trunk/pom.xml 2010-09-17 11:15:01 UTC (rev 13762)
@@ -16,8 +16,11 @@
<packaging>pom</packaging>
<properties>
- <seam.version>3.0.0.b01</seam.version>
- <arquillian.version>1.0.0.Alpha3</arquillian.version>
+ <seam.version>3.0.0.b01</seam.version>
+ <arquillian.version>1.0.0.Alpha3</arquillian.version>
+ <jbossas.version>6.0.0.20100721-M4</jbossas.version>
+ <jbossas.managed>false</jbossas.managed>
+ <jboss.server.manager.version>1.0.3.GA</jboss.server.manager.version>
</properties>
<url>http://www.seamframework.org</url>
@@ -38,7 +41,6 @@
<module>impl</module>
</modules>
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -100,12 +102,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-jbossas-remote-6</artifactId>
- <version>${arquillian.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<!-- <version>6.0.0-SNAPSHOT</version>-->
@@ -152,6 +148,124 @@
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deploy-emma-jar</id>
+ <phase>process-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo message="Deploying emma jar to server lib directory" />
+ <copy file="${emma.jar.file}"
+ todir="${env.JBOSS_HOME}/server/default/lib"
+ overwrite="true" />
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>retrieve-coverage-file</id>
+ <phase>test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <move file="${env.JBOSS_HOME}/bin/coverage.ec"
+ todir="${basedir}" failonerror="false" />
+ <delete file="${basedir}/transaction.log"
+ failonerror="false" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+
+ <profile>
+ <id>jbossas-managed-6</id>
+ <properties>
+ <bindAddress>localhost</bindAddress>
+ <httpPort>8080</httpPort>
+ <jbossas.managed>true</jbossas.managed>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-managed-6</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <version>${jboss.server.manager.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>${jbossas.version}</version>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas</directory>
+ </testResource>
+ </testResources>
+ </build>
+ </profile>
+
+ <profile>
+ <id>jbossas-remote-6</id>
+ <activation>
+ <property>
+ <name>jbossas.managed</name>
+ <value>false</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-6</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>${jbossas.version}</version>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas</directory>
+ </testResource>
+ </testResources>
+ </build>
+ </profile>
+ </profiles>
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/resteasy/trunk</connection>
14 years, 2 months
Seam SVN: r13761 - modules/drools/trunk/impl.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-09-16 10:39:16 -0400 (Thu, 16 Sep 2010)
New Revision: 13761
Modified:
modules/drools/trunk/impl/pom.xml
Log:
code-coverage capability
Modified: modules/drools/trunk/impl/pom.xml
===================================================================
--- modules/drools/trunk/impl/pom.xml 2010-09-16 13:22:48 UTC (rev 13760)
+++ modules/drools/trunk/impl/pom.xml 2010-09-16 14:39:16 UTC (rev 13761)
@@ -116,6 +116,28 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
- </dependencies>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
14 years, 2 months
Seam SVN: r13760 - branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-09-16 09:22:48 -0400 (Thu, 16 Sep 2010)
New Revision: 13760
Modified:
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml
Log:
JBPAPP-5035
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml 2010-09-16 11:33:26 UTC (rev 13759)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml 2010-09-16 13:22:48 UTC (rev 13760)
@@ -41,65 +41,98 @@
First, configure seam-gen for your environment. Just type the following in your command line interface:
</para>
-<programlisting>cd <seam_distribution_dir> seam setup</programlisting>
+<programlisting>cd <seam_distribution_dir></programlisting>
+<programlisting>seam setup</programlisting>
<para>
You will receive the following prompt for the required information:
</para>
<programlisting><seam_distribution_dir>$ ./seam setup
-Buildfile: build.xml
+SEAM_HOME: /home/mnovotny/apps/jboss-eap-5.1/seam
+Using seam-gen sources from: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen
+Buildfile: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen/build.xml
init:
setup:
- [echo] Welcome to seam-gen :-)
- [input] Enter your project workspace (the directory that contains your Seam projects) [C:/Projects] [C:/Projects]
-/Users/pmuir/workspace
- [input] Enter your JBoss home directory [C:/Program Files/jboss-eap-5.0.1/jboss-as] [C:/Program Files/jboss-eap-5.0.1/jboss-as]
-/var/lib/jbossas
+ [echo] Welcome to seam-gen 2.2.2.EAP5 :-)
+ [echo] Answer each question or hit ENTER to accept the default (in brackets)
+ [echo]
+ [input] Enter the directory where you want the project to be created (should not contain spaces) [/home/mnovotny/projects] [/home/mnovotny/projects]
+
+ [input] Enter your JBoss AS home directory [/var/lib/jbossas] [/var/lib/jbossas]
+/home/mnovotny/apps/jboss-eap-5.1/jboss-as
+ [input] Enter your JBoss AS domain [default] [default]
+
[input] Enter the project name [myproject] [myproject]
helloworld
[echo] Accepted project name as: helloworld
- [input] Select a RichFaces skin (not applicable if using ICEFaces) [blueSky] ([blueSky], classic, ruby, wine, deepMarine, emeraldTown, sakura, DEFAULT)
+ [input] Select a RichFaces skin [glassX] (blueSky, classic, darkX, deepMarine, DEFAULT, emeraldTown, [glassX], japanCherry, laguna, ruby, wine)
- [input] Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support) [ear] ([ear], war, )
+ [input] Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support)? [war] (ear, [war])
+ear
+ [input] Enter the base package name for your Java classes [com.mydomain.helloworld] [com.mydomain.helloworld]
- [input] Enter the Java package name for your session beans [com.mydomain.helloworld] [com.mydomain.helloworld]
-org.jboss.helloworld
- [input] Enter the Java package name for your entity beans [org.jboss.helloworld] [org.jboss.helloworld]
+ [input] Enter the Java package name for your session beans [com.mydomain.helloworld.action] [com.mydomain.helloworld.action]
- [input] Enter the Java package name for your test cases [org.jboss.helloworld.test] [org.jboss.helloworld.test]
+ [input] Enter the Java package name for your entity beans [com.mydomain.helloworld.model] [com.mydomain.helloworld.model]
- [input] What kind of database are you using? [hsql] ([hsql], mysql, oracle, postgres, mssql, db2, sybase, enterprisedb, h2)
+ [input] Enter the Java package name for your test cases [com.mydomain.helloworld.test] [com.mydomain.helloworld.test]
+
+ [input] What kind of database are you using? [hsql] ([hsql], mysql, derby, oracle, postgres, mssql, db2, sybase, enterprisedb, h2)
mysql
+ [input] Enter the filesystem path to the JDBC driver jar [] []
+/usr/share/java/mysql.jar
+ [input] skipping input as property driver.license.jar.new has already been set.
[input] Enter the Hibernate dialect for your database [org.hibernate.dialect.MySQLDialect] [org.hibernate.dialect.MySQLDialect]
- [input] Enter the filesystem path to the JDBC driver jar [lib/hsqldb.jar] [lib/hsqldb.jar]
-/usr/share/java/mysql.jar
- [input] Enter JDBC driver class for your database [com.mysql.jdbc.Driver] [com.mysql.jdbc.Driver]
+ [input] Enter the JDBC driver class for your database [com.mysql.jdbc.Driver] [com.mysql.jdbc.Driver]
+ [input] Enter the JDBC DataSource class for your database [com.mysql.jdbc.jdbc2.optional.MysqlDataSource] [com.mysql.jdbc.jdbc2.optional.MysqlDataSource]
+
[input] Enter the JDBC URL for your database [jdbc:mysql:///test] [jdbc:mysql:///test]
-jdbc:mysql:///helloworld
- [input] Enter database username [sa] [sa]
-pmuir
- [input] Enter database password [] []
- [input] skipping input as property hibernate.default_schema.new has already been set.
- [input] Enter the database catalog name (it is OK to leave this blank) [] []
+ [input] Enter the database username [sa] [sa]
+root
+ [input] Enter the database password [] []
- [input] Are you working with tables that already exist in the database? [n] (y, [n], )
+ [input] skipping input as property hibernate.default_schema.entered has already been set.
+ [input] Enter the database catalog name (Enter '-' to clear previous value) [] []
+
+ [input] Are you working with tables that already exist in the database? [n] (y, [n])
y
- [input] Do you want to drop and recreate the database tables and data in import.sql each time you deploy? [n] (y, [n], )
-n
- [input] Enter your ICEfaces home directory (leave blank to omit ICEfaces) [] []
+ [input] Do you want to recreate the database tables and execute import.sql each time you deploy? [n] (y, [n])
-[propertyfile] Creating new property file: /Users/pmuir/workspace/jboss-seam/seam-gen/build.properties
- [echo] Installing JDBC driver jar to JBoss server
- [echo] Type 'seam create-project' to create the new project
+[propertyfile] Creating new property file: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen/build.properties
+ [echo] Installing JDBC driver jar to JBoss AS
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/jboss-as/server/default/lib
-BUILD SUCCESSFUL
-Total time: 1 minute 32 seconds
-~/workspace/jboss-seam $
+init:
+
+init-properties:
+ [echo] /home/mnovotny/apps/jboss-eap-5.1/jboss-as
+
+validate-workspace:
+
+validate-project:
+
+settings:
+ [echo] JBoss AS home: /home/mnovotny/apps/jboss-eap-5.1/jboss-as
+ [echo] Project name: helloworld
+ [echo] Project location: /home/mnovotny/projects/helloworld
+ [echo] Project type: ear
+ [echo] Action package: com.mydomain.helloworld.action
+ [echo] Model package: com.mydomain.helloworld.model
+ [echo] Test package: com.mydomain.helloworld.test
+ [echo] JDBC driver class: com.mysql.jdbc.Driver
+ [echo] JDBC DataSource class: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
+ [echo] Hibernate dialect: org.hibernate.dialect.MySQLDialect
+ [echo] JDBC URL: jdbc:mysql:///test
+ [echo] Database username: root
+ [echo] Database password:
+ [echo]
+ [echo] Type './seam create-project' to create the new project
+
</programlisting>
<para>
The tool provides sensible defaults. To accept them, press <keycap>Enter</keycap> when prompted.
@@ -114,19 +147,107 @@
Create a new project in our Eclipse workspace directory by typing:
</para>
-<programlisting>seam new-project
+<programlisting>./seam create-project
</programlisting>
-<programlisting><seam_distribution_dir> seam new-project
-Buildfile: build.xml
-...
-new-project:
- [echo] A new Seam project named 'helloworld' was created in the C:\Projects directory
- [echo] Type 'seam explode' and go to http://localhost:8080/helloworld
- [echo] Eclipse Users: Add the project into Eclipse using File > New > Project and select General > Project (not Java Project)
- [echo] NetBeans Users: Open the project in NetBeans
-BUILD SUCCESSFUL Total time: 7 seconds
-C:\Projects\jboss-seam>
+<programlisting><seam_distribution_dir>$ ./seam create-project
+SEAM_HOME: /home/mnovotny/apps/jboss-eap-5.1/seam
+Using seam-gen sources from: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen
+Buildfile: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen/build.xml
+
+init:
+
+init-properties:
+ [echo] /home/mnovotny/apps/jboss-eap-5.1/jboss-as
+
+validate-workspace:
+
+validate-project:
+
+initcopy:
+
+initpoms:
+ [echo] Setting up dependencies
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+[artifact:install] [INFO] Installing /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms/root.pom to /home/mnovotny/.m2/repository/org/jboss/seam/root/2.2.2.EAP5/root-2.2.2.EAP5.pom
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+[artifact:install] [INFO] Installing /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms/parent.pom to /home/mnovotny/.m2/repository/org/jboss/seam/parent/2.2.2.EAP5/parent-2.2.2.EAP5.pom
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+ [copy] Copying 1 file to /home/mnovotny/apps/jboss-eap-5.1/seam/classes/poms
+
+copyseam:
+
+copyseamdependencies:
+
+copyjbossembedded:
+
+copy-lib:
+ [echo] Copying Seam and dependencies to the /home/mnovotny/projects/helloworld/lib directory...
+ [copy] Copying 120 files to /home/mnovotny/projects/helloworld/lib
+ [copy] Copied 4 empty directories to 1 empty directory under /home/mnovotny/projects/helloworld/lib
+ [echo] Copying JBoss Embedded configuration to the /home/mnovotny/projects/helloworld/bootstrap directory...
+ [copy] Copying 30 files to /home/mnovotny/projects/helloworld/bootstrap
+
+file-copy-war:
+
+file-copy-ear:
+ [echo] Copying build scripts for EAR deployment to the /home/mnovotny/projects/helloworld directory...
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [echo] Copying resources needed for EAR deployment to the /home/mnovotny/projects/helloworld/resources directory...
+ [copy] Copying 8 files to /home/mnovotny/projects/helloworld/resources
+
+setup-filters:
+
+file-copy:
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 3 files to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 11 files to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 4 files to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/.settings
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld
+ [mkdir] Created dir: /home/mnovotny/projects/helloworld/nbproject
+ [copy] Copying 3 files to /home/mnovotny/projects/helloworld/nbproject
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/resources
+ [copy] Copying 13 files to /home/mnovotny/projects/helloworld/view
+ [copy] Copying 16 files to /home/mnovotny/projects/helloworld/view
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/hot/com/mydomain/helloworld/action
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/hot/com/mydomain/helloworld/action
+ [copy] Copying 3 files to /home/mnovotny/projects/helloworld
+ [mkdir] Created dir: /home/mnovotny/projects/helloworld/src/main/com/mydomain/helloworld/model
+ [mkdir] Created dir: /home/mnovotny/projects/helloworld/src/test/com/mydomain/helloworld/test
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/test
+
+create-project:
+ [echo] A new Seam project named 'helloworld' was created in the /home/mnovotny/projects directory
+ [echo] Type './seam explode' and go to http://localhost:8080/helloworld
+ [echo] Eclipse Users: Import the project using File > Import... > Existing Projects into Workspace, set the root directory to /home/mnovotny/projects, then select the project named helloworld
+ [echo] NetBeans Users: Open the project using File > Open project... and select the project folder /home/mnovotny/projects/helloworld
+ [echo] IDEA Users: Open the project using File > Open project... and select the file /home/mnovotny/projects/helloworld/helloworld.ipr
+
+BUILD SUCCESSFUL
+Total time: 9 seconds
+
</programlisting>
<para>
This copies the Seam <filename>JAR</filename>s, dependent <filename>JAR</filename>s and the JDBC driver <filename>JAR</filename> to a new Eclipse project. It generates all required resources and configuration files, a Facelets template file and stylesheet, along with Eclipse metadata and an Ant build script. The Eclipse project will be automatically deployed to an exploded directory structure in JBoss as soon as you add the project. To add the project, go to <guimenu>New</guimenu> → <guimenu>Project...</guimenu> → <guimenu>General</guimenu> → <guimenu>Project</guimenu> → <guimenu>Next</guimenu>, type the <guilabel>Project name</guilabel> (in this case, <literal>helloworld</literal>), and then click <literal>Finish</literal>. Do not select <literal>Java Project</literal> from the New Project wizard.
@@ -160,9 +281,16 @@
Seam prompts for some information, and generates a new Facelets page and Seam component for your project.
</para>
-<programlisting>C:\Projects\jboss-seam>seam new-action
-Buildfile: build.xml
+<programlisting><seam_distribution_dir>$ ./seam new-action
+SEAM_HOME: /home/mnovotny/apps/jboss-eap-5.1/seam
+Using seam-gen sources from: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen
+Buildfile: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen/build.xml
+init:
+
+init-properties:
+ [echo] /home/mnovotny/apps/jboss-eap-5.1/jboss-as
+
validate-workspace:
validate-project:
@@ -170,29 +298,34 @@
action-input:
[input] Enter the Seam component name
ping
- [input] Enter the local interface name [Ping]
+ [input] Enter the local interface name [Ping] [Ping]
- [input] Enter the bean class name [PingBean]
+ [input] Enter the bean class name [PingBean] [PingBean]
- [input] Enter the action method name [ping]
+ [input] Enter the action method name [ping] [ping]
- [input] Enter the page name [ping]
+ [input] Enter the page name [ping] [ping]
setup-filters:
-new-action:
+new-action-ear:
[echo] Creating a new stateless session bean component with an action method
- [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld
- [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld
- [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld\test
- [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld\test
- [copy] Copying 1 file to C:\Projects\helloworld\view
- [echo] Type 'seam restart' and go to http://localhost:8080/helloworld/ping.seam
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/hot/com/mydomain/helloworld/action
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/hot/com/mydomain/helloworld/action
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/test/com/mydomain/helloworld/test
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/test/com/mydomain/helloworld/test
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/view
+ [echo] Type './seam restart' and go to http://localhost:8080/helloworld/ping.seam
+new-action-war:
+
+insert-menu-item:
+
+new-action:
+
BUILD SUCCESSFUL
-Total time: 13 seconds
-C:\Projects\jboss-seam>
+Total time: 16 seconds
</programlisting>
<para>
Since we have added a new Seam component, it is necessary to restart the exploded directory deployment. You can do this by typing <literal>seam restart</literal>, or by running the <literal>restart</literal> target in the generated project's <literal>build.xml</literal> file from within Eclipse. Alternatively, you can edit the <literal>resources/META-INF/application.xml</literal> file in Eclipse.
@@ -219,9 +352,16 @@
<programlisting>seam new-form
</programlisting>
-<programlisting>C:\Projects\jboss-seam>seam new-form
-Buildfile: C:\Projects\jboss-seam\seam-gen\build.xml
+<programlisting><seam_distribution_dir>$ ./seam new-form
+SEAM_HOME: /home/mnovotny/apps/jboss-eap-5.1/seam
+Using seam-gen sources from: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen
+Buildfile: /home/mnovotny/apps/jboss-eap-5.1/seam/seam-gen/build.xml
+init:
+
+init-properties:
+ [echo] /home/mnovotny/apps/jboss-eap-5.1/jboss-as
+
validate-workspace:
validate-project:
@@ -229,29 +369,34 @@
action-input:
[input] Enter the Seam component name
hello
- [input] Enter the local interface name [Hello]
+ [input] Enter the local interface name [Hello] [Hello]
- [input] Enter the bean class name [HelloBean]
+ [input] Enter the bean class name [HelloBean] [HelloBean]
- [input] Enter the action method name [hello]
+ [input] Enter the action method name [hello] [hello]
- [input] Enter the page name [hello]
+ [input] Enter the page name [hello] [hello]
setup-filters:
-new-form:
+new-form-ear:
[echo] Creating a new stateful session bean component with an action method
- [copy] Copying 1 file to C:\Projects\hello\src\hot\com\hello
- [copy] Copying 1 file to C:\Projects\hello\src\hot\com\hello
- [copy] Copying 1 file to C:\Projects\hello\src\hot\com\hello\test
- [copy] Copying 1 file to C:\Projects\hello\view
- [copy] Copying 1 file to C:\Projects\hello\src\hot\com\hello\test
- [echo] Type 'seam restart' and go to http://localhost:8080/hello/hello.seam
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/hot/com/mydomain/helloworld/action
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/hot/com/mydomain/helloworld/action
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/test/com/mydomain/helloworld/test
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/view
+ [copy] Copying 1 file to /home/mnovotny/projects/helloworld/src/test/com/mydomain/helloworld/test
+ [echo] Type './seam restart' and go to http://localhost:8080/helloworld/hello.seam
+new-form-war:
+
+insert-menu-item:
+
+new-form:
+
BUILD SUCCESSFUL
-Total time: 5 seconds
-C:\Projects\jboss-seam>
+Total time: 10 seconds
</programlisting>
<para>
Restart the application again, and go to <literal>http://localhost:8080/helloworld/hello.seam</literal>. Look at the generated code. Run the test. Experiment with adding new fields to the form and Seam component. (Remember to restart the deployment each time you alter the Java code.)
@@ -373,30 +518,6 @@
For WAR projects created with seam-gen, incremental hot deployment is available out of the box for classes in the <literal>src/hot</literal> source directory. However, seam-gen does not support incremental hot deployment for EAR projects.
</para>
</section>
- <!--
- <section>
- <title>Using Seam with JBoss 4.0</title>
- <para>
- Seam 2.0 was developed for JavaServer Faces 1.2. When using JBoss AS, we recommend using JBoss 4.2 or JBoss 5.0, both of which bundle the JSF 1.2 reference implementation. However, Seam 2.0 can still operate on the JBoss 4.0 platform. There are two steps required to do this: install an EJB3-enabled version of JBoss 4.0, and replace MyFaces with the JSF 1.2 reference implementation. Once these steps have been completed, Seam 2.0 applications can be deployed to JBoss 4.0.
- </para>
- <section>
- <title>Install JBoss 4.0</title>
- <para>
- JBoss 4.0 does not ship a default configuration compatible with Seam. To run Seam, install JBoss 4.0.5 using the JEMS 1.2 installer with the EJB3 profile selected. Seam will not run with an installation that doesn't include EJB3 support. The JEMS installer can be downloaded from <ulink url="http://labs.jboss.com/jemsinstaller/downloads">http://labs.jboss.com/ jemsinstaller/downloads</ulink>.
- </para>
- </section>
-
- <section>
- <title>Install the JSF 1.2 RI</title>
- <para>
- The web configuration for JBoss 4.0 can be found in the <filename>server/default/deploy/jbossweb-tomcat55.sar</filename>. You will need to delete <filename>myfaces-api.jar</filename> and any <filename>myfaces-impl.jar</filename> from the <filename>jsf-libs </filename>directory. Then, you will need to copy <filename>jsf-api.jar</filename>, <filename>jsf-impl.jar</filename>, <filename>el-api.jar</filename>, and <filename>el-ri.jar</filename> to that directory. The JSF JARs can be found in the Seam <filename>lib</filename> directory. The EL JARs can be obtained from the Seam 1.2 release.
- </para>
- <para>
- You will also need to edit the <filename>conf/web.xml</filename>, replacing <filename>myfaces-impl.jar</filename> with <filename>jsf-impl.jar</filename>.
- </para>
- </section>
-
- </section>-->
</chapter>
14 years, 2 months
Seam SVN: r13759 - branches/enterprise/JBPAPP_5_0/ui/src/main/java/org/jboss/seam/ui/component.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-09-16 07:33:26 -0400 (Thu, 16 Sep 2010)
New Revision: 13759
Modified:
branches/enterprise/JBPAPP_5_0/ui/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java
Log:
JBPAPP-4508
Modified: branches/enterprise/JBPAPP_5_0/ui/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/ui/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java 2010-09-16 10:47:03 UTC (rev 13758)
+++ branches/enterprise/JBPAPP_5_0/ui/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java 2010-09-16 11:33:26 UTC (rev 13759)
@@ -144,6 +144,122 @@
this.localInputStream = localInputStream;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.faces.component.UIOutput#getLocalValue()
+ */
+ @Override
+ public Object getLocalValue() {
+ return new LocalUploadValue(localContentType, localFileName, localFileSize,
+ localInputStream);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.faces.component.UIInput#setValue(java.lang.Object)
+ */
+ @Override
+ public void setValue(Object value) {
+ // Check if the local values get restored
+ if (value != null && value instanceof LocalUploadValue) {
+ LocalUploadValue localValue = (LocalUploadValue) value;
+ localFileName = localValue.getFileName();
+ localFileSize = localValue.getFileSize();
+ localContentType = localValue.getContentType();
+ localInputStream = localValue.getInputStream();
+ } else {
+ super.setValue(value);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.faces.component.UIInput#isLocalValueSet()
+ */
+ @Override
+ public boolean isLocalValueSet() {
+ return localContentType != null || localFileName != null || localFileSize != null
+ || localInputStream != null;
+ }
+
+ /**
+ * Helper class to store the local values.
+ */
+ protected class LocalUploadValue {
+
+ /** Stores the local content type. */
+ private String contentType;
+
+ /** Stores the local file name. */
+ private String fileName;
+
+ /** Stores the local file size. */
+ private Integer fileSize;
+
+ /** Stores the local stream information. */
+ private InputStream inputStream;
+
+ /**
+ * Constructor for this class.
+ *
+ * @param contentType
+ * The local content type to save
+ * @param fileName
+ * The local file name to save
+ * @param fileSize
+ * The local file size to save
+ * @param inputStream
+ * The local input stream to save
+ */
+ public LocalUploadValue(String contentType, String fileName, Integer fileSize,
+ InputStream inputStream) {
+ super();
+ this.contentType = contentType;
+ this.fileName = fileName;
+ this.fileSize = fileSize;
+ this.inputStream = inputStream;
+ }
+
+ /**
+ * Returns the contentType value.
+ *
+ * @return the contentType value
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * Returns the fileName value.
+ *
+ * @return the fileName value
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
+ /**
+ * Returns the fileSize value.
+ *
+ * @return the fileSize value
+ */
+ public Integer getFileSize() {
+ return fileSize;
+ }
+
+ /**
+ * Returns the inputStream value.
+ *
+ * @return the inputStream value
+ */
+ public InputStream getInputStream() {
+ return inputStream;
+ }
+ }
+
public abstract void setAccept(String accept);
public abstract String getAccept();
14 years, 2 months
Seam SVN: r13758 - branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-09-16 06:47:03 -0400 (Thu, 16 Sep 2010)
New Revision: 13758
Modified:
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml
Log:
JBPAPP-5034
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2010-09-16 10:35:07 UTC (rev 13757)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2010-09-16 10:47:03 UTC (rev 13758)
@@ -12,7 +12,7 @@
<section id="jdk_dependencies">
<title>Java Development Kit Dependencies</title>
<para>
- Seam does not work with <trademark class="trade">JDK</trademark> (Java Development Kit) 1.4, and requires JDK 5 or higher to support annotations and other features. Seam has been thoroughly tested with other JDKs. There are no known issues that are specific to Seam.
+ Seam does not work with <trademark class="trade">JDK</trademark> (Java Development Kit) 1.4, and requires JDK 6 or higher to support annotations and other features. Seam has been thoroughly tested with other JDKs. There are no known issues that are specific to Seam.
</para>
<section id="jdk6_dependencies">
<title>Sun's JDK 6 Considerations</title>
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml 2010-09-16 10:35:07 UTC (rev 13757)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Gettingstarted.xml 2010-09-16 10:47:03 UTC (rev 13758)
@@ -16,7 +16,7 @@
<section>
<title>Before you start</title>
<para>
- Make sure you have JDK 5 or JDK 6 (see <xref linkend="jdk_dependencies" /> for details), JBoss Enterprise Application Platform 5 and Ant 1.7.0, along with recent versions of Eclipse, the JBoss IDE plugin for Eclipse and the TestNG plugin for Eclipse correctly installed before you begin this tutorial. Add your JBoss installation to the JBoss Server View in Eclipse. Then, start JBoss in debug mode. Finally, start a command prompt in the directory where you unzipped the Seam distribution.
+ Make sure you have JDK 6 (see <xref linkend="jdk_dependencies" /> for details), JBoss Enterprise Application Platform 5 and Ant 1.7.0 or 1.8.x, along with recent versions of Eclipse, the JBoss IDE plugin for Eclipse and the TestNG plugin for Eclipse correctly installed before you begin this tutorial. Add your JBoss installation to the JBoss Server View in Eclipse. Then, start JBoss in debug mode. Finally, start a command prompt in the directory where you unzipped the Seam distribution.
</para>
<para>
JBoss has sophisticated support for hot redeployment of <filename>WAR</filename>s and <filename>EAR</filename>s. Unfortunately, due to bugs in JVM, repeat redeployment of an EAR (common during development) uses all of the JVM's perm gen space. Therefore, we recommend running JBoss in a JVM with a large perm gen space during development. If you are running JBoss from JBoss IDE, you can configure this in the server launch configuration, under "VM arguments". We suggest the following values:
@@ -132,7 +132,7 @@
This copies the Seam <filename>JAR</filename>s, dependent <filename>JAR</filename>s and the JDBC driver <filename>JAR</filename> to a new Eclipse project. It generates all required resources and configuration files, a Facelets template file and stylesheet, along with Eclipse metadata and an Ant build script. The Eclipse project will be automatically deployed to an exploded directory structure in JBoss as soon as you add the project. To add the project, go to <guimenu>New</guimenu> → <guimenu>Project...</guimenu> → <guimenu>General</guimenu> → <guimenu>Project</guimenu> → <guimenu>Next</guimenu>, type the <guilabel>Project name</guilabel> (in this case, <literal>helloworld</literal>), and then click <literal>Finish</literal>. Do not select <literal>Java Project</literal> from the New Project wizard.
</para>
<para>
- If your default JDK in Eclipse is not a Java SE 5 or Java SE 6 JDK, you will need to select a Java SE 5 compliant JDK. Go to <guimenu>Project</guimenu> → <guimenu>Properties</guimenu> → <guimenu>Java Compiler</guimenu>.
+ If your default JDK in Eclipse is not a Java SE 6 JDK, you will need to select a Java SE 6 compliant JDK. Go to <guimenu>Project</guimenu> → <guimenu>Properties</guimenu> → <guimenu>Java Compiler</guimenu>.
</para>
<para>
Alternatively, you can deploy the project from outside Eclipse by typing <command>seam explode</command>.
14 years, 2 months
Seam SVN: r13756 - branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-09-15 18:49:59 -0400 (Wed, 15 Sep 2010)
New Revision: 13756
Modified:
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Migration.xml
Log:
fixed typos
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Migration.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Migration.xml 2010-09-15 22:34:02 UTC (rev 13755)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Migration.xml 2010-09-15 22:49:59 UTC (rev 13756)
@@ -593,7 +593,7 @@
</row>
<row>
<entry>
- <para> <filename>testng-jdk5.jar</filename> </para>
+ <para> <filename>testng-jdk15.jar</filename> </para>
</entry>
<entry>
<para> TestNG framework </para>
@@ -716,7 +716,7 @@
<para> <filename>testng.jar</filename> </para>
</entry>
<entry>
- <para> TestNG framework replaced by testng-jdk50.jar </para>
+ <para> TestNG framework replaced by testng-jdk15.jar </para>
</entry>
</row>
<row>
14 years, 2 months